Search in sources :

Example 1 with Row_12

use of org.dominokit.domino.ui.grid.Row_12 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();
}
Also used : RequestKifuDeletionEvent(com.playshogi.website.gwt.client.events.kifu.RequestKifuDeletionEvent) ElementWidget(com.playshogi.website.gwt.client.util.ElementWidget) ListKifusEvent(com.playshogi.website.gwt.client.events.collections.ListKifusEvent) Arrays(java.util.Arrays) UsfFormat(com.playshogi.library.shogi.models.formats.usf.UsfFormat) GameCollectionDetails(com.playshogi.website.gwt.shared.models.GameCollectionDetails) Elements(org.jboss.elemento.Elements) ViewKifuPlace(com.playshogi.website.gwt.client.place.ViewKifuPlace) KifuService(com.playshogi.website.gwt.shared.services.KifuService) com.google.gwt.user.client.ui(com.google.gwt.user.client.ui) AppPlaceHistoryMapper(com.playshogi.website.gwt.client.mvp.AppPlaceHistoryMapper) EventBinder(com.google.web.bindery.event.shared.binder.EventBinder) HTMLElement(elemental2.dom.HTMLElement) TextHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.TextHeaderFilter) Row(org.dominokit.domino.ui.grid.Row) UserPreferences(com.playshogi.website.gwt.client.UserPreferences) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) List(java.util.List) Row_12(org.dominokit.domino.ui.grid.Row_12) KifuEditorPlace(com.playshogi.website.gwt.client.place.KifuEditorPlace) HtmlContentBuilder(org.jboss.elemento.HtmlContentBuilder) Button(org.dominokit.domino.ui.button.Button) Icons(org.dominokit.domino.ui.icons.Icons) ColumnConfig(org.dominokit.domino.ui.datatable.ColumnConfig) RecordsSorter(org.dominokit.domino.ui.datatable.store.RecordsSorter) ASC(org.dominokit.domino.ui.datatable.plugins.SortDirection.ASC) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) Column(org.dominokit.domino.ui.grid.Column) Elements.h(org.jboss.elemento.Elements.h) GWT(com.google.gwt.core.client.GWT) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) DataTable(org.dominokit.domino.ui.datatable.DataTable) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) SelectHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.SelectHeaderFilter) ProblemPlace(com.playshogi.website.gwt.client.place.ProblemPlace) Window(com.google.gwt.user.client.Window) EventHandler(com.google.web.bindery.event.shared.binder.EventHandler) KifuServiceAsync(com.playshogi.website.gwt.shared.services.KifuServiceAsync) SelectOption(org.dominokit.domino.ui.forms.SelectOption) TextNode(org.dominokit.domino.ui.utils.TextNode) ProblemCollectionDetails(com.playshogi.website.gwt.shared.models.ProblemCollectionDetails) org.dominokit.domino.ui.datatable.plugins(org.dominokit.domino.ui.datatable.plugins) Elements.br(org.jboss.elemento.Elements.br) EventBus(com.google.web.bindery.event.shared.EventBus) ListProblemCollectionsEvent(com.playshogi.website.gwt.client.events.collections.ListProblemCollectionsEvent) KifuDetails(com.playshogi.website.gwt.shared.models.KifuDetails) GamePreview(com.playshogi.website.gwt.client.widget.board.GamePreview) ListGameCollectionsEvent(com.playshogi.website.gwt.client.events.collections.ListGameCollectionsEvent) HTMLDivElement(elemental2.dom.HTMLDivElement) RequestAddKifuToCollectionEvent(com.playshogi.website.gwt.client.events.collections.RequestAddKifuToCollectionEvent) Comparator(java.util.Comparator) Row_12(org.dominokit.domino.ui.grid.Row_12) HTMLDivElement(elemental2.dom.HTMLDivElement) GamePreview(com.playshogi.website.gwt.client.widget.board.GamePreview)

Example 2 with Row_12

use of org.dominokit.domino.ui.grid.Row_12 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();
}
Also used : Row_12(org.dominokit.domino.ui.grid.Row_12) TagsElement(com.playshogi.website.gwt.client.widget.problems.TagsElement) HTMLDivElement(elemental2.dom.HTMLDivElement) GamePreview(com.playshogi.website.gwt.client.widget.board.GamePreview) LessonDetails(com.playshogi.website.gwt.shared.models.LessonDetails)

Example 3 with Row_12

use of org.dominokit.domino.ui.grid.Row_12 in project playshogi by Tellmarch.

the class ProblemCollectionsTable method getDetails.

private HTMLElement getDetails(final ProblemCollectionDetails 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())));
    if (canEdit) {
        rowElement.addColumn(Column.span4().appendChild(Button.createPrimary("Edit properties").addClickListener(evt -> problemCollectionProperties.showInPopup(details))));
        rowElement.addColumn(Column.span4().appendChild(Button.createDanger(Icons.ALL.delete_forever()).setContent("Delete collection").addClickListener(evt -> confirmCollectionDeletion(details))));
    }
    return rowElement.element();
}
Also used : Row_12(org.dominokit.domino.ui.grid.Row_12) TagsElement(com.playshogi.website.gwt.client.widget.problems.TagsElement)

Example 4 with Row_12

use of org.dominokit.domino.ui.grid.Row_12 in project domino-ui-demo by DominoKit.

the class MdiIconsViewImpl method addIconsByTag.

private void addIconsByTag(String tag) {
    Card card = Card.create(tag.isEmpty() ? "Untagged" : tag).setCollapsible();
    element.appendChild(card.element());
    List<Supplier<MdiIcon>> suppliers = MdiByTagFactory.get(tag);
    int rows = (suppliers.size() / 4) + ((suppliers.size() % 4) > 0 ? 1 : 0);
    for (int i = 0; i < rows; i++) {
        Row_12 row = Row.create().css("demo-icon-container");
        card.appendChild(row);
        for (int j = i * 4; j < (i * 4 + 4) && j < suppliers.size(); j++) {
            row.appendChild(Column.span3().appendChild(createMdiDemoIcon(suppliers.get(j).get())));
        }
    }
}
Also used : Row_12(org.dominokit.domino.ui.grid.Row_12) Supplier(java.util.function.Supplier) CodeCard(org.dominokit.domino.componentcase.client.ui.views.CodeCard) Card(org.dominokit.domino.ui.cards.Card)

Example 5 with Row_12

use of org.dominokit.domino.ui.grid.Row_12 in project playshogi by Tellmarch.

the class ProblemTable method getDetails.

private HTMLElement getDetails(final ProblemDetails 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("Moves: " + details.getNumMoves())).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) {
            BoardPreview boardPreview = new BoardPreview(UsfFormat.INSTANCE.readSingle(usf).getGameTree().getInitialPosition(), false, userPreferences, 0.5);
            previewDiv.add(boardPreview.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();
}
Also used : Row_12(org.dominokit.domino.ui.grid.Row_12) BoardPreview(com.playshogi.website.gwt.client.widget.board.BoardPreview) HTMLDivElement(elemental2.dom.HTMLDivElement)

Aggregations

Row_12 (org.dominokit.domino.ui.grid.Row_12)6 HTMLDivElement (elemental2.dom.HTMLDivElement)4 GamePreview (com.playshogi.website.gwt.client.widget.board.GamePreview)3 TagsElement (com.playshogi.website.gwt.client.widget.problems.TagsElement)2 GWT (com.google.gwt.core.client.GWT)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Window (com.google.gwt.user.client.Window)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 com.google.gwt.user.client.ui (com.google.gwt.user.client.ui)1 EventBus (com.google.web.bindery.event.shared.EventBus)1 EventBinder (com.google.web.bindery.event.shared.binder.EventBinder)1 EventHandler (com.google.web.bindery.event.shared.binder.EventHandler)1 UsfFormat (com.playshogi.library.shogi.models.formats.usf.UsfFormat)1 UserPreferences (com.playshogi.website.gwt.client.UserPreferences)1 ListGameCollectionsEvent (com.playshogi.website.gwt.client.events.collections.ListGameCollectionsEvent)1 ListKifusEvent (com.playshogi.website.gwt.client.events.collections.ListKifusEvent)1 ListProblemCollectionsEvent (com.playshogi.website.gwt.client.events.collections.ListProblemCollectionsEvent)1 RequestAddKifuToCollectionEvent (com.playshogi.website.gwt.client.events.collections.RequestAddKifuToCollectionEvent)1 RequestKifuDeletionEvent (com.playshogi.website.gwt.client.events.kifu.RequestKifuDeletionEvent)1 AppPlaceHistoryMapper (com.playshogi.website.gwt.client.mvp.AppPlaceHistoryMapper)1