private void refreshActiveinActiveList(boolean isActivelist) {
   custGrid.setSelectedCustomer(null);
   // detailsPanel.custname.setText(messages.noPayeeSelected(Global.get()
   // .Customer()));
   this.selectedCustomer = null;
   OncusotmerSelected();
   isActiveAccounts = isActivelist;
   initCustomersListGrid();
 }
  @Override
  public void restoreView(HashMap<String, Object> map) {
    if (map == null || map.isEmpty()) {
      return;
    }
    String activeInactive = (String) map.get("activeInActive");
    activeInActiveSelect.setComboItem(activeInactive);
    if (activeInactive.equalsIgnoreCase(messages.active())) {
      refreshActiveinActiveList(true);
    } else {
      refreshActiveinActiveList(false);
    }

    String currentView = (String) map.get("currentView");
    trasactionViewSelect.setComboItem(currentView);
    if (currentView != null) {
      getMessagesList();
    }

    String transctionType = (String) map.get("transactionType");
    trasactionViewTypeSelect.setComboItem(transctionType);

    String dateRange1 = (String) map.get("dateRange");
    dateRangeSelector.setComboItem(dateRange1);
    if (dateRange1 != null) {
      dateRangeChanged(dateRange1);
    }
    PayeeList object = (PayeeList) map.get("payeeSelection");
    custGrid.setSelection(object);

    String customer = (String) map.get("selectedCustomer");

    if (customer != null && !(customer.isEmpty())) {
      selectedCustomer = getCompany().getCustomerByName(customer);
    }
    if (this.selectedCustomer != null) {
      custGrid.setSelectedCustomer(selectedCustomer);
      OncusotmerSelected();
    } else {
      callRPC(0, getPageSize());
    }
  }
 @Override
 public HashMap<String, Object> saveView() {
   HashMap<String, Object> map = new HashMap<String, Object>();
   map.put("activeInActive", activeInActiveSelect.getSelectedValue());
   map.put("currentView", trasactionViewSelect.getSelectedValue());
   map.put("transactionType", trasactionViewTypeSelect.getSelectedValue());
   map.put("dateRange", dateRangeSelector.getSelectedValue());
   map.put("selectedCustomer", selectedCustomer == null ? "" : selectedCustomer.getName());
   PayeeList selection = custGrid.getSelection();
   map.put("payeeSelection", selection);
   return map;
 }
  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);
  }