@Override
 public void adjustDisplayForListOfSize(int size) {
   if (size > COMMENTS_PER_PAGE) {
     pager.setVisible(true);
   } else {
     pager.setVisible(false);
   }
 }
Beispiel #2
0
 @Override
 public void setTableSelection(TableDto tableDto, int index) {
   int pageIndex = index / table.getPageSize();
   if (pageIndex != pager.getPage()) {
     pager.setPage(pageIndex);
   }
   table.getSelectionModel().setSelected(tableDto, true);
 }
Beispiel #3
0
  public ValueMapGrid() {
    loading = new Image("image/loading.gif");
    add(loading);

    pager = new SimplePager(SimplePager.TextLocation.RIGHT);
    pager.setPageSize(DEFAULT_PAGE_SIZE);
    pager.addStyleName("pull-right");
    pager.setVisible(false);
    add(pager);
  }
  public void init(final ArtifactListPresenter presenter) {
    this.presenter = presenter;

    // Set the message to display when the table is empty.
    final Label emptyTable = new Label(M2RepoEditorConstants.INSTANCE.NoArtifactAvailable());
    emptyTable.setStyleName("");
    cellTable.setEmptyTableWidget(emptyTable);

    // Create a Pager to control the table.
    pager.setDisplay(cellTable);
    pager.setPageSize(PAGE_SIZE);

    initTableColumns();
  }
Beispiel #5
0
 @Override
 public void afterRenderRows() {
   dataProvider.refresh();
   boolean enableItem = table.getRowCount() > 0;
   pager.setVisible(table.getRowCount() > Table.DEFAULT_PAGESIZE);
   downloadDictionary.setEnabled(enableItem);
   exportData.setDisabled(!enableItem);
   copyData.setDisabled(!enableItem);
   table.hideLoadingIndicator();
 }
Beispiel #6
0
  private void initializeTable() {
    if (table != null) {
      remove(table);
      table = null;
    }

    table = new Table<ValueMapEntry>(pager.getPageSize());
    // not supposed to be empty except while being populated
    table.setEmptyTableWidget(table.getLoadingIndicator());
    table.addStyleName("small-top-margin");
    table.addStyleName("pull-left");
    table.setPageSize(pageSize);
    table.setWidth("100%");
    add(table);
    pager.setPageSize(pageSize);
    pager.setDisplay(table);

    initializeColumns();
  }
  @Override
  public void init(ProcessDefinitionListPresenter presenter) {
    this.presenter = presenter;

    listContainer.add(processdefListGrid);
    listContainer.add(pager);

    processdefListGrid.setHeight("350px");

    // Set the message to display when the table is empty.
    processdefListGrid.setEmptyTableWidget(new Label(constants.No_Process_Definitions_Available()));

    // Attach a column sort handler to the ListDataProvider to sort the list.
    sortHandler = new ListHandler<ProcessSummary>(presenter.getDataProvider().getList());
    processdefListGrid.addColumnSortHandler(sortHandler);

    // Create a Pager to control the table.

    pager.setDisplay(processdefListGrid);
    pager.setPageSize(10);

    // Add a selection model so we can select cells.
    final MultiSelectionModel<ProcessSummary> selectionModel =
        new MultiSelectionModel<ProcessSummary>();
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            selectedProcessDef = selectionModel.getSelectedSet();
            for (ProcessSummary pd : selectedProcessDef) {
              processSelection.fire(new ProcessDefSelectionEvent(pd.getId()));
            }
          }
        });

    processdefListGrid.setSelectionModel(
        selectionModel, DefaultSelectionEventManager.<ProcessSummary>createCheckboxManager());

    initTableColumns(selectionModel);

    presenter.addDataDisplay(processdefListGrid);
  }
  @Override
  public void init(TaskCommentsPresenter presenter) {
    this.presenter = presenter;
    listContainer.add(commentsListGrid);
    listContainer.add(pager);
    commentsAccordionLabel.add(new HTMLPanel(constants.Add_Comment()));
    commentsListGrid.setHeight("350px");
    commentsListGrid.setEmptyTableWidget(new HTMLPanel(constants.No_Comments_For_This_Task()));
    // Attach a column sort handler to the ListDataProvider to sort the list.
    sortHandler = new ListHandler<CommentSummary>(presenter.getDataProvider().getList());
    commentsListGrid.addColumnSortHandler(sortHandler);
    initTableColumns();
    presenter.addDataDisplay(commentsListGrid);
    // Create a Pager to control the table.
    pager.setDisplay(commentsListGrid);
    pager.setPageSize(COMMENTS_PER_PAGE);
    adjustDisplayForListOfSize(1);

    newTaskCommentTextArea.setWidth("300px");
    addCommentButton.setText(constants.Add_Comment());
    newTaskCommentLabel.setText(constants.Comment());
  }
Beispiel #9
0
  @SuppressWarnings("ParameterHidesMemberVariable")
  public void populate(List<ValueMapEntry> valueMapEntries, @Nullable List<String> valueChoices) {
    this.valueMapEntries = valueMapEntries;
    this.valueChoices = valueChoices;
    //noinspection ConstantConditions
    if (hasValueChoices() && !valueChoices.contains("")) {
      valueChoices.add(0, "");
    }

    if (dataProvider == null) {
      initializeTable();
      dataProvider = new ListDataProvider<ValueMapEntry>(valueMapEntries);
      dataProvider.addDataDisplay(table);
    } else {
      dataProvider.setList(valueMapEntries);
    }
    pager.setVisible(valueMapEntries.size() > pager.getPageSize());
    dataProvider.refresh();

    // remove loading
    remove(loading);
    // addStyleName("value-map");
  }
Beispiel #10
0
 @Override
 public void renderRows(JsArray<TableDto> rows) {
   dataProvider.setList(JsArrays.toList(JsArrays.toSafeArray(rows)));
   pager.firstPage();
 }
Beispiel #11
0
 @Override
 public void beforeRenderRows() {
   pager.setVisible(false);
   table.showLoadingIndicator(dataProvider);
 }
Beispiel #12
0
  private void addTableColumns() {

    table.addColumn(
        new Column<TableDto, TableDto>(
            new PlaceRequestCell<TableDto>(placeManager) {

              @Override
              public PlaceRequest getPlaceRequest(TableDto value) {
                return ProjectPlacesHelper.getTablePlace(
                    value.getDatasourceName(), value.getName());
              }

              @Override
              public String getText(TableDto value) {
                String name = value.getName();
                return value.hasViewLink()
                    ? "<i class=\"icon-cog\"></i>&nbsp;" + name
                    : "<i class=\"icon-table\"></i>&nbsp;" + name;
              }
            }) {
          @Override
          public TableDto getValue(TableDto object) {
            return object;
          }
        },
        translations.nameLabel());

    table.addColumn(
        new TextColumn<TableDto>() {

          @Override
          public String getValue(TableDto object) {
            return object.getEntityType();
          }
        },
        translations.entityTypeColumnLabel());

    table.addColumn(
        new TextColumn<TableDto>() {

          @Override
          public String getValue(TableDto object) {
            return Integer.toString(object.getVariableCount());
          }
        },
        translations.variablesLabel());

    table.addColumn(
        new TextColumn<TableDto>() {

          @Override
          public String getValue(TableDto object) {
            return Integer.toString(object.getValueSetCount());
          }
        },
        translations.entitiesLabel());

    dataProvider.addDataDisplay(table);
    table.setSelectionModel(new SingleSelectionModel<TableDto>());
    table.setPageSize(Table.DEFAULT_PAGESIZE);
    table.setEmptyTableWidget(new InlineLabel(translations.noTablesLabel()));
    pager.setDisplay(table);
  }