Search in sources :

Example 1 with ColumnConfig

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;
}
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) KifuEditorPlace(com.playshogi.website.gwt.client.place.KifuEditorPlace) ViewKifuPlace(com.playshogi.website.gwt.client.place.ViewKifuPlace) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) KifuDetails(com.playshogi.website.gwt.shared.models.KifuDetails) ProblemPlace(com.playshogi.website.gwt.client.place.ProblemPlace)

Example 2 with ColumnConfig

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;
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) ElementWidget(com.playshogi.website.gwt.client.util.ElementWidget) ColumnConfig(org.dominokit.domino.ui.datatable.ColumnConfig) RecordsSorter(org.dominokit.domino.ui.datatable.store.RecordsSorter) ASC(org.dominokit.domino.ui.datatable.plugins.SortDirection.ASC) UsfFormat(com.playshogi.library.shogi.models.formats.usf.UsfFormat) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) Elements(org.jboss.elemento.Elements) Column(org.dominokit.domino.ui.grid.Column) ViewKifuPlace(com.playshogi.website.gwt.client.place.ViewKifuPlace) KifuService(com.playshogi.website.gwt.shared.services.KifuService) Elements.h(org.jboss.elemento.Elements.h) GWT(com.google.gwt.core.client.GWT) AppPlaceHistoryMapper(com.playshogi.website.gwt.client.mvp.AppPlaceHistoryMapper) DataTable(org.dominokit.domino.ui.datatable.DataTable) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) HTMLElement(elemental2.dom.HTMLElement) Row(org.dominokit.domino.ui.grid.Row) Window(com.google.gwt.user.client.Window) KifuServiceAsync(com.playshogi.website.gwt.shared.services.KifuServiceAsync) SimplePaginationPlugin(org.dominokit.domino.ui.datatable.plugins.SimplePaginationPlugin) TextNode(org.dominokit.domino.ui.utils.TextNode) UserPreferences(com.playshogi.website.gwt.client.UserPreferences) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Elements.br(org.jboss.elemento.Elements.br) RemoveGameFromCollectionEvent(com.playshogi.website.gwt.client.events.collections.RemoveGameFromCollectionEvent) EventBus(com.google.web.bindery.event.shared.EventBus) RecordDetailsPlugin(org.dominokit.domino.ui.datatable.plugins.RecordDetailsPlugin) GamePreview(com.playshogi.website.gwt.client.widget.board.GamePreview) GameDetails(com.playshogi.website.gwt.shared.models.GameDetails) SortPlugin(org.dominokit.domino.ui.datatable.plugins.SortPlugin) Widget(com.google.gwt.user.client.ui.Widget) List(java.util.List) HTMLDivElement(elemental2.dom.HTMLDivElement) Row_12(org.dominokit.domino.ui.grid.Row_12) HtmlContentBuilder(org.jboss.elemento.HtmlContentBuilder) Comparator(java.util.Comparator) Button(org.dominokit.domino.ui.button.Button) ViewKifuPlace(com.playshogi.website.gwt.client.place.ViewKifuPlace) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) GameDetails(com.playshogi.website.gwt.shared.models.GameDetails)

Example 3 with ColumnConfig

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());
}
Also used : ColumnConfig(org.dominokit.domino.ui.datatable.ColumnConfig) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Person(com.github.nalukit.example.nalu.loginapplication.client.data.model.dto.Person) Elements.a(org.jboss.elemento.Elements.a) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) AbstractComponent(com.github.nalukit.nalu.client.component.AbstractComponent) Column(org.dominokit.domino.ui.grid.Column) DataTable(org.dominokit.domino.ui.datatable.DataTable) ArrayList(java.util.ArrayList) List(java.util.List) EventType(org.jboss.elemento.EventType) Text(elemental2.dom.Text) HTMLElement(elemental2.dom.HTMLElement) Row(org.dominokit.domino.ui.grid.Row) Card(org.dominokit.domino.ui.cards.Card) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Text(elemental2.dom.Text) Person(com.github.nalukit.example.nalu.loginapplication.client.data.model.dto.Person)

Example 4 with ColumnConfig

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());
}
Also used : ColumnConfig(org.dominokit.domino.ui.datatable.ColumnConfig) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Elements.a(org.jboss.elemento.Elements.a) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) AbstractComponent(com.github.nalukit.nalu.client.component.AbstractComponent) Column(org.dominokit.domino.ui.grid.Column) DataTable(org.dominokit.domino.ui.datatable.DataTable) ArrayList(java.util.ArrayList) Person(com.github.nalukit.example.nalu.loginapplication.shared.data.model.dto.Person) List(java.util.List) EventType(org.jboss.elemento.EventType) Text(elemental2.dom.Text) HTMLElement(elemental2.dom.HTMLElement) Row(org.dominokit.domino.ui.grid.Row) Card(org.dominokit.domino.ui.cards.Card) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Text(elemental2.dom.Text) Person(com.github.nalukit.example.nalu.loginapplication.shared.data.model.dto.Person)

Example 5 with ColumnConfig

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());
}
Also used : ColumnConfig(org.dominokit.domino.ui.datatable.ColumnConfig) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Elements.a(org.jboss.gwt.elemento.core.Elements.a) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) AbstractComponent(com.github.nalukit.nalu.client.component.AbstractComponent) Column(org.dominokit.domino.ui.grid.Column) EventType(org.jboss.gwt.elemento.core.EventType) DataTable(org.dominokit.domino.ui.datatable.DataTable) ArrayList(java.util.ArrayList) Person(com.github.nalukit.example.nalu.loginapplication.shared.data.model.dto.Person) List(java.util.List) Text(elemental2.dom.Text) HTMLElement(elemental2.dom.HTMLElement) Row(org.dominokit.domino.ui.grid.Row) Card(org.dominokit.domino.ui.cards.Card) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) Text(elemental2.dom.Text) Person(com.github.nalukit.example.nalu.loginapplication.shared.data.model.dto.Person)

Aggregations

List (java.util.List)23 ColumnConfig (org.dominokit.domino.ui.datatable.ColumnConfig)23 DataTable (org.dominokit.domino.ui.datatable.DataTable)23 TableConfig (org.dominokit.domino.ui.datatable.TableConfig)23 LocalListDataStore (org.dominokit.domino.ui.datatable.store.LocalListDataStore)23 HTMLElement (elemental2.dom.HTMLElement)21 Icons (org.dominokit.domino.ui.icons.Icons)18 ArrayList (java.util.ArrayList)17 Card (org.dominokit.domino.ui.cards.Card)17 TextNode (org.dominokit.domino.ui.utils.TextNode)16 Elements.a (org.jboss.elemento.Elements.a)16 HTMLDivElement (elemental2.dom.HTMLDivElement)15 Comparator (java.util.Comparator)15 RecordDetailsPlugin (org.dominokit.domino.ui.datatable.plugins.RecordDetailsPlugin)13 SimplePaginationPlugin (org.dominokit.domino.ui.datatable.plugins.SimplePaginationPlugin)13 SelectHeaderFilter (org.dominokit.domino.ui.datatable.plugins.filter.header.SelectHeaderFilter)13 TextHeaderFilter (org.dominokit.domino.ui.datatable.plugins.filter.header.TextHeaderFilter)13 SelectOption (org.dominokit.domino.ui.forms.SelectOption)13 SortPlugin (org.dominokit.domino.ui.datatable.plugins.SortPlugin)12 Color (org.dominokit.domino.ui.style.Color)12