@Override protected void doCellTable() { ProvidesKey<JarListPageRow> providesKey = new ProvidesKey<JarListPageRow>() { public Object getKey(JarListPageRow row) { return row.getPath(); } }; cellTable = new CellTable<JarListPageRow>(providesKey); selectionModel = new MultiSelectionModel<JarListPageRow>(providesKey); cellTable.setSelectionModel(selectionModel); selectionColumn = SelectionColumn.createAndAddSelectionColumn(cellTable); columnPicker = new ColumnPicker<JarListPageRow>(cellTable); SortableHeaderGroup<JarListPageRow> sortableHeaderGroup = new SortableHeaderGroup<JarListPageRow>(cellTable); // Add any additional columns addAncillaryColumns(columnPicker, sortableHeaderGroup); cellTable.setWidth("100%"); columnPickerButton = columnPicker.createToggleButton(); }
public void addColumn(Column<JarListPageRow, String> column, TextHeader textHeader) { columnPicker.addColumn(column, textHeader, true); }
@Override protected void addAncillaryColumns( ColumnPicker<JarListPageRow> columnPicker, SortableHeaderGroup<JarListPageRow> sortableHeaderGroup) { TextColumn<JarListPageRow> nameColumn = new TextColumn<JarListPageRow>() { public String getValue(JarListPageRow row) { return row.getName(); } }; columnPicker.addColumn( nameColumn, new SortableHeader<JarListPageRow, String>(sortableHeaderGroup, "Name", nameColumn), true); TextColumn<JarListPageRow> pathColumn = new TextColumn<JarListPageRow>() { public String getValue(JarListPageRow row) { return row.getPath(); } }; columnPicker.addColumn( pathColumn, new SortableHeader<JarListPageRow, String>(sortableHeaderGroup, "Path", pathColumn), true); Column<JarListPageRow, Date> lastModifiedColumn = new Column<JarListPageRow, Date>( new DateCell( DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) { public Date getValue(JarListPageRow row) { return row.getLastModified(); } }; columnPicker.addColumn( lastModifiedColumn, new SortableHeader<JarListPageRow, Date>( sortableHeaderGroup, "LastModified", lastModifiedColumn), true); // Add "View kjar detail" button column Column<JarListPageRow, String> openColumn = new Column<JarListPageRow, String>(new ButtonCell()) { public String getValue(JarListPageRow row) { return "Open"; } }; openColumn.setFieldUpdater( new FieldUpdater<JarListPageRow, String>() { public void update(int index, JarListPageRow row, String value) { m2RepoService .call( new RemoteCallback<String>() { @Override public void callback(final String response) { JarDetailEditor editor = new JarDetailEditor(response); editor.setSize("800px", "600px"); editor.show(); } }) .loadPOMStringFromJar(row.getPath()); } }); columnPicker.addColumn(openColumn, new TextHeader("View Artifact Detail"), true); }