Search in sources :

Example 1 with RowCell

use of org.dominokit.domino.ui.datatable.RowCell in project domino-ui-demo by DominoKit.

the class DataTableViewImpl method treeGridFullParentSpan.

@SampleMethod
private void treeGridFullParentSpan() {
    TableConfig<Contact> tableConfig = new TableConfig<>();
    tableConfig.addColumn(ColumnConfig.<Contact>create("id", "#").textAlign("right").asHeader().setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getIndex() + 1 + ""))).addColumn(ColumnConfig.<Contact>create("status", "Status").textAlign("center").setCellRenderer(cell -> {
        if (cell.getTableRow().getRecord().isActive()) {
            return Style.of(Icons.ALL.check_circle()).setColor(Color.GREEN_DARKEN_3.getHex()).element();
        } else {
            return Style.of(Icons.ALL.highlight_off()).setColor(Color.RED_DARKEN_3.getHex()).element();
        }
    })).addColumn(ColumnConfig.<Contact>create("gender", "Gender").setCellRenderer(cell -> ContactUiUtils.getGenderElement(cell.getRecord())).textAlign("center")).addColumn(ColumnConfig.<Contact>create("eyeColor", "Eye color").setCellRenderer(cell -> ContactUiUtils.getEyeColorElement(cell.getRecord())).textAlign("center")).addColumn(ColumnConfig.<Contact>create("balance", "Balance").setCellRenderer(cellInfo -> ContactUiUtils.getBalanceElement(cellInfo.getRecord()))).addColumn(ColumnConfig.<Contact>create("email", "Email").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getEmail()))).addColumn(ColumnConfig.<Contact>create("phone", "Phone").setCellRenderer(cell -> TextNode.of(cell.getTableRow().getRecord().getPhone()))).addColumn(ColumnConfig.<Contact>create("badges", "Badges").setCellRenderer(cell -> {
        if (cell.getTableRow().getRecord().getAge() < 35) {
            return Badge.create("Young").setBackground(ColorScheme.GREEN.color()).element();
        }
        return TextNode.of("");
    })).onUtilityColumn(utilityColumn -> {
        utilityColumn.setTitle("First name").setSortable(true, "id");
    }).setMultiSelect(true).addPlugin(new SortPlugin<>()).addPlugin(new SelectionPlugin<>()).addPlugin(new RecordDetailsPlugin<>(cell -> new ContactDetails(cell).element())).addPlugin(new RowMarkerPlugin<>(tableCellInfo -> ContactUiUtils.getBalanceColor(tableCellInfo.getRecord()))).addPlugin(new TreeGridPlugin<Contact>((parent, itemsConsumer) -> {
        itemsConsumer.accept(Optional.ofNullable(parent.getFriends()));
    }).setIndentColumnElementSupplier(tableRow -> Paragraph.create(tableRow.getRecord().getName()).setMarginBottom("0").element()).setParentRowCellsSupplier((dataTable, tableRow) -> {
        HTMLTableCellElement cellElement = DominoElement.of(td()).setAttribute("colspan", "8").element();
        RowCell<Contact> rowCell = new RowCell<>(new CellRenderer.CellInfo<>(tableRow, cellElement), dataTable.getTableConfig().getColumnByName("id"));
        return Collections.singletonList(rowCell);
    }).setIndent(60));
    LocalListDataStore<Contact> localListDataStore = new LocalListDataStore<>();
    DataTable<Contact> table = new DataTable<>(tableConfig, localListDataStore);
    element.appendChild(Card.create("TREE GRID PLUGIN - Full PARENT SPAN", "Render records in tree style with expand and collapse features").setCollapsible().appendChild(new TableStyleActions(table)).appendChild(table).element());
    contactListParseHandlers.add(contacts -> {
        localListDataStore.setData(contacts.subList(0, 25));
        table.load();
    });
}
Also used : SampleClass(org.dominokit.domino.SampleClass) JsonResource(org.dominokit.domino.datatable.client.views.JsonResource) SampleMethod(org.dominokit.domino.SampleMethod) SelectionPlugin(org.dominokit.domino.ui.datatable.plugins.SelectionPlugin) UiView(org.dominokit.domino.api.client.annotations.UiView) Date(java.util.Date) CodeCard(org.dominokit.domino.componentcase.client.ui.views.CodeCard) DoubleBox(org.dominokit.domino.ui.forms.DoubleBox) Style(org.dominokit.domino.ui.style.Style) TreeGridSample(org.dominokit.domino.datatable.client.views.model.TreeGridSample) Paragraph(org.dominokit.domino.ui.Typography.Paragraph) Random(java.util.Random) HTMLTableCellElement(elemental2.dom.HTMLTableCellElement) ContactSearchFilter(org.dominokit.domino.datatable.client.views.model.ContactSearchFilter) Notification(org.dominokit.domino.ui.notifications.Notification) Icon(org.dominokit.domino.ui.icons.Icon) EmailBox(org.dominokit.domino.ui.forms.EmailBox) HTMLElement(elemental2.dom.HTMLElement) TextHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.TextHeaderFilter) HeaderBarPlugin(org.dominokit.domino.ui.datatable.plugins.HeaderBarPlugin) SimplePaginationPlugin(org.dominokit.domino.ui.datatable.plugins.SimplePaginationPlugin) Card(org.dominokit.domino.ui.cards.Card) ResourceException(com.google.gwt.resources.client.ResourceException) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) TextResource(com.google.gwt.resources.client.TextResource) BaseDemoView(org.dominokit.domino.componentcase.client.ui.views.BaseDemoView) DominoElement(org.dominokit.domino.ui.utils.DominoElement) RecordDetailsPlugin(org.dominokit.domino.ui.datatable.plugins.RecordDetailsPlugin) BooleanHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.BooleanHeaderFilter) Collectors(java.util.stream.Collectors) SortPlugin(org.dominokit.domino.ui.datatable.plugins.SortPlugin) List(java.util.List) Select(org.dominokit.domino.ui.forms.Select) Color(org.dominokit.domino.ui.style.Color) Unit.px(org.dominokit.domino.ui.style.Unit.px) ColumnHeaderFilterPlugin(org.dominokit.domino.ui.datatable.plugins.ColumnHeaderFilterPlugin) ScrollingPaginationPlugin(org.dominokit.domino.ui.datatable.plugins.ScrollingPaginationPlugin) Optional(java.util.Optional) GroupingPlugin(org.dominokit.domino.ui.datatable.plugins.GroupingPlugin) CheckBox(org.dominokit.domino.ui.forms.CheckBox) ContactList(org.dominokit.domino.datatable.client.views.model.ContactList) EyeColor(org.dominokit.domino.datatable.client.views.model.EyeColor) DatatableProxy(org.dominokit.domino.datatable.client.presenters.DatatableProxy) Icons(org.dominokit.domino.ui.icons.Icons) ColumnConfig(org.dominokit.domino.ui.datatable.ColumnConfig) RowCell(org.dominokit.domino.ui.datatable.RowCell) TreeGridPlugin(org.dominokit.domino.ui.datatable.plugins.TreeGridPlugin) Elements.a(org.jboss.elemento.Elements.a) Elements.td(org.jboss.elemento.Elements.td) Badge(org.dominokit.domino.ui.badges.Badge) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) TopPanelPlugin(org.dominokit.domino.ui.datatable.plugins.TopPanelPlugin) DoubleHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.DoubleHeaderFilter) DatatableView(org.dominokit.domino.datatable.client.views.DatatableView) AdvancedPaginationPlugin(org.dominokit.domino.ui.datatable.plugins.AdvancedPaginationPlugin) TableEvent(org.dominokit.domino.ui.datatable.events.TableEvent) DataTable(org.dominokit.domino.ui.datatable.DataTable) ArrayList(java.util.ArrayList) BlockHeader(org.dominokit.domino.ui.header.BlockHeader) LinkToSourceCode(org.dominokit.domino.componentcase.client.ui.views.LinkToSourceCode) Elements.div(org.jboss.elemento.Elements.div) SelectHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.SelectHeaderFilter) Gender(org.dominokit.domino.datatable.client.views.model.Gender) BodyScrollPlugin(org.dominokit.domino.ui.datatable.plugins.BodyScrollPlugin) SelectOption(org.dominokit.domino.ui.forms.SelectOption) TextNode(org.dominokit.domino.ui.utils.TextNode) TextBox(org.dominokit.domino.ui.forms.TextBox) ContactSorter(org.dominokit.domino.datatable.client.views.model.ContactSorter) CellRenderer(org.dominokit.domino.ui.datatable.CellRenderer) LocalListScrollingDataSource(org.dominokit.domino.ui.datatable.store.LocalListScrollingDataSource) ResourceCallback(com.google.gwt.resources.client.ResourceCallback) ColorScheme(org.dominokit.domino.ui.style.ColorScheme) EnumHeaderFilter(org.dominokit.domino.ui.datatable.plugins.filter.header.EnumHeaderFilter) Contact(org.dominokit.domino.datatable.client.views.model.Contact) DomGlobal(elemental2.dom.DomGlobal) TableDataUpdatedEvent(org.dominokit.domino.ui.datatable.events.TableDataUpdatedEvent) HTMLDivElement(elemental2.dom.HTMLDivElement) FieldStyle(org.dominokit.domino.ui.forms.FieldStyle) TelephoneBox(org.dominokit.domino.ui.forms.TelephoneBox) Comparator(java.util.Comparator) RowMarkerPlugin(org.dominokit.domino.ui.datatable.plugins.RowMarkerPlugin) Collections(java.util.Collections) DataTable(org.dominokit.domino.ui.datatable.DataTable) TreeGridPlugin(org.dominokit.domino.ui.datatable.plugins.TreeGridPlugin) RowCell(org.dominokit.domino.ui.datatable.RowCell) CellRenderer(org.dominokit.domino.ui.datatable.CellRenderer) RowMarkerPlugin(org.dominokit.domino.ui.datatable.plugins.RowMarkerPlugin) Contact(org.dominokit.domino.datatable.client.views.model.Contact) LocalListDataStore(org.dominokit.domino.ui.datatable.store.LocalListDataStore) SelectionPlugin(org.dominokit.domino.ui.datatable.plugins.SelectionPlugin) TableConfig(org.dominokit.domino.ui.datatable.TableConfig) HTMLTableCellElement(elemental2.dom.HTMLTableCellElement) SampleMethod(org.dominokit.domino.SampleMethod)

Aggregations

ResourceCallback (com.google.gwt.resources.client.ResourceCallback)1 ResourceException (com.google.gwt.resources.client.ResourceException)1 TextResource (com.google.gwt.resources.client.TextResource)1 DomGlobal (elemental2.dom.DomGlobal)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 HTMLElement (elemental2.dom.HTMLElement)1 HTMLTableCellElement (elemental2.dom.HTMLTableCellElement)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 Date (java.util.Date)1 List (java.util.List)1 Optional (java.util.Optional)1 Random (java.util.Random)1 Collectors (java.util.stream.Collectors)1 SampleClass (org.dominokit.domino.SampleClass)1 SampleMethod (org.dominokit.domino.SampleMethod)1 UiView (org.dominokit.domino.api.client.annotations.UiView)1 BaseDemoView (org.dominokit.domino.componentcase.client.ui.views.BaseDemoView)1 CodeCard (org.dominokit.domino.componentcase.client.ui.views.CodeCard)1