java.lang.Object
org.tentackle.fx.rdc.table.TableUtilities
Table-related utility methods.
- Author:
- harald
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends PersistentDomainObject<T>>
TableConfiguration<T>createTableConfiguration(Class<T> pdoClass, ResourceBundle bundle) Creates a default table configuration for a given PDO class.
Each attribute getter (annotated withPersistent) gets its own column, except the default attributes fromPersistentObjectand object ids for object relations.static TableUtilitiesThe singleton.booleanisColumnVisible(TableColumnConfiguration<?, ?> columnConfiguration) Returns whether a column is visible.voidprint(FxTableView<?> table, String title) Prints a table view.
Tables need a special handling for multiple pages.voidprint(FxTreeTableView<?> treeTable, String title) Prints a tree table view.
Tables need a special handling for multiple pages.selectSpreadsheetFile(String tableName, javafx.stage.Stage owner) Selects the spreadsheet file.selectXmlFile(String tableName, javafx.stage.Stage owner) Selects the XML file.protected <S> voidtoSpreadsheet(Collection<TableColumnConfiguration<S, ?>> columnConfigurations, File file, List<S> items) Converts the column configurations to a spreadsheet file.<S> voidtoSpreadsheet(FxTableView<S> table, File file, boolean onlySelected) Converts the table to a spreadsheet file.<S> voidtoSpreadsheet(FxTreeTableView<S> treeTable, File file, boolean onlySelected) Converts the treetable to a spreadsheet file.<S> voidtoXml(FxTableView<S> table, File file, boolean onlySelected) Exports a table to an XML file.<S> voidtoXml(FxTreeTableView<S> treeTable, File file, boolean onlySelected) Exports a treetable to an XML file.
-
Constructor Details
-
TableUtilities
public TableUtilities()
-
-
Method Details
-
getInstance
The singleton.- Returns:
- the singleton
-
createTableConfiguration
public <T extends PersistentDomainObject<T>> TableConfiguration<T> createTableConfiguration(Class<T> pdoClass, ResourceBundle bundle) Creates a default table configuration for a given PDO class.
Each attribute getter (annotated withPersistent) gets its own column, except the default attributes fromPersistentObjectand object ids for object relations.- Type Parameters:
T- the PDO type- Parameters:
pdoClass- the PDO classbundle- optional bundle to determine the displayed column names, null if name is attribute name- Returns:
- the table configuration
-
selectSpreadsheetFile
Selects the spreadsheet file.- Parameters:
tableName- the configured table nameowner- the window owner for the selection dialog, null if none- Returns:
- the selected file, null if aborted
-
selectXmlFile
Selects the XML file.- Parameters:
tableName- the configured table nameowner- the window owner for the selection dialog, null if none- Returns:
- the selected file, null if aborted
-
toSpreadsheet
Converts the table to a spreadsheet file.- Type Parameters:
S- the row type- Parameters:
table- the table viewfile- the output fileonlySelected- true if export only selected rows
-
toSpreadsheet
Converts the treetable to a spreadsheet file.- Type Parameters:
S- the row type- Parameters:
treeTable- the table viewfile- the output fileonlySelected- true if export only selected rows
-
toSpreadsheet
protected <S> void toSpreadsheet(Collection<TableColumnConfiguration<S, ?>> columnConfigurations, File file, List<S> items) Converts the column configurations to a spreadsheet file.- Type Parameters:
S- the row type- Parameters:
columnConfigurations- the column configurerationsfile- the output fileitems- the items to export
-
isColumnVisible
Returns whether a column is visible.- Parameters:
columnConfiguration- the column configuration- Returns:
- true if visible
-
toXml
Exports a table to an XML file.- Type Parameters:
S- the row type- Parameters:
table- the table viewfile- the output fileonlySelected- true if export only selected rows
-
toXml
Exports a treetable to an XML file.- Type Parameters:
S- the row type- Parameters:
treeTable- the treetable viewfile- the output fileonlySelected- true if export only selected rows
-
print
Prints a table view.
Tables need a special handling for multiple pages.- Parameters:
table- the table to printtitle- the optional title, null if take from table's configuration
-
print
Prints a tree table view.
Tables need a special handling for multiple pages.- Parameters:
treeTable- the treetable to printtitle- the optional title, null if take from treetable's configuration
-