T
the type of data to be displayed in the table
See also :
This class provides mechanisms to define columns, plugins, and many other configurations needed to draw and interact with a DataTable.
TableConfig< MyData> config = new TableConfig<> ();
config.addColumn(ColumnConfig.create("name", "Name").setWidth("100px"))
.addPlugin(new MyPlugin())
.setLazyLoad(true);
DataTable< MyData> table = new DataTable<> (config);
This class provides mechanisms to define columns, plugins, and many other configurations needed to draw and interact with a DataTable.
TableConfig< MyData> config = new TableConfig<> ();
config.addColumn(ColumnConfig.create("name", "Name").setWidth("100px"))
.addPlugin(new MyPlugin())
.setLazyLoad(true);
DataTable< MyData> table = new DataTable<> (config);
public void DataTable(TableConfig<T> tableConfig, DataStore<T> dataStore)
tableConfig
Configuration details of the table.
dataStore
Data storage handler to fetch and manipulate data for the table.
public DataStore<T> getDataStore()
the associated DataStore instance.
public DataTable<T> redraw()
the current DataTable instance
public DataTable<T> load()
the current DataTable instance
public DataTable<T> setData(List<T> data)
data
the list of data to be set
the current DataTable instance
public DataTable<T> appendData(List<T> newData)
newData
the new data to be appended
the current DataTable instance
public Collection<T> getData()
the collection of data in the table
public DataTable<T> setCondensed(boolean condensed)
condensed
a boolean indicating whether to enable the condensed style
the current DataTable instance
public boolean isCondensed()
a boolean indicating if the table is condensed
public DataTable<T> setHover(boolean hover)
hover
a boolean indicating whether to enable the hover effect
the current DataTable instance
public boolean isHover()
a boolean indicating if the hover effect is enabled
public DataTable<T> setBordered(boolean bordered)
bordered
a boolean indicating whether to enable the bordered style
the current DataTable instance
public boolean isBordered()
a boolean indicating if the table is bordered
public DataTable<T> setStriped(boolean striped)
striped
a boolean indicating whether to enable the striped style
the current DataTable instance
public boolean isStriped()
a boolean indicating if the striped style is enabled
public DataTable<T> edit()
the current DataTable instance
public DataTable<T> save()
the current DataTable instance
public DataTable<T> cancelEditing()
the current DataTable instance
public TableElement tableElement()
the table element
public TBodyElement bodyElement()
the table body element
public THeadElement headerElement()
the table header element
public TFootElement footerElement()
the table footer element
public TableConfig<T> getTableConfig()
the table configuration object
public DataTable<T> filterRows(LocalRowFilter<T> rowFilter)
rowFilter
the filter to apply to each row in the table
the current DataTable instance
public DataTable<T> clearRowFilters()
the current DataTable instance
public HTMLDivElement element()
the root element of the data table
public List<TableRow<T>> getSelectedItems()
a list of selected table rows
public List<T> getSelectedRecords()
a list of records corresponding to selected table rows
public List<TableRow<T>> getRows()
a list of all table rows
public List<TableRow<T>> getRootRows()
a list of root table rows
public Optional<TableRow<T>> getRecordRow(T record)
record
the record to find in the table rows
an Optional containing the matching table row if found, or an empty Optional if no matching row is found
public List<T> getRecords()
a list of records corresponding to root table rows
public List<T> getDirtyRecords()
a list of modified records
public void selectAll()
public DataTable<T> selectAll(SelectionCondition<T> selectionCondition)
selectionCondition
the condition determining which rows should be selected
the current DataTable instance
public void deselectAll()
public DataTable<T> deselectAll(SelectionCondition<T> selectionCondition)
selectionCondition
the condition determining which rows should be deselected
the current DataTable instance
public DataTable<T> selectRows(Collection<TableRow<T>> rows)
rows
the collection of table rows to be selected
the current DataTable instance
public DataTable<T> deselectRows(Collection<TableRow<T>> rows)
rows
the collection of table rows to be deselected
the current DataTable instance
public DataTable<T> selectRecords(Collection<T> records)
records
the collection of records to be selected
the current DataTable instance
public DataTable<T> deselectRecords(Collection<T> records)
records
the collection of records to be deselected
the current DataTable instance
public boolean isSelectable()
true if selectable, false otherwise
public DataTable<T> pauseSelectionListeners()
the current DataTable instance
public DataTable<T> resumeSelectionListeners()
the current DataTable instance
public DataTable<T> togglePauseSelectionListeners(boolean toggle)
toggle
true to pause the listeners, false to resume
the current DataTable instance
public Set<SelectionListener<? super TableRow<T>, ? super List<TableRow<T>>>> getSelectionListeners()
a set of selection listeners
public Set<SelectionListener<? super TableRow<T>, ? super List<TableRow<T>>>> getDeselectionListeners()
a set of deselection listeners
public boolean isSelectionListenersPaused()
true if the listeners are paused, false otherwise
public DataTable<T> triggerSelectionListeners(TableRow<T> source, List<TableRow<T>> selection)
source
the source TableRow that caused the selection change
selection
the list of currently selected rows
the current DataTable instance
public DataTable<T> triggerDeselectionListeners(TableRow<T> source, List<TableRow<T>> selection)
source
the source TableRow that caused the deselection
selection
the list of currently selected rows
the current DataTable instance
public List<TableRow<T>> getSelection()
a list of selected table rows
public DataTable<T> addTableEventListener(String type, DominoEventListener listener)
type
the event type
listener
the listener to be added
the current DataTable instance
public DataTable<T> removeTableListener(String type, DominoEventListener listener)
type
the event type
listener
the listener to be removed
the current DataTable instance
public DataTable<T> fireTableEvent(TableEvent tableEvent)
tableEvent
the event to fire
the current DataTable instance
public SearchContext<T> getSearchContext()
the current search context
public DataTable<T> setRemoveRecordsHandler(RemoveRowsHandler<T> removeRecordsHandler)
removeRecordsHandler
the handler to set
the current DataTable instance
public DynamicStyleSheet<HTMLDivElement, DataTable<T>> getDynamicStyleSheet()
the dynamic style sheet
public DataTable<T> appendChild(Node node)
node
the node to be appended
the current DataTable instance
public DataTable<T> appendChild(String text)
text
the text to be appended as a text node
the current DataTable instance
public DataTable<T> withTable(ChildHandler<DataTable<T>, TableElement> handler)
handler
the handler that defines the operations to be performed on the table element
the current DataTable instance
public DataTable<T> withTableBody(ChildHandler<DataTable<T>, TBodyElement> handler)
handler
the handler that defines the operations to be performed on the table body element
the current DataTable instance
public DataTable<T> withTableFooter(ChildHandler<DataTable<T>, TFootElement> handler)
handler
the handler that defines the operations to be performed on the table footer element
the current DataTable instance
public DataTable<T> withTableHead(ChildHandler<DataTable<T>, THeadElement> handler)
handler
the handler that defines the operations to be performed on the table head element
the current DataTable instance
public DataTable<T> appendChild(IsElement<?> isElement)
isElement
the element to be appended
the current DataTable instance
public void drawHeaders(DataTable<T> dataTable, THeadElement thead)
dataTable
The DataTable for which headers are to be drawn.
thead
The table header element.
public void drawRecord(DataTable<T> dataTable, TableRow<T> tableRow)
This method will render the table row, apply a CSS class based on its index (odd or even), and append it to the DataTable either directly or using the associated RowAppenderMeta. After the row is added, it will notify all associated plugins.
dataTable
The DataTable in which the record is to be drawn.
tableRow
The table row that represents the record.
public TableConfig<T> addColumn(ColumnConfig<T> column)
column
Column configuration.
Current instance of TableConfig for chaining.
public TableConfig<T> insertColumnFirst(ColumnConfig<T> column)
column
The column configuration to be added.
The current instance of TableConfig for chaining.
public TableConfig<T> insertColumnLast(ColumnConfig<T> column)
column
The column configuration to be added.
The current instance of TableConfig for chaining.
public TableConfig<T> addPlugin(DataTablePlugin<T> plugin)
plugin
The DataTablePlugin to be added.
The current instance of TableConfig for chaining.
public TableConfig<T> onUtilityColumn(UtilityColumnHandler<T> utilityColumnHandler)
utilityColumnHandler
The handler for utility columns.
The current instance of TableConfig for chaining.
public boolean isFixed()
true if the table layout is fixed, false otherwise.
public TableConfig<T> setFixed(boolean fixed)
fixed
true to set the table layout as fixed, false for fluid.
The current instance of TableConfig for chaining.
@deprecated use {@link #setTableMode(TableMode)} insteadpublic TableConfig<T> setTableMode(TableMode tableMode)
tableMode
the mode to set for the table, defining its operational behavior or format
the updated TableConfig instance with the newly set table mode
public TableMode getTableMode()
the current TableMode instance representing the table's mode.
public boolean isLazyLoad()
true if the table is set to lazy load mode, false otherwise.
public TableConfig<T> setLazyLoad(boolean lazyLoad)
lazyLoad
true to enable lazy load mode, false to disable.
The current instance of TableConfig for chaining.
public String getFixedBodyHeight()
A string representing the fixed height, e.g., "200px".
public TableConfig<T> setFixedBodyHeight(String fixedBodyHeight)
fixedBodyHeight
The height as a string, e.g., "200px".
The current instance of TableConfig for chaining.
public String getFixedDefaultColumnWidth()
A string representing the default column width, e.g., "100px".
public TableConfig<T> setFixedDefaultColumnWidth(String fixedDefaultColumnWidth)
fixedDefaultColumnWidth
The width as a string, e.g., "100px".
The current instance of TableConfig for chaining.
public boolean isMultiSelect()
true if multi-selection is enabled, false otherwise.
public TableConfig<T> setMultiSelect(boolean multiSelect)
multiSelect
true to enable multi-selection mode, false to disable.
The current instance of TableConfig for chaining.
public void setRowAppender(RowAppender<T> rowAppender)
rowAppender
The row appender to set.
public List<DataTablePlugin<T>> getPlugins()
A sorted list of DataTablePlugin .
public List<ColumnConfig<T>> getColumns()
A list of ColumnConfig representing the leaf columns.
public List<ColumnConfig<T>> getFlattenColumns()
A list of ColumnConfig representing all columns, flattened.
public List<ColumnConfig<T>> getLeafColumns()
A list of ColumnConfig representing all columns, flattened.
public List<ColumnConfig<T>> getColumnsGrouped()
A list of ColumnConfig representing grouped columns.
public List<ColumnConfig<T>> getVisibleColumns()
A list of ColumnConfig representing visible columns.
public ColumnConfig<T> getColumnByName(String name)
name
The name of the column to retrieve.
The ColumnConfig associated with the given name.
@throws ColumnNofFoundException If no column is found with the specified name.public Optional<ColumnConfig<T>> findColumnByName(String name)
name
The name of the column to retrieve.
The ColumnConfig associated with the given name.
@throws ColumnNofFoundException If no column is found with the specified name.public int getColumnIndexByName(String name)
This method searches the list of leaf columns (as returned by getLeafColumns ) for the first ColumnConfig whose name equals the specified name . If such a column is found, its index within the leaf column list is returned. If no matching column exists, -1 is returned.
name
the name of the column to search for; must not be null
the index of the first matching column, or -1 if no column matches
public TableConfig<T> setUtilityColumnTitle(String title)
title
The title to set for the utility column.
The current instance of TableConfig for chaining.
public DataTable<T> getDataTable()
The DataTable associated with this configuration.
public TableConfig<T> setDirtyRecordHandlers(DirtyRecordProvider<T> dirtyRecordProvider, SaveDirtyRecordHandler<T> saveDirtyRecordHandler)
dirtyRecordProvider
The provider to detect dirty records.
saveDirtyRecordHandler
The handler to save dirty records.
The current instance of TableConfig for chaining.
public String getWidth()
The width of the table.
public TableConfig<T> setWidth(String width)
width
The width to set.
The current instance of TableConfig for chaining.
public String getMaxWidth()
The maximum width of the table.
public TableConfig<T> setMaxWidth(String maxWidth)
maxWidth
The maximum width to set.
The current instance of TableConfig for chaining.
public String getMinWidth()
The minimum width of the table.
public boolean isStickyHeader()
true if the header is sticky, false otherwise.
public TableConfig<T> setStickyHeader(boolean stickyHeader)
stickyHeader
true to make the header sticky, false to disable.
The current instance of TableConfig for chaining.
public TableConfig<T> setMinWidth(String minWidth)
minWidth
The minimum width to set.
The current instance of TableConfig for chaining.
public TableConfig<T> setOnRowEditHandler(Consumer<TableRow<T>> handler)
handler
The handler to be called.
same TableConfig instance.
public TableConfig<T> setOnRowFinishEditHandler(Consumer<TableRow<T>> handler)
handler
The handler to be called.
same TableConfig instance.
public TableConfig<T> withUtilityColumn(ChildHandler<TableConfig<T>, ColumnConfig<T>> handler)
handler
a ChildHandler instance that allows custom configuration of the utility column.
the updated TableConfig instance.
public void drawHeaders(DataTable<T> dataTable, THeadElement thead)
dataTable
The DataTable for which headers are to be drawn.
thead
The table header element.
public void drawRecord(DataTable<T> dataTable, TableRow<T> tableRow)
This method will render the table row, apply a CSS class based on its index (odd or even), and append it to the DataTable either directly or using the associated RowAppenderMeta. After the row is added, it will notify all associated plugins.
dataTable
The DataTable in which the record is to be drawn.
tableRow
The table row that represents the record.
public TableConfig<T> addColumn(ColumnConfig<T> column)
column
Column configuration.
Current instance of TableConfig for chaining.
public TableConfig<T> insertColumnFirst(ColumnConfig<T> column)
column
The column configuration to be added.
The current instance of TableConfig for chaining.
public TableConfig<T> insertColumnLast(ColumnConfig<T> column)
column
The column configuration to be added.
The current instance of TableConfig for chaining.
public TableConfig<T> addPlugin(DataTablePlugin<T> plugin)
plugin
The DataTablePlugin to be added.
The current instance of TableConfig for chaining.
public TableConfig<T> onUtilityColumn(UtilityColumnHandler<T> utilityColumnHandler)
utilityColumnHandler
The handler for utility columns.
The current instance of TableConfig for chaining.
public boolean isFixed()
true if the table layout is fixed, false otherwise.
public TableConfig<T> setFixed(boolean fixed)
fixed
true to set the table layout as fixed, false for fluid.
The current instance of TableConfig for chaining.
@deprecated use {@link #setTableMode(TableMode)} insteadpublic TableConfig<T> setTableMode(TableMode tableMode)
tableMode
the mode to set for the table, defining its operational behavior or format
the updated TableConfig instance with the newly set table mode
public TableMode getTableMode()
the current TableMode instance representing the table's mode.
public boolean isLazyLoad()
true if the table is set to lazy load mode, false otherwise.
public TableConfig<T> setLazyLoad(boolean lazyLoad)
lazyLoad
true to enable lazy load mode, false to disable.
The current instance of TableConfig for chaining.
public String getFixedBodyHeight()
A string representing the fixed height, e.g., "200px".
public TableConfig<T> setFixedBodyHeight(String fixedBodyHeight)
fixedBodyHeight
The height as a string, e.g., "200px".
The current instance of TableConfig for chaining.
public String getFixedDefaultColumnWidth()
A string representing the default column width, e.g., "100px".
public TableConfig<T> setFixedDefaultColumnWidth(String fixedDefaultColumnWidth)
fixedDefaultColumnWidth
The width as a string, e.g., "100px".
The current instance of TableConfig for chaining.
public boolean isMultiSelect()
true if multi-selection is enabled, false otherwise.
public TableConfig<T> setMultiSelect(boolean multiSelect)
multiSelect
true to enable multi-selection mode, false to disable.
The current instance of TableConfig for chaining.
public void setRowAppender(RowAppender<T> rowAppender)
rowAppender
The row appender to set.
public List<DataTablePlugin<T>> getPlugins()
A sorted list of DataTablePlugin .
public List<ColumnConfig<T>> getColumns()
A list of ColumnConfig representing the leaf columns.
public List<ColumnConfig<T>> getFlattenColumns()
A list of ColumnConfig representing all columns, flattened.
public List<ColumnConfig<T>> getLeafColumns()
A list of ColumnConfig representing all columns, flattened.
public List<ColumnConfig<T>> getColumnsGrouped()
A list of ColumnConfig representing grouped columns.
public List<ColumnConfig<T>> getVisibleColumns()
A list of ColumnConfig representing visible columns.
public ColumnConfig<T> getColumnByName(String name)
name
The name of the column to retrieve.
The ColumnConfig associated with the given name.
@throws ColumnNofFoundException If no column is found with the specified name.public Optional<ColumnConfig<T>> findColumnByName(String name)
name
The name of the column to retrieve.
The ColumnConfig associated with the given name.
@throws ColumnNofFoundException If no column is found with the specified name.public int getColumnIndexByName(String name)
This method searches the list of leaf columns (as returned by getLeafColumns ) for the first ColumnConfig whose name equals the specified name . If such a column is found, its index within the leaf column list is returned. If no matching column exists, -1 is returned.
name
the name of the column to search for; must not be null
the index of the first matching column, or -1 if no column matches
public TableConfig<T> setUtilityColumnTitle(String title)
title
The title to set for the utility column.
The current instance of TableConfig for chaining.
public DataTable<T> getDataTable()
The DataTable associated with this configuration.
public TableConfig<T> setDirtyRecordHandlers(DirtyRecordProvider<T> dirtyRecordProvider, SaveDirtyRecordHandler<T> saveDirtyRecordHandler)
dirtyRecordProvider
The provider to detect dirty records.
saveDirtyRecordHandler
The handler to save dirty records.
The current instance of TableConfig for chaining.
public String getWidth()
The width of the table.
public TableConfig<T> setWidth(String width)
width
The width to set.
The current instance of TableConfig for chaining.
public String getMaxWidth()
The maximum width of the table.
public TableConfig<T> setMaxWidth(String maxWidth)
maxWidth
The maximum width to set.
The current instance of TableConfig for chaining.
public String getMinWidth()
The minimum width of the table.
public boolean isStickyHeader()
true if the header is sticky, false otherwise.
public TableConfig<T> setStickyHeader(boolean stickyHeader)
stickyHeader
true to make the header sticky, false to disable.
The current instance of TableConfig for chaining.
public TableConfig<T> setMinWidth(String minWidth)
minWidth
The minimum width to set.
The current instance of TableConfig for chaining.
public TableConfig<T> setOnRowEditHandler(Consumer<TableRow<T>> handler)
handler
The handler to be called.
same TableConfig instance.
public TableConfig<T> setOnRowFinishEditHandler(Consumer<TableRow<T>> handler)
handler
The handler to be called.
same TableConfig instance.
public TableConfig<T> withUtilityColumn(ChildHandler<TableConfig<T>, ColumnConfig<T>> handler)
handler
a ChildHandler instance that allows custom configuration of the utility column.
the updated TableConfig instance.