public class TreeGridPlugin<T> extends Object implements DataTablePlugin<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
TreeGridPlugin.ParentRowCellsSupplier<T>
Functional interface to provide the cells to be rendered in a parent row
|
static interface |
TreeGridPlugin.SubItemsProvider<T>
A functional interface to supply record children
|
| Modifier and Type | Field and Description |
|---|---|
static int |
BASE_PADDING |
static int |
DEFAULT_INDENT |
static String |
ICON_ORDER |
static String |
TREE_GRID_EXPAND_COLLAPSE |
static String |
TREE_GRID_ROW_LEVEL |
static String |
TREE_GRID_ROW_SUBITEMS |
static String |
TREE_GRID_ROW_TOGGLE_ICON |
| Constructor and Description |
|---|
TreeGridPlugin(TreeGridPlugin.SubItemsProvider<T> subItemsProvider) |
| Modifier and Type | Method and Description |
|---|---|
void |
collapseAllRows()
Collapse all table row
|
void |
collapseRow(TableRow<T> row)
If the row has children it will collapse the row.
|
void |
expandAllRows(boolean recursive)
Expand all table rows, and based on recursive value it might also recursively expand all
children
|
void |
expandRow(TableRow<T> row)
If the row has children it will expand the row and recursively expand the row children
|
void |
expandRow(TableRow<T> row,
boolean recursive)
If the row has children it will expand the row, and based on recursive value it might also
expand its children sub-children
|
Optional<List<elemental2.dom.HTMLElement>> |
getUtilityElements(DataTable<T> dataTable,
CellRenderer.CellInfo<T> cellInfo)
Adds the expand/collapse/leaf icons to the plugins utility columns cells
|
void |
handleEvent(TableEvent event) |
void |
init(DataTable<T> dataTable)
this method is used to initialise the plugin with the datatable instance
|
void |
onBeforeAddRow(DataTable<T> dataTable,
TableRow<T> tableRow)
This method will be called right before adding a row to the table
|
void |
onHeaderAdded(DataTable<T> dataTable,
ColumnConfig<T> column)
Adds the Expand all/collpase all to the plugins utility column header This method will be called right after adding a column header element to the table
|
void |
onRowAdded(DataTable<T> dataTable,
TableRow<T> tableRow)
This method will be called right after adding a row to the table
|
boolean |
requiresUtilityColumn() |
TreeGridPlugin<T> |
setCollapseIconSupplier(Supplier<BaseIcon<?>> collapseIconSupplier)
Sets a supplier for a custom collapse icon instead of the default one
|
TreeGridPlugin<T> |
setExpandIconSupplier(Supplier<BaseIcon<?>> expandIconSupplier)
Sets a supplier for a custom expand icon instead of the default one
|
TreeGridPlugin<T> |
setIndent(int indent)
Sets indent value to be added for each tree gird level
|
TreeGridPlugin<T> |
setIndentColumnElementSupplier(Function<TableRow<T>,elemental2.dom.Node> indentColumnElementSupplier)
Sets a supplier of elements to be appended to the tree grid indent column as part of the
utility columns cells
|
TreeGridPlugin<T> |
setLeafIconSupplier(Supplier<BaseIcon<?>> leafIconSupplier)
Sets a supplier for a custom leaf row icon instead of the default one
|
TreeGridPlugin<T> |
setParentRowCellsSupplier(TreeGridPlugin.ParentRowCellsSupplier<T> parentRowCellsSupplier)
Set a supplier that provides cells to be rendered in a parent row cells, this can be used to
provide a custom UI for parent rows
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonAfterAddHeaders, onAfterAddTable, onAllRowsAdded, onBeforeAddHeaders, onBeforeAddTable, onBodyAddedpublic static final String TREE_GRID_ROW_LEVEL
public static final String TREE_GRID_ROW_SUBITEMS
public static final String TREE_GRID_ROW_TOGGLE_ICON
public static final String TREE_GRID_EXPAND_COLLAPSE
public static final int DEFAULT_INDENT
public static final int BASE_PADDING
public static final String ICON_ORDER
public TreeGridPlugin(TreeGridPlugin.SubItemsProvider<T> subItemsProvider)
public void init(DataTable<T> dataTable)
init in interface DataTablePlugin<T>dataTable - the DataTable we are attaching this plugin to.public boolean requiresUtilityColumn()
requiresUtilityColumn in interface DataTablePlugin<T>public final void expandRow(TableRow<T> row, boolean recursive)
row - TableRow to be expandedrecursive - boolean, if true will recursively expand the row childrenpublic final void expandRow(TableRow<T> row)
row - TableRow to be expandedpublic final void expandAllRows(boolean recursive)
recursive - boolean, if true will recursively expand the row childrenpublic final void collapseRow(TableRow<T> row)
row - TableRow to be collapsedpublic final void collapseAllRows()
public Optional<List<elemental2.dom.HTMLElement>> getUtilityElements(DataTable<T> dataTable, CellRenderer.CellInfo<T> cellInfo)
getUtilityElements in interface DataTablePlugin<T>dataTable - DataTablecellInfo - CellRenderer.CellInfoOptional List of HTMLElements to be used as part of
the plugins utility column, elements returned from this method will be rendered as flex
items inside the utility cell.public void onHeaderAdded(DataTable<T> dataTable, ColumnConfig<T> column)
onHeaderAdded in interface DataTablePlugin<T>dataTable - the DataTable we are attaching this plugin to.column - the ColumnConfig of the column we added the header for.public void onBeforeAddRow(DataTable<T> dataTable, TableRow<T> tableRow)
onBeforeAddRow in interface DataTablePlugin<T>dataTable - the DataTable we are attaching this plugin to.tableRow - the TableRow we are about to addpublic void onRowAdded(DataTable<T> dataTable, TableRow<T> tableRow)
onRowAdded in interface DataTablePlugin<T>dataTable - the DataTable we are attaching this plugin to.tableRow - the TableRow addedpublic void handleEvent(TableEvent event)
handleEvent in interface TableEventListenerhandleEvent in interface DataTablePlugin<T>event - the TableEvent being receivedpublic TreeGridPlugin<T> setParentRowCellsSupplier(TreeGridPlugin.ParentRowCellsSupplier<T> parentRowCellsSupplier)
parentRowCellsSupplier - TreeGridPlugin.ParentRowCellsSupplierpublic TreeGridPlugin<T> setExpandIconSupplier(Supplier<BaseIcon<?>> expandIconSupplier)
public TreeGridPlugin<T> setCollapseIconSupplier(Supplier<BaseIcon<?>> collapseIconSupplier)
public TreeGridPlugin<T> setLeafIconSupplier(Supplier<BaseIcon<?>> leafIconSupplier)
public TreeGridPlugin<T> setIndent(int indent)
indent - intpublic TreeGridPlugin<T> setIndentColumnElementSupplier(Function<TableRow<T>,elemental2.dom.Node> indentColumnElementSupplier)
Copyright © 2019–2022 Dominokit. All rights reserved.