Пример #1
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();
  }
Пример #2
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");
  }