Interface TableConfiguration<S>
- Type Parameters:
S- the type of the objects contained within the table's or tree-table's item list
- All Known Implementing Classes:
DefaultTableConfiguration, RdcTableConfiguration
public interface TableConfiguration<S>
Configuration for table and treetable views.
The main purpose is to provide a single object to configure the component.
The main purpose is to provide a single object to configure the component.
- Author:
- harald
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionAdds a column via the binding path.voidaddColumnConfiguration(TableColumnConfiguration<S, ?> columnConfiguration) Adds a column configuration.voidconfigure(FxTableView<S> table) Configures the table.voidconfigure(FxTreeTableView<S> treeTable) Configures the treetable.javafx.scene.control.TreeItem<S> createTreeItem(S object) Creates a tree item for a treetable.Gets the optional resource bundle name.
Used for BundleMonkey navigation only.Gets the table binder.
Don't mix up the table's binder with the FxController's binder!Gets the type of binding.getColumnConfiguration(String name) Gets a column configuration by its name.getColumnConfiguration(javafx.scene.control.TableColumn<S, ?> column) Gets a column configuration by its table column.getColumnConfiguration(javafx.scene.control.TreeTableColumn<S, ?> column) Gets a column configuration by its treetable column.Gets the configurations of the columns.Gets the edit handler.getName()Gets the name of the table.
The name is also used as a key to the table preferences.Gets the row object class.<T> TableCellType<T> getTableCellType(Class<T> type) Gets the cell type according to the item type.default TableFilterSupport<S> installFilterSupport(FxTableView<S> table) Installs a fresh column filter support on a configured table view.
Any support currently installed on the view is uninstalled first.default TableFilterSupport<S> installFilterSupport(FxTreeTableView<S> treeTable) Installs a fresh column filter support on a configured treetable view.
Any support currently installed on the view is uninstalled first.default booleanReturns whether the columns provide a filter UI in their headers.default booleanReturns whether the preferences include the column filters.booleanReturns whether the preferences include the column sorting.booleanReturns whether the preferences include the view size.voidloadPreferences(FxTableView<S> table, String suffix, boolean system) Loads the column sizes, visibility, view size, and sorting from the preferences.voidloadPreferences(FxTreeTableView<S> treeTable, String suffix, boolean system) Loads the column sizes, visibility, view size, and sorting from the preferences.removeColumn(String name) Removes a column via the binding path.voidsavePreferences(FxTableView<S> table, String suffix, boolean system) Saves the column sizes, visibility, view size, and sorting to the preferences.
Sorting, view size and filters are included according toisSortingIncluded(),isViewSizeIncluded()andisFilterIncluded().voidsavePreferences(FxTreeTableView<S> treeTable, String suffix, boolean system) Saves the column sizes, visibility, view size, and sorting to the preferences.
Sorting, view size and filters are included according toisSortingIncluded(),isViewSizeIncluded()andisFilterIncluded().voidsetBaseBundleName(String bundleName) Sets the optional resource bundle name.voidsetBindingType(TableConfiguration.BINDING bindingType) Sets the type of binding.voidsetEditHandler(TableEditHandler<S> editHandler) Sets the edit handler.
The handler controls what happens when a value is entered in a cell: which cells are editable, whether the value is accepted, how the rows are modified, and which cell is edited next.default voidsetFilterEnabled(boolean filterEnabled) Sets whether the columns provide a filter UI in their headers.
Must be set before the view is configured.default voidsetFilterIncluded(boolean filterIncluded) Sets whether the preferences include the column filters.voidsetSortingIncluded(boolean sortingIncluded) Sets whether the preferences include the column sorting.voidsetViewSizeIncluded(boolean viewSizeIncluded) Sets whether the preferences include the view size.
-
Method Details
-
getObjectClass
-
getColumnConfigurations
Collection<TableColumnConfiguration<S,?>> getColumnConfigurations()Gets the configurations of the columns.- Returns:
- the column configurations
-
getColumnConfiguration
Gets a column configuration by its name.- Parameters:
name- the name- Returns:
- the config, null if no such column
-
getColumnConfiguration
Gets a column configuration by its table column.- Parameters:
column- the table column- Returns:
- the config, null if no such column
-
getColumnConfiguration
TableColumnConfiguration<S,?> getColumnConfiguration(javafx.scene.control.TreeTableColumn<S, ?> column) Gets a column configuration by its treetable column.- Parameters:
column- the treetable column- Returns:
- the config, null if no such column
-
getName
String getName()Gets the name of the table.
The name is also used as a key to the table preferences.- Returns:
- the name, never null
-
addColumn
Adds a column via the binding path.- Parameters:
name- the column's binding pathdisplayedName- the displayed column name- Returns:
- the created column configuration
-
removeColumn
Removes a column via the binding path.- Parameters:
name- the column's binding path- Returns:
- the old column configuration, null if no such column
-
addColumnConfiguration
Adds a column configuration.- Parameters:
columnConfiguration- the config
-
savePreferences
Saves the column sizes, visibility, view size, and sorting to the preferences.
Sorting, view size and filters are included according toisSortingIncluded(),isViewSizeIncluded()andisFilterIncluded(). The preference node is the table's name, the optional suffix, and the current locale.- Parameters:
table- the tablesuffix- the configuration suffix, null if nonesystem- true if save to system prefs, else user prefs
-
loadPreferences
Loads the column sizes, visibility, view size, and sorting from the preferences.- Parameters:
table- the tablesuffix- the configuration suffix, null if nonesystem- true if load from system prefs only, else user prefs first
-
savePreferences
Saves the column sizes, visibility, view size, and sorting to the preferences.
Sorting, view size and filters are included according toisSortingIncluded(),isViewSizeIncluded()andisFilterIncluded(). The preference node is the table's name, the optional suffix, and the current locale.- Parameters:
treeTable- the treetablesuffix- the configuration suffix, null if nonesystem- true if save to system prefs, else user prefs
-
loadPreferences
Loads the column sizes, visibility, view size, and sorting from the preferences.- Parameters:
treeTable- the treetablesuffix- the configuration suffix, null if nonesystem- true if load from system prefs only, else user prefs first
-
isSortingIncluded
boolean isSortingIncluded()Returns whether the preferences include the column sorting.- Returns:
- true if sorting is restored from the preferences (default is false)
-
setSortingIncluded
void setSortingIncluded(boolean sortingIncluded) Sets whether the preferences include the column sorting.- Parameters:
sortingIncluded- true if sorting is restored from the preferences (default is false)
-
isFilterEnabled
default boolean isFilterEnabled()Returns whether the columns provide a filter UI in their headers.- Returns:
- true if the columns can be filtered by the user (default is false)
- See Also:
-
setFilterEnabled
default void setFilterEnabled(boolean filterEnabled) Sets whether the columns provide a filter UI in their headers.
Must be set before the view is configured. To turn the feature on or off after the view has been configured, useFxTableView.setFilterEnabled(boolean)respectivelyFxTreeTableView.setFilterEnabled(boolean).- Parameters:
filterEnabled- true if the columns can be filtered by the user (default is false)
-
installFilterSupport
Installs a fresh column filter support on a configured table view.
Any support currently installed on the view is uninstalled first. Invoked byFxTableView.setFilterEnabled(boolean)to enable the feature after configuration.- Parameters:
table- the table view, already configured with this configuration- Returns:
- the installed filter support, null if filtering is not supported
-
installFilterSupport
Installs a fresh column filter support on a configured treetable view.
Any support currently installed on the view is uninstalled first. Invoked byFxTreeTableView.setFilterEnabled(boolean)to enable the feature after configuration.- Parameters:
treeTable- the treetable view, already configured with this configuration- Returns:
- the installed filter support, null if filtering is not supported
-
isFilterIncluded
default boolean isFilterIncluded()Returns whether the preferences include the column filters.- Returns:
- true if the filters are restored from the preferences (default is false)
-
setFilterIncluded
default void setFilterIncluded(boolean filterIncluded) Sets whether the preferences include the column filters.- Parameters:
filterIncluded- true if the filters are restored from the preferences (default is false)
-
isViewSizeIncluded
boolean isViewSizeIncluded()Returns whether the preferences include the view size.- Returns:
- true if the preferred size is restored from the preferences (default is true)
-
setViewSizeIncluded
void setViewSizeIncluded(boolean viewSizeIncluded) Sets whether the preferences include the view size.- Parameters:
viewSizeIncluded- true if the preferred size is restored from the preferences (default is true)
-
getBindingType
-
setBindingType
Sets the type of binding.- Parameters:
bindingType- the binding type
-
getBinder
FxTableBinder<S> getBinder()Gets the table binder.
Don't mix up the table's binder with the FxController's binder! The table binder is responsible for binding the cells to the model, whereas the controller binder binds the data list to the table.
As a consequence, binding properties such as the DomainContext, if necessary for cell editors, must be applied to the table binder!- Returns:
- the binder
-
getEditHandler
TableEditHandler<S> getEditHandler()Gets the edit handler.- Returns:
- the handler, null if none (default)
-
setEditHandler
Sets the edit handler.
The handler controls what happens when a value is entered in a cell: which cells are editable, whether the value is accepted, how the rows are modified, and which cell is edited next. SeeFxFactoryfor the handlers covering the common use cases:FxFactory.simpleTableEditHandler()ends editing after a commit,FxFactory.rowWiseTableEditHandler()continues with the next cell in the row andFxFactory.columnWiseTableEditHandler()with the cell below.With a handler, all columns become editable, except those explicitly configured as not editable. Without a handler, only the columns explicitly configured as editable can be edited.
Must be set before the view is configured.
- Parameters:
editHandler- the handler, null if none
-
configure
-
configure
Configures the treetable.- Parameters:
treeTable- the treetable view
-
getTableCellType
Gets the cell type according to the item type.- Type Parameters:
T- the item type- Parameters:
type- the item class- Returns:
- the cell type, never null
-
createTreeItem
-
getBaseBundleName
String getBaseBundleName()Gets the optional resource bundle name.
Used for BundleMonkey navigation only.- Returns:
- the bundle name, null if unknown
-
setBaseBundleName
Sets the optional resource bundle name.- Parameters:
bundleName- the bundle name, null if none
-