Exemplo n.º 1
0
  private void initTable(
      final AbstractCellTable<TableTestPojo> grid,
      final SimplePager pager,
      final Pagination pagination,
      final ListDataProvider<TableTestPojo> dataProvider) {
    final TextColumn<TableTestPojo> col1 =
        new TextColumn<TableTestPojo>() {

          @Override
          public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
          }
        };
    grid.addColumn(col1, "Field 1");

    final TextColumn<TableTestPojo> col2 =
        new TextColumn<TableTestPojo>() {

          @Override
          public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
          }
        };
    grid.addColumn(col2, "Field 2");

    final TextColumn<TableTestPojo> col3 =
        new TextColumn<TableTestPojo>() {

          @Override
          public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
          }
        };
    grid.addColumn(col3, "Field 3");

    grid.addRangeChangeHandler(
        new RangeChangeEvent.Handler() {

          @Override
          public void onRangeChange(final RangeChangeEvent event) {
            pagination.rebuild(pager);
          }
        });

    pager.setDisplay(grid);
    pagination.clear();
    dataProvider.addDataDisplay(grid);
  }
Exemplo n.º 2
0
 private void initializeFrequencyColumn() {
   if (allowFrequencyColumn) {
     if (frequencyColumn == null) {
       frequencyColumn = new ValueMapColumn(new StatCell());
     }
     table.insertColumn(1, frequencyColumn, translations.frequency());
   }
 }
Exemplo n.º 3
0
 public void enableFrequencyColumn(boolean enable) {
   if (allowFrequencyColumn == enable) return;
   allowFrequencyColumn = enable;
   if (!allowFrequencyColumn) {
     table.removeColumn(frequencyColumn);
   } else if (table != null) {
     initializeFrequencyColumn();
   }
 }
Exemplo n.º 4
0
  private void initializeNewValueColumn() {

    // New Value
    Cell<String> cell = hasValueChoices() ? new SelectionCell(valueChoices) : new TextInputCell();
    Column<ValueMapEntry, String> newValueColumn =
        new Column<ValueMapEntry, String>(cell) {
          @Override
          public String getValue(ValueMapEntry entry) {
            return entry.getNewValue();
          }
        };
    newValueColumn.setCellStyleNames("new-value");
    table.addColumn(newValueColumn, translations.newValueLabel());
    table.setColumnWidth(newValueColumn, "10em");
    newValueColumn.setFieldUpdater(
        new FieldUpdater<ValueMapEntry, String>() {
          @Override
          public void update(int index, ValueMapEntry entry, String value) {
            entry.setNewValue(value);
          }
        });
  }
Exemplo n.º 5
0
  private void initializeLabelColumn() {

    ValueMapCell cell =
        new ValueMapCell() {

          @Override
          protected String getText(ValueMapEntry entry) {
            return entry.getLabel();
          }
        };

    Column<ValueMapEntry, ValueMapEntry> labelColumn = new ValueMapColumn(cell);
    labelColumn.setCellStyleNames("original-label");
    table.addColumn(labelColumn, translations.originalLabelLabel());
  }
Exemplo n.º 6
0
  protected void initializeValueColumn() {

    ValueMapCell cell =
        new ValueMapCell() {

          @Override
          protected String getText(ValueMapEntry entry) {
            return entry.getValue();
          }
        };

    Column<ValueMapEntry, ValueMapEntry> valueColumn = new ValueMapColumn(cell);
    valueColumn.setCellStyleNames("original-value");
    table.addColumn(valueColumn, translations.originalValueLabel());
  }
Exemplo n.º 7
0
  private void initializeMissingColumn() {
    // Missing
    Column<ValueMapEntry, Boolean> missingColumn =
        new Column<ValueMapEntry, Boolean>(new CheckboxCell()) {

          @Override
          public Boolean getValue(ValueMapEntry entry) {
            return entry.isMissing();
          }
        };
    missingColumn.setCellStyleNames("new-missing");
    table.addColumn(missingColumn, translations.missingLabel());
    missingColumn.setFieldUpdater(
        new FieldUpdater<ValueMapEntry, Boolean>() {
          @Override
          public void update(int index, ValueMapEntry entry, Boolean value) {
            entry.setMissing(value);
          }
        });
  }
Exemplo n.º 8
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();
  }
Exemplo n.º 9
0
 private void initializeDeleteColumn() {
   if (allowRowDeletion) {
     ActionsColumn<ValueMapEntry> deleteColumn = createDeletionColumn();
     table.addColumn(deleteColumn, translations.actionsLabel());
   }
 }
Exemplo n.º 10
0
 private void refresh() {
   table.setRowCount(valueMapEntries.size());
   dataProvider.refresh();
 }