use of com.playshogi.website.gwt.client.widget.board.GamePreview 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.client.widget.board.GamePreview in project playshogi by Tellmarch.
the class LessonsTable method getDetails.
private HTMLElement getDetails(final LessonDetails details) {
Row<Row_12> rowElement = Row.create();
rowElement.style().setMarginLeft("40px").setMarginRight("40px").setMarginTop("10px").setMarginBottom("10px");
rowElement.addColumn(Column.span4().appendChild(new TagsElement(details.getTags()).asElement()).appendChild(h(5).add("Description:")).appendChild(TextNode.of(details.getDescription())));
rowElement.addColumn(Column.span4().appendChild(Button.createPrimary("Edit properties").addClickListener(evt -> lessonPropertiesForm.showInPopup(details))).appendChild(Elements.br()).appendChild(Button.createPrimary("Add child").addClickListener(evt -> {
LessonDetails child = new LessonDetails();
child.setParentLessonId(details.getLessonId());
child.setTags(details.getTags());
lessonPropertiesForm.showInPopup(child);
}).style().setMarginTop("1em")));
if (details.getKifuId() != null) {
HtmlContentBuilder<HTMLDivElement> previewDiv = Elements.div();
kifuService.getKifuUsf(null, details.getKifuId(), new AsyncCallback<String>() {
@Override
public void onFailure(final Throwable throwable) {
}
@Override
public void onSuccess(final String usf) {
GamePreview gamePreview = new GamePreview(sessionInformation.getUserPreferences(), UsfFormat.INSTANCE.readSingle(usf), 0.5);
previewDiv.add(gamePreview.asElement());
previewDiv.add(Button.createPrimary("Set as preview").addClickListener(evt -> {
details.setPreviewSfen(SfenConverter.toSFEN(gamePreview.getCurrentPosition()));
lessonPropertiesForm.showInPopup(details);
}).style().setMarginTop("1em"));
}
});
rowElement.addColumn(Column.span4().appendChild(previewDiv));
} else {
rowElement.addColumn(Column.span4());
}
// .addClickListener(evt -> confirmLessonDeletion(details))));
return rowElement.element();
}
use of com.playshogi.website.gwt.client.widget.board.GamePreview in project playshogi by Tellmarch.
the class GameTable method getDetails.
private HTMLElement getDetails(final GameDetails 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("Black: " + details.getSente())).appendChild(br()).appendChild(TextNode.of("White: " + details.getGote())).appendChild(br()).appendChild(TextNode.of("Venue: " + details.getVenue())).appendChild(br()).appendChild(TextNode.of("Date: " + details.getDate())).appendChild(br()));
HtmlContentBuilder<HTMLDivElement> previewDiv = Elements.div();
kifuService.getKifuUsf(null, details.getKifuId(), 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));
if (withEditOptions || isAuthor) {
rowElement.addColumn(Column.span4().appendChild(Button.createDanger(Icons.ALL.delete_forever()).setContent("Remove from collection").addClickListener(evt -> confirmDeletion(details)).style().setMarginRight("20px")));
}
return rowElement.element();
}
Aggregations