Package dev. fritz2. components. datatable
Types
Main class to define the representation of the data class `T` of one table column. This class mainly is the result of the DSL configuration of the datatable.
Wrapping class to group the id of a Column with the sorting strategy. This is the base for the type `T` independent SortingPlan which itself is necessary for the internalState.
This context class manages the configuration and defines the DSL for the overall declaration of the data table's columns.
This alias expresses the grouping of a Column paired with its sorting strategy. Together with the SortingPlan this represents the foundation of the sorting mechanisms: Based upon the SortingPlan this plan is created from the given Columns of a datatable and is then used to do the actual sorting within a RowSorter implementation.
There are three different interfaces on that the separate sorting functionalities are implemented:
SortingPlanReducer: create a plan of columns to be sorted in a specific direction based upon the former plan and the triggering user action
RowSorter: do the actual sorting work based upon the above plan (slightly transformed to typed column instead of plain ids)
SortingRenderer: render the appropriate UI for the sorting actions in the header columns
Here is the big picture visualized:
+-----------------------------------------------------------------+
| (emits new state) |
| |
v |
+------------------------------------------+ |
| State | |
+------------------------------------------+ |
| val sortingPlan: SortingPlan | |
+------------------------------------------+ |
| fun columnSortingPlan: ColumnSortingPlan | |
+------------------------------------------+ |
^ |
| +----------------------------------+ |
User action as input: |(owns) +---->| SortingPlanReducer (1) |---+
(Column ID+Strategy) | | +----------------------------------+
| | | | Creates a new SortingPlan based |
| +-----------------------------+ | | upon the former plan, the newly |
| | StateStore | | | column ID and its sorting |
| +-----------------------------+ | | strategy (asc, desc, none) |
+---->| val sortingChanged: Handler |-----+ +----------------------------------+
+-----------------------------+
+---->| fun renderingRowsData |-----+
| +-----------------------------+ | +----------------------------------+
| +---->| RowSorter (2) |
| +----------------------------------+
| | Takes the current rows and sort |
TableComponent | them according to the column |
.renderRows() | based sorting plan. |
| So the raw ``sortingPlan`` |
| field of the state object must |
| be enriched before with the |
| actual ``Column`` objects by |
| the ``columnSoftingPlan`` |
| function. |
+----------------------------------+
+----------------------------------+
TableComponent ------------------------------------>| SortingRenderer (3) |
.renderHeader() +----------------------------------+
| Renders the UI elements |
| (icons eg.) for configuring |
| and changing the sorting state. |
+----------------------------------+
[Edit](https://textik.com/#f3fc13858b89df9b)This context class integrates the configuration and the DSL for the whole data table using sub contexts with their own DSLs.
This context class defines the event context of the data table.
This context class integrates the configuration and the DSL for the common header aspects.
Selection strategy for disabling the selection at all.
This class implements the sorting with at most one column as sorting criterion, that is at most one column within the ColumnSortingPlan.
This context class integrates the configuration and the DSL for some general and optional properties.
This store manages the selected rows of the data table. It does not manage the state of the columns (configuration meta data like sorting, order and so on); this is done by StateStore!
This selection strategy offers the selection via an additional checkbox per row, which is added in front of the row as artificial column.
This selection strategy enables the selection by clicking onto a row of the table.
This context class configures the selection capabilities of the data table.
Representation of the selection possibilities.
This interface defines a strategy type in order to implement different selection mechanisms.
This implementation of a SortingRenderer creates an icon based UI for choosing the sorting of a data table.
This alias expresses the sorting plan, which is the ordered list of column ids paired with their strategies. This is the base concept for the sorting held within a State object and used for the SortingRenderer in order to create a new plan based upon user interaction (change the direction, change the column to be sorted)
There are three different interfaces on that the separate sorting functionalities are implemented:
SortingPlanReducer: create a plan of columns to be sorted in a specific direction based upon the former plan and the triggering user action
RowSorter: do the actual sorting work based upon the above plan (slightly transformed to typed column instead of plain ids)
SortingRenderer: render the appropriate UI for the sorting actions in the header columns
Here is the big picture visualized:
+-----------------------------------------------------------------+
| (emits new state) |
| |
v |
+------------------------------------------+ |
| State | |
+------------------------------------------+ |
| val sortingPlan: SortingPlan | |
+------------------------------------------+ |
| fun columnSortingPlan: ColumnSortingPlan | |
+------------------------------------------+ |
^ |
| +----------------------------------+ |
User action as input: |(owns) +---->| SortingPlanReducer (1) |---+
(Column ID+Strategy) | | +----------------------------------+
| | | | Creates a new SortingPlan based |
| +-----------------------------+ | | upon the former plan, the newly |
| | StateStore | | | column ID and its sorting |
| +-----------------------------+ | | strategy (asc, desc, none) |
+---->| val sortingChanged: Handler |-----+ +----------------------------------+
+-----------------------------+
+---->| fun renderingRowsData |-----+
| +-----------------------------+ | +----------------------------------+
| +---->| RowSorter (2) |
| +----------------------------------+
| | Takes the current rows and sort |
TableComponent | them according to the column |
.renderRows() | based sorting plan. |
| So the raw ``sortingPlan`` |
| field of the state object must |
| be enriched before with the |
| actual ``Column`` objects by |
| the ``columnSoftingPlan`` |
| function. |
+----------------------------------+
+----------------------------------+
TableComponent ------------------------------------>| SortingRenderer (3) |
.renderHeader() +----------------------------------+
| Renders the UI elements |
| (icons eg.) for configuring |
| and changing the sorting state. |
+----------------------------------+
[Edit](https://textik.com/#f3fc13858b89df9b)This interface defines the reducing process for the sorting plan, that is the creation of a new plan based upon a user input, like clicking on symbol or button (SingleArrowSortingRenderer).
This interface bundles the methods to render the appropriate UI elements for the sorting actions within the header column of a table.
Central class for the dynamic aspects of the column configuration, so the actual state of column meta data in contrast to the row data!
This class is meant for combining the data of one row with the current state specific properties like the sorting strategy or whether the row is currently selected.
Store for the column configuration that holds a State object. It does not manage the actual data of the table; this is done by RowSelectionStore!
This SortingPlanReducer implementation defines the logic to generate a plan with at most one column for sorting. This perfectly matches with the OneColumnSorter implementation for doing the sorting.
Functions
This helper function determines for the inner rendering loop of the cells (td), which cell really needs to be re-rendered! Only changes to the column itself, that is its String representation or its state, requires such a new rendering process.