@Override
  public void addButtons(ButtonGroup group) {

    ImageButton addCustomerButton = null;
    if (Accounter.isIpadApp()) {
      addCustomerButton = new ImageButton(Accounter.getFinanceImages().ipadAdd(), "add");
    } else {
      addCustomerButton =
          new ImageButton(
              messages.addNew(Global.get().Customer()),
              Accounter.getFinanceImages().portletPageSettings(),
              "add");
    }

    addCustomerButton.addStyleName("settingsButton");
    addCustomerButton.getElement().setId("addCustomerButton");
    addCustomerButton.addClickHandler(
        new ClickHandler() {

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

    addCustomerButton.getElement().setAttribute("data-icon", "add");
    addButton(group, addCustomerButton);
  }
  private void onItemSelected() {

    itemDetailsPanel.showItemDetails(selectedItem);
    if (Accounter.isIpadApp()) {
      rightVpPanel.add(transactionButton);
      transactionButton.setText(messages2.transactionListFor(selectedItem.getDisplayName()));
    }
    transactionHistoryGrid.setSelectedItem(selectedItem);
    MainFinanceWindow.getViewManager().updateButtons();
    callRPC(0, 25);
  }
  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);
  }
  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);
  }