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); }
private void initializeFrequencyColumn() { if (allowFrequencyColumn) { if (frequencyColumn == null) { frequencyColumn = new ValueMapColumn(new StatCell()); } table.insertColumn(1, frequencyColumn, translations.frequency()); } }
public void enableFrequencyColumn(boolean enable) { if (allowFrequencyColumn == enable) return; allowFrequencyColumn = enable; if (!allowFrequencyColumn) { table.removeColumn(frequencyColumn); } else if (table != null) { initializeFrequencyColumn(); } }
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); } }); }
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()); }
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()); }
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); } }); }
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(); }
private void initializeDeleteColumn() { if (allowRowDeletion) { ActionsColumn<ValueMapEntry> deleteColumn = createDeletionColumn(); table.addColumn(deleteColumn, translations.actionsLabel()); } }
private void refresh() { table.setRowCount(valueMapEntries.size()); dataProvider.refresh(); }