@Override protected void callRPC(int start, int length) { custHistoryGrid.removeAllRecords(); records = new ArrayList<TransactionHistory>(); if (selectedCustomer != null) { Accounter.createReportService() .getCustomerTransactionsList( selectedCustomer.getID(), getTransactionType(), getTransactionStatusType(), getStartDate(), getEndDate(), start, length, new AsyncCallback<PaginationList<TransactionHistory>>() { @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } @Override public void onSuccess(PaginationList<TransactionHistory> result) { records = result; custHistoryGrid.removeAllRecords(); if (records != null) { custHistoryGrid.addRecords(records); } updateRecordsCount(result.getStart(), result.size(), result.getTotalCount()); if (records.size() == 0) { custHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions())); } } }); } else { custHistoryGrid.removeAllRecords(); custHistoryGrid.addEmptyMessage(messages.thereAreNo(messages.transactions())); } }
private void OncusotmerSelected() { this.selectedCustomer = custGrid.getSelectedCustomer(); if (Accounter.isIpadApp()) { rightVpPanel.add(transactionButton); transactionButton.setText(messages2.transactionListFor(selectedCustomer.getDisplayName())); } detailsPanel.showCustomerDetails(selectedCustomer); custHistoryGrid.setSelectedCustomer(selectedCustomer); MainFinanceWindow.getViewManager().updateButtons(); showButtonBar(); callRPC(0, getPageSize()); }
private void creatControls() { StyledPanel mainPanel = new StyledPanel("customerCenter"); StyledPanel leftVpPanel = new StyledPanel("leftPanel"); viewTypeCombo(); DynamicForm viewform = new DynamicForm("viewform"); viewform.setStyleName("filterPanel"); viewform.add(activeInActiveSelect); leftVpPanel.add(viewform); custGrid = new CustomersListGrid(); custGrid.init(); initCustomersListGrid(); leftVpPanel.add(custGrid); custGrid.setStyleName("cusotmerCentrGrid"); rightVpPanel = new StyledPanel("rightPanel"); dummyPanel = new StyledPanel("dummyPanel"); detailsPanel = new CustomerDetailsPanel(selectedCustomer); rightVpPanel.add(detailsPanel); custGrid.setCustomerSelectionListener( new CustomerSelectionListener() { @Override public void cusotmerSelected() { OncusotmerSelected(); } }); transactionViewSelectCombo(); transactionViewTypeSelectCombo(); transactionDateRangeSelector(); DynamicForm transactionViewform = new DynamicForm("transactionViewform"); transactionViewform.add(trasactionViewSelect, trasactionViewTypeSelect, dateRangeSelector); transactionGridpanel = new StyledPanel("transactionGridpanel"); transactionGridpanel.add(transactionViewform); custHistoryGrid = new CustomerTransactionsHistoryGrid() { @Override public void initListData() { OncusotmerSelected(); } }; custHistoryGrid.init(); custHistoryGrid.addEmptyMessage(messages.pleaseSelectAnyPayee(Global.get().Customer())); int pageSize = getPageSize(); custHistoryGrid.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(custHistoryGrid); updateRecordsCount(0, 0, 0); if (Accounter.isIpadApp()) { transactionButton = new Button(messages.transaction()); transactionButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ActionFactory.getCustomerTransactionListHistory(selectedCustomer).run(); } }); } else { dummyPanel.add(transactionGridpanel); dummyPanel.add(custHistoryGrid); dummyPanel.add(pager); } rightVpPanel.add(dummyPanel); Label labelTitle = new Label(messages.customerCentre(Global.get().Customer())); labelTitle.setStyleName("label-title"); mainPanel.add(leftVpPanel); mainPanel.add(rightVpPanel); deleteButtonPanel = new StyledPanel("deleteButtonPanel"); add(labelTitle); add(deleteButtonPanel); add(mainPanel); }
public void updateRecordsCount(int start, int length, int total) { custHistoryGrid.updateRange(new Range(start, getPageSize())); custHistoryGrid.setRowCount(total, (start + length) == total); }