コード例 #1
0
  protected void callRPC(int start, int length) {
    transactionHistoryGrid.removeAllRecords();
    records = new ArrayList<TransactionHistory>();
    if (selectedItem != null) {
      Accounter.createHomeService()
          .getItemTransactionsList(
              selectedItem.getID(),
              getTransactionType(),
              getTransactionStatusType(),
              startDate,
              endDate,
              start,
              length,
              new AsyncCallback<PaginationList<TransactionHistory>>() {

                @Override
                public void onFailure(Throwable caught) {
                  Accounter.showError(messages.unableToPerformTryAfterSomeTime());
                }

                @Override
                public void onSuccess(PaginationList<TransactionHistory> result) {
                  records = result;
                  selectedItem = getCompany().getItem(selectedItem.getID());
                  transactionHistoryGrid.setSelectedItem(selectedItem);
                  itemDetailsPanel.showItemDetails(selectedItem);
                  transactionHistoryGrid.removeAllRecords();
                  if (records != null) {
                    transactionHistoryGrid.addRecords(records);
                  }
                  updateRecordsCount(result.getStart(), result.size(), result.getTotalCount());
                  if (records.size() == 0) {
                    transactionHistoryGrid.addEmptyMessage(
                        messages.thereAreNo(messages.transactions()));
                  }
                }
              });

    } else {
      transactionHistoryGrid.removeAllRecords();
      transactionHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions()));
    }
  }
コード例 #2
0
  private void createControls() {
    StyledPanel mainPanel = new StyledPanel("mainPanel");
    StyledPanel leftVpPanel = new StyledPanel("leftVpPanel");
    viewTypeCombo();
    DynamicForm viewform = new DynamicForm("viewform");
    viewform.add(activeInActiveSelect);
    leftVpPanel.add(viewform);
    itemsListGrid = new InventoryCentreItemsListGrid();
    itemsListGrid.init();
    initItemsListGrid();
    leftVpPanel.add(itemsListGrid);

    itemsListGrid.setStyleName("cusotmerCentrGrid");

    rightVpPanel = new StyledPanel("rightVpPanel");
    dummyPanel = new StyledPanel("dummyPanel");
    itemDetailsPanel = new ItemDetailsPanel(selectedItem);
    rightVpPanel.add(itemDetailsPanel);
    itemsListGrid.setItemSelectionListener(
        new ItemSelectionListener() {

          @Override
          public void itemSelected(ClientItem selectedItem) {
            InventoryCentreView.this.selectedItem = selectedItem;
            onItemSelected();
          }
        });
    transactionViewSelectCombo();
    transactionViewTypeSelectCombo();
    transactionDateRangeSelector();
    DynamicForm transactionViewform = new DynamicForm("viewform");

    transactionViewform.add(trasactionViewSelect, trasactionViewTypeSelect, dateRangeSelector);

    transactionGridpanel = new StyledPanel("transactionGridpanel");
    transactionGridpanel.add(transactionViewform);
    transactionHistoryGrid =
        new ItemTransactionsHistoryGrid() {
          @Override
          public void initListData() {

            onItemSelected();
          }

          @Override
          protected String[] setHeaderStyle() {
            return new String[] {"date", "type", "no", "memo", "quantity", "amount"};
          }

          @Override
          protected String[] setRowElementsStyle() {
            return new String[] {
              "date-value", "type-value", "no-value", "memo-value", "quantity-value", "amount"
            };
          }
        };
    transactionHistoryGrid.init();
    transactionHistoryGrid.addEmptyMessage(messages.pleaseSelectAnItem());
    int pageSize = getPageSize();
    transactionHistoryGrid.addRangeChangeHandler2(
        new Handler() {

          @Override
          public void onRangeChange(RangeChangeEvent event) {
            onPageChange(event.getNewRange().getStart(), event.getNewRange().getLength());
          }
        });
    SimplePager pager =
        new SimplePager(
            TextLocation.CENTER,
            (Resources) GWT.create(Resources.class),
            false,
            pageSize * 2,
            true);
    pager.setDisplay(transactionHistoryGrid);
    updateRecordsCount(0, 0, 0);

    if (Accounter.isIpadApp()) {

      transactionButton = new Button(messages.transaction());
      transactionButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              ActionFactory.getInventoryTransactionListHistory(selectedItem).run();
            }
          });

    } else {
      dummyPanel.add(transactionGridpanel);
      dummyPanel.add(transactionHistoryGrid);
      dummyPanel.add(pager);
    }

    rightVpPanel.add(dummyPanel);

    Label labelTitle = new Label(messages.inventoryCentre());
    labelTitle.setStyleName("label-title");
    mainPanel.add(leftVpPanel);
    mainPanel.add(rightVpPanel);
    add(labelTitle);
    add(mainPanel);
  }