-
- Type Parameters:
S- the type of the objects contained within the table's items list
- All Known Implementing Classes:
DefaultTableConfiguration
public interface TableConfiguration<S>Configuration for a table view.
The main purpose is to provide a single object to configure the table view.- Author:
- harald
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTableConfiguration.BINDINGType of binding.static classTableConfiguration.EDITMODEEdit mode.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TableColumnConfiguration<S,?>addColumn(java.lang.String name, java.lang.String displayedName)Adds a column via binding path.voidaddColumnConfiguration(TableColumnConfiguration<S,?> columnConfiguration)Adds a column configuration.voidconfigure(FxTableView<S> table)Configures the table.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 to bind 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!TableConfiguration.BINDINGgetBindingType()Gets the type of binding.<T> TableCellType<T>getCellType(java.lang.Class<T> type)Gets the cell type according to the item type.TableColumnConfiguration<S,?>getColumnConfiguration(java.lang.String name)Gets a column configuration by its name.TableColumnConfiguration<S,?>getColumnConfiguration(javafx.scene.control.TableColumn<S,?> column)Gets a column configuration by its table column.java.util.Collection<TableColumnConfiguration<S,?>>getColumnConfigurations()Gets the configurations of the columns.TableConfiguration.EDITMODEgetEditMode()Returns the edit mode.java.lang.StringgetName()Gets the name of the table.
The name is also used as a key to the table preferences.java.lang.Class<S>getObjectClass()Gets the row object class.booleanisSortingIncluded()Returns whether the preferences include the column sorting.booleanisViewSizeIncluded()Returns whether the preferences include the view size.voidloadPreferences(FxTableView<S> table, java.lang.String suffix, boolean system)Loads the column sizes, visability, view size and sorting from the preferences.TableColumnConfiguration<S,?>removeColumn(java.lang.String name)Removes a column via binding path.voidsavePreferences(FxTableView<S> table, java.lang.String suffix, boolean system)Saves the column sizes, visability, view size and sorting to the preferences.voidsetBindingType(TableConfiguration.BINDING bindingType)Sets the type of binding.voidsetEditMode(TableConfiguration.EDITMODE editMode)Sets the edit mode.voidsetSortingIncluded(boolean sortingIncluded)Sets whether the preferences include the column sorting.voidsetViewSizeIncluded(boolean viewSizeIncluded)Sets whether the preferences include the view size.
-
-
-
Method Detail
-
getObjectClass
java.lang.Class<S> getObjectClass()
Gets the row object class.- Returns:
- the row object class
-
getColumnConfigurations
java.util.Collection<TableColumnConfiguration<S,?>> getColumnConfigurations()
Gets the configurations of the columns.- Returns:
- the column configurations
-
getColumnConfiguration
TableColumnConfiguration<S,?> getColumnConfiguration(java.lang.String name)
Gets a column configuration by its name.- Parameters:
name- the name- Returns:
- the config, null if no such name and displayed name
-
getColumnConfiguration
TableColumnConfiguration<S,?> getColumnConfiguration(javafx.scene.control.TableColumn<S,?> column)
Gets a column configuration by its table column.- Parameters:
column- the table column- Returns:
- the config, null if no such column
-
getName
java.lang.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
TableColumnConfiguration<S,?> addColumn(java.lang.String name, java.lang.String displayedName)
Adds a column via binding path.- Parameters:
name- the column's binding pathdisplayedName- the displayed column name- Returns:
- the created column configuration
-
removeColumn
TableColumnConfiguration<S,?> removeColumn(java.lang.String name)
Removes a column via binding path.- Parameters:
name- the column's binding path- Returns:
- the old column configuration, null if no such column
-
addColumnConfiguration
void addColumnConfiguration(TableColumnConfiguration<S,?> columnConfiguration)
Adds a column configuration.- Parameters:
columnConfiguration- the config
-
savePreferences
void savePreferences(FxTableView<S> table, java.lang.String suffix, boolean system)
Saves the column sizes, visability, view size and sorting to the preferences.- Parameters:
table- the tablesuffix- the configuration suffix, null if nonesystem- true if save to system prefs, else user prefs
-
loadPreferences
void loadPreferences(FxTableView<S> table, java.lang.String suffix, boolean system)
Loads the column sizes, visability, 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
-
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)
-
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
TableConfiguration.BINDING getBindingType()
Gets the type of binding.- Returns:
- the binding type
-
setBindingType
void setBindingType(TableConfiguration.BINDING bindingType)
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 to bind 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
-
getEditMode
TableConfiguration.EDITMODE getEditMode()
Returns the edit mode.- Returns:
- the edit mode, never null, default is NO
-
setEditMode
void setEditMode(TableConfiguration.EDITMODE editMode)
Sets the edit mode.- Parameters:
editMode- the edit mode, null is equivalent to NO
-
configure
void configure(FxTableView<S> table)
Configures the table.- Parameters:
table- the table view
-
getCellType
<T> TableCellType<T> getCellType(java.lang.Class<T> type)
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
-
-