use of com.playshogi.website.gwt.shared.models.KifuDetails in project playshogi by Tellmarch.
the class KifuTable method getDetails.
private HTMLElement getDetails(final KifuDetails details) {
Row<Row_12> rowElement = Row.create();
rowElement.style().setMarginLeft("40px").setMarginRight("40px").setMarginTop("10px").setMarginBottom("10px");
rowElement.addColumn(Column.span4().appendChild(h(5).add("Description:")).appendChild(TextNode.of("Name: " + details.getName())).appendChild(br()));
HtmlContentBuilder<HTMLDivElement> previewDiv = Elements.div();
kifuService.getKifuUsf(null, details.getId(), new AsyncCallback<String>() {
@Override
public void onFailure(final Throwable throwable) {
}
@Override
public void onSuccess(final String usf) {
GamePreview gamePreview = new GamePreview(userPreferences, UsfFormat.INSTANCE.readSingle(usf), 0.5);
previewDiv.add(gamePreview.asElement());
}
});
rowElement.addColumn(Column.span4().appendChild(previewDiv));
rowElement.addColumn(Column.span4().appendChild(Button.createDanger(Icons.ALL.delete_forever()).setContent("Delete").addClickListener(evt -> confirmDeletion(details)).style().setMarginRight("20px")).appendChild(Button.createPrimary(Icons.ALL.playlist_add()).setContent("Add to collection").addClickListener(evt -> addKifuToCollection(details)).style().setMarginRight("20px")));
return rowElement.element();
}
use of com.playshogi.website.gwt.shared.models.KifuDetails 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.shared.models.KifuDetails in project playshogi by Tellmarch.
the class LessonPropertiesForm method onListKifusEvent.
@EventHandler
public void onListKifusEvent(final ListKifusEvent event) {
GWT.log("LessonPropertiesForm: handle ListKifusEvent");
kifuId.removeAllOptions();
kifuId.appendChild(SelectOption.create("", " - None - "));
for (KifuDetails details : event.getKifus()) {
kifuId.appendChild(SelectOption.create(details.getId(), details.getName()));
}
}
Aggregations