use of com.playshogi.website.gwt.client.place.KifuEditorPlace 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 com.playshogi.website.gwt.client.place.KifuEditorPlace in project playshogi by Tellmarch.
the class ProblemTable method getTableConfig.
private TableConfig<ProblemDetails> getTableConfig(final AppPlaceHistoryMapper historyMapper) {
TableConfig<ProblemDetails> tableConfig = new TableConfig<>();
tableConfig.addColumn(ColumnConfig.<ProblemDetails>create("id", "#").styleCell(element -> element.style.setProperty("vertical-align", "top")).textAlign("right").asHeader().setCellRenderer(cell -> TextNode.of(String.valueOf(cell.getRecord().getIndexInCollection())))).addColumn(ColumnConfig.<ProblemDetails>create("updown", "Order").setCellRenderer(cell -> getUpDownIcons(cell.getRecord()))).addColumn(ColumnConfig.<ProblemDetails>create("nummoves", "Number of Moves").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> TextNode.of(String.valueOf(cell.getRecord().getNumMoves())))).addColumn(ColumnConfig.<ProblemDetails>create("tags", "Tags").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> {
HtmlContentBuilder<HTMLElement> span = Elements.span();
String[] tags = cell.getRecord().getTags();
if (tags != null) {
for (String tag : tags) {
span.add(Badge.create(tag).setBackground(ColorScheme.GREEN.color()).style().setMarginRight("1em").element());
}
}
return span.element();
})).addColumn(ColumnConfig.<ProblemDetails>create("view", "View").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> {
String href = "#" + historyMapper.getToken(new ProblemPlace(cell.getRecord().getKifuId()));
return Elements.a(href).add(Button.createPrimary(Icons.ALL.play_circle_filled()).setContent("Show")).element();
})).addColumn(ColumnConfig.<ProblemDetails>create("edit", "Edit").styleCell(element -> element.style.setProperty("vertical-align", "top")).setCellRenderer(cell -> {
String href = "#" + historyMapper.getToken(new KifuEditorPlace(cell.getRecord().getKifuId(), KifuDetails.KifuType.PROBLEM, collectionDetails.getId()));
return Elements.a(href).add(Button.createPrimary(Icons.ALL.edit()).setContent("Edit")).element();
}));
return tableConfig;
}
Aggregations