Beispiel #1
0
  public DeviceDiskViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    for (String pageSize : DevicePageSize.getPageSizeList()) {
      pageSizeList.addItem(pageSize);
    }
    pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex());
    pageSizeList.addChangeHandler(
        new ChangeHandler() {

          @Override
          public void onChange(ChangeEvent event) {
            DevicePageSize.setPageSizeSelectedIndex(pageSizeList.getSelectedIndex());
            if (table != null) {
              table.setPageSize(DevicePageSize.getPageSize());
            }
          }
        });

    selection = new MultiSelectionModel<SearchResultRow>(SearchResultRow.KEY_PROVIDER);
    selection.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            updateSearchResultButtonStatus();
            presenter.onSelectionChange(selection.getSelectedSet());
          }
        });
    updateSearchResultButtonStatus();

    popup.setAutoHideEnabled(true);
  }
Beispiel #2
0
  @Override
  public void showSearchResult(SearchResult result) {
    if (table == null) {
      table = new DeviceSearchResultTable(result.getDescs(), selection);
      table.setRangeChangeHandler(presenter);
      table.setClickHandler(presenter);
      table.load();
      resultPanel.add(table);
      final DeviceColumnPopupPanel panel =
          new DeviceColumnPopupPanel(
              new DeviceColumnPopupPanel.Presenter() {

                @Override
                public void onValueChange(int column, boolean value) {
                  if (table != null) {
                    table.setVisible(column, value);
                  }
                }
              });
      columnButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              panel.popup(columnButton);
            }
          });
      initColumnPanel(result.getDescs(), panel);
    }
    table.setData(result);
    if (table.getPageSize() != DevicePageSize.getPageSize()) {
      table.setPageSize(DevicePageSize.getPageSize());
      pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex());
    }
  }