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);
  }
Example #2
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());
  }
Example #3
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());
  }
Example #4
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);
          }
        });
  }
Example #5
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);
          }
        });
  }
Example #6
0
 private void initializeDeleteColumn() {
   if (allowRowDeletion) {
     ActionsColumn<ValueMapEntry> deleteColumn = createDeletionColumn();
     table.addColumn(deleteColumn, translations.actionsLabel());
   }
 }