Пример #1
0
 private void updateData(ClientReconciliation reconciliation) {
   clearedTransactions.clear();
   bankaccountLabel.setValue(reconciliation.getAccount().getName());
   closebalanceLable.setAmount(reconciliation.getClosingBalance());
   startdateLable.setValue(
       DateUtills.getDateAsString(reconciliation.getStartDate().getDateAsObject()));
   enddateLable.setValue(
       DateUtills.getDateAsString(reconciliation.getEndDate().getDateAsObject()));
   closingBalance.setAmount(reconciliation.getClosingBalance());
   startdateLable.setValue(reconciliation.getStartDate().toString());
   enddateLable.setValue(reconciliation.getEndDate().toString());
   bankaccountLabel.setValue(reconciliation.getAccount().getName());
   setData(reconciliation);
   initData();
 }
Пример #2
0
  public void createControls() {
    // Creating Title for View
    Label label = new Label();
    label.removeStyleName("gwt-Label");
    label.addStyleName("label-title");
    label.setText(messages.Reconciliation());

    bankaccountLabel = new LabelItem(messages.Account(), "bankaccountLabel");
    bankaccountLabel.setValue(data.getAccount().getName());

    closebalanceLable = new AmountLabel(messages.ClosingBalance());
    closebalanceLable.setTitle(messages.ClosingBalance());
    closebalanceLable.setAmount(data.getClosingBalance());

    startdateLable = new LabelItem(messages.startDate(), "startdateLable");
    startdateLable.setValue(DateUtills.getDateAsString(data.getStartDate().getDateAsObject()));

    enddateLable = new LabelItem(messages.endDate(), "enddateLable");
    enddateLable.setValue(DateUtills.getDateAsString(data.getEndDate().getDateAsObject()));

    // // Creating Input Fields to Start Reconciliation of an Account
    // bankAccountsField = new SelectCombo(messages.bankAccount(Global.get()
    // .Account()));
    //
    // bankAccountsField
    // .addSelectionChangeHandler(new
    // IAccounterComboSelectionChangeHandler<String>() {
    //
    // @Override
    // public void selectedComboBoxItem(String selectItem) {
    // // TODO Auto-generated method stub
    //
    // }
    // });
    //
    // startDate = new DateField(constants.startDate());
    // endDate = new DateField(constants.endDate());
    // closingBalance = new TextItem(constants.ClosingBalance());

    DynamicForm form = new DynamicForm("form");
    form.add(bankaccountLabel, closebalanceLable);
    form.setStyleName("recouncilation_value");

    DynamicForm datesForm = new DynamicForm("datesForm");
    datesForm.add(startdateLable, enddateLable);

    StyledPanel hPanel = new StyledPanel("hPanel");
    // hPanel.setWidth("100%");
    hPanel.add(form);
    hPanel.add(datesForm);
    // hPanel.setCellWidth(form, "40%");
    Button changeBtn = new Button(messages.change());
    changeBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            ReconciliationDialog dialog =
                new ReconciliationDialog(
                    Global.get().messages().Reconciliation(),
                    data,
                    new ValueCallBack<ClientReconciliation>() {

                      @Override
                      public void execute(ClientReconciliation value) {
                        updateData(value);
                      }
                    });
            ViewManager.getInstance().showDialog(dialog);
          }
        });

    StyledPanel btnPanel = new StyledPanel("btnPanel");
    // btnPanel.setWidth("100%");
    btnPanel.add(changeBtn);
    btnPanel.setStyleName("recoucilation_change");
    // btnPanel.setCellHorizontalAlignment(changeBtn,
    // HasHorizontalAlignment.ALIGN_RIGHT);

    // Creating Amount Fields
    StyledPanel amountsPanel = new StyledPanel("amountsPanel");

    openingBalance = new AmountLabel(messages.openingBalance());
    openingBalance.setEnabled(false);
    openingBalance.setAmount(data.getOpeningBalance());

    closingBalance = new AmountLabel(messages.ClosingBalance());
    closingBalance.setEnabled(true);
    closingBalance.setAmount(data.getClosingBalance());

    clearedAmount = new AmountLabel(messages.ClearedAmount());
    clearedAmount.setEnabled(true);

    difference = new AmountLabel(messages.Difference());
    difference.setEnabled(false);
    DynamicForm amountsForm = new DynamicForm("amountsForm");
    // amountsForm.setWidth("50%");
    amountsForm.add(openingBalance, closingBalance, clearedAmount, difference);
    amountsPanel.add(amountsForm);
    amountsPanel.setStyleName("bottom_total_view");

    this.grid =
        new ReconciliationTransactionsGrid(
            this,
            new SelectionChangedHandler<ClientReconciliationItem>() {

              @Override
              public void selectionChanged(ClientReconciliationItem obj, boolean isSelected) {
                if (isCreating()) {
                  clearTransaction(obj, isSelected);
                }
              }
            });
    // grid.setWidth("100%");
    // grid.setHeight("200px");

    this.mainPanel = new StyledPanel("mainPanel");
    StyledPanel gridPanel = new StyledPanel("reconcillation_grid_panel");
    mainPanel.add(label);
    mainPanel.add(hPanel);
    if (isCreating()) {
      mainPanel.add(btnPanel);
    }
    gridPanel.add(grid);
    mainPanel.add(gridPanel);
    // mainPanel.setCellHeight(grid, "200px");
    grid.getElement().getParentElement().addClassName("recounciliation_grid");
    mainPanel.add(amountsPanel);
    this.add(mainPanel);
  }