use of org.dominokit.domino.ui.datatable.ColumnConfig in project playshogi by Tellmarch.
the class KifuTable method getTableConfig.
private TableConfig<KifuDetails> getTableConfig(final AppPlaceHistoryMapper historyMapper) {
TableConfig<KifuDetails> tableConfig = new TableConfig<>();
tableConfig.addColumn(ColumnConfig.<KifuDetails>create("id", "#").styleCell(element -> element.style.setProperty("vertical-align", "top")).textAlign("right").asHeader().setCellRenderer(cell -> TextNode.of(String.valueOf(cell.getTableRow().getIndex() + 1 + PAGE_SIZE * (paginationPlugin.getPagination().activePage() - 1))))).addColumn(ColumnConfig.<KifuDetails>create("name", "Name").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(cell.getRecord().getName())).setSortable(true)).addColumn(ColumnConfig.<KifuDetails>create("type", "Type").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(String.valueOf(cell.getRecord().getType()))).setSortable(true)).addColumn(ColumnConfig.<KifuDetails>create("lastModified", "Last Modified").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(String.valueOf(cell.getRecord().getUpdateDate()))).setSortable(true)).addColumn(ColumnConfig.<KifuDetails>create("view", "View").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> {
String href = cell.getRecord().getType() != KifuDetails.KifuType.PROBLEM ? "#" + historyMapper.getToken(new ViewKifuPlace(cell.getRecord().getId(), 0)) : "#" + historyMapper.getToken(new ProblemPlace(cell.getRecord().getId()));
return Elements.a(href).add(Button.createPrimary("View")).element();
})).addColumn(ColumnConfig.<KifuDetails>create("edit", "Edit").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> {
String href = "#" + historyMapper.getToken(new KifuEditorPlace(cell.getRecord().getId(), cell.getRecord().getType(), null));
return Elements.a(href).add(Button.createPrimary(Icons.ALL.edit()).setContent("Edit")).element();
}));
return tableConfig;
}
use of org.dominokit.domino.ui.datatable.ColumnConfig in project playshogi by Tellmarch.
the class GameTable method getTableConfig.
private TableConfig<GameDetails> getTableConfig(final AppPlaceHistoryMapper historyMapper) {
TableConfig<GameDetails> tableConfig = new TableConfig<>();
tableConfig.addColumn(ColumnConfig.<GameDetails>create("id", "#").styleCell(element -> element.style.setProperty("vertical-align", "top")).textAlign("right").asHeader().setCellRenderer(cell -> TextNode.of(String.valueOf(cell.getTableRow().getIndex() + 1 + PAGE_SIZE * (simplePaginationPlugin.getSimplePagination().activePage() - 1))))).addColumn(// TODO show winner
ColumnConfig.<GameDetails>create("sente", "Sente").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(cell.getRecord().getSente())).setSortable(true)).addColumn(ColumnConfig.<GameDetails>create("gote", "Gote").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(cell.getRecord().getGote())).setSortable(true)).addColumn(ColumnConfig.<GameDetails>create("date", "Date").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(cell.getRecord().getDate())).setSortable(true)).addColumn(ColumnConfig.<GameDetails>create("venue", "Venue").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(cell.getRecord().getVenue())).setSortable(true)).addColumn(ColumnConfig.<GameDetails>create("view", "View").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> {
String href = "#" + historyMapper.getToken(new ViewKifuPlace(cell.getRecord().getKifuId(), 0));
return Elements.a(href).add(Button.createPrimary("Show")).element();
}));
return tableConfig;
}
use of org.dominokit.domino.ui.datatable.ColumnConfig in project nalu-examples by NaluKit.
the class ListComponent method render.
@Override
public void render() {
TableConfig<Person> tableConfig = new TableConfig<>();
tableConfig.addColumn(ColumnConfig.<Person>create("name", "Name").setCellRenderer(cell -> a().textContent(cell.getTableRow().getRecord().getName() + ", " + cell.getTableRow().getRecord().getFirstName()).on(EventType.click, e -> getController().doUpdate(cell.getTableRow().getRecord())).element())).addColumn(ColumnConfig.<Person>create("street", "Street").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getStreet()))).addColumn(ColumnConfig.<Person>create("zip", "ZIP").textAlign("right").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getZip()))).addColumn(ColumnConfig.<Person>create("street", "Street").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getStreet()))).addColumn(ColumnConfig.<Person>create("city", "City").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getCity())));
this.store = new LocalListDataStore<>();
this.table = new DataTable<>(tableConfig, store);
initElement(Card.create("SEARCH RESULTS").appendChild(Row.create().appendChild(Column.span12().appendChild(this.table))).element());
}
use of org.dominokit.domino.ui.datatable.ColumnConfig in project nalu-examples by NaluKit.
the class ListComponent method render.
@Override
public void render() {
TableConfig<Person> tableConfig = new TableConfig<>();
tableConfig.addColumn(ColumnConfig.<Person>create("name", "Name").setCellRenderer(cell -> a().textContent(cell.getTableRow().getRecord().getName() + ", " + cell.getTableRow().getRecord().getFirstName()).on(EventType.click, e -> getController().doUpdate(cell.getTableRow().getRecord())).element())).addColumn(ColumnConfig.<Person>create("street", "Street").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getStreet()))).addColumn(ColumnConfig.<Person>create("zip", "ZIP").textAlign("right").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getZip()))).addColumn(ColumnConfig.<Person>create("street", "Street").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getStreet()))).addColumn(ColumnConfig.<Person>create("city", "City").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getCity())));
this.store = new LocalListDataStore<>();
this.table = new DataTable<>(tableConfig, store);
initElement(Card.create("SEARCH RESULTS").appendChild(Row.create().appendChild(Column.span12().appendChild(this.table))).element());
}
use of org.dominokit.domino.ui.datatable.ColumnConfig in project nalu-examples by NaluKit.
the class ListComponent method render.
@Override
public void render() {
TableConfig<Person> tableConfig = new TableConfig<>();
tableConfig.addColumn(ColumnConfig.<Person>create("name", "Name").setCellRenderer(cell -> a().textContent(cell.getTableRow().getRecord().getName() + ", " + cell.getTableRow().getRecord().getFirstName()).on(EventType.click, e -> getController().doUpdate(cell.getTableRow().getRecord())).asElement())).addColumn(ColumnConfig.<Person>create("street", "Street").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getStreet()))).addColumn(ColumnConfig.<Person>create("zip", "ZIP").textAlign("right").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getZip()))).addColumn(ColumnConfig.<Person>create("street", "Street").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getStreet()))).addColumn(ColumnConfig.<Person>create("city", "City").setCellRenderer(cell -> new Text(cell.getTableRow().getRecord().getAddress().getCity())));
this.store = new LocalListDataStore<>();
this.table = new DataTable<>(tableConfig, store);
initElement(Card.create("SEARCH RESULTS").appendChild(Row.create().appendChild(Column.span12().appendChild(this.table))).asElement());
}
Aggregations