- java.lang.Object
-
- org.tentackle.fx.rdc.table.TableUtilities
-
@Service(TableUtilities.class) public class TableUtilities extends java.lang.Object
Table-related utility methods.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description TableUtilities()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends org.tentackle.pdo.PersistentDomainObject<T>>
org.tentackle.fx.table.TableConfiguration<T>createTableConfiguration(java.lang.Class<T> pdoClass, java.util.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 TableUtilitiesgetInstance()The singleton.voidprint(org.tentackle.fx.component.FxTableView<?> table, java.lang.String title)Prints a table view.
Tables need a special handling for multiple pages.java.io.FileselectSpreadsheetFile(java.lang.String tableName, javafx.stage.Stage owner)Selects the spreadsheet file.java.io.FileselectXmlFile(java.lang.String tableName, javafx.stage.Stage owner)Selects the XML file.<S> voidtoSpreadsheet(org.tentackle.fx.component.FxTableView<S> table, java.io.File file, boolean onlySelected)Converts the table to a spreadsheet file.<S> voidtoXml(org.tentackle.fx.component.FxTableView<S> table, java.io.File file, boolean onlySelected)Exports a table to an XML file.
-
-
-
Method Detail
-
getInstance
public static TableUtilities getInstance()
The singleton.- Returns:
- the singleton
-
createTableConfiguration
public <T extends org.tentackle.pdo.PersistentDomainObject<T>> org.tentackle.fx.table.TableConfiguration<T> createTableConfiguration(java.lang.Class<T> pdoClass, java.util.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
public java.io.File selectSpreadsheetFile(java.lang.String tableName, javafx.stage.Stage owner)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
public java.io.File selectXmlFile(java.lang.String tableName, javafx.stage.Stage owner)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
public <S> void toSpreadsheet(org.tentackle.fx.component.FxTableView<S> table, java.io.File file, boolean onlySelected)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
-
toXml
public <S> void toXml(org.tentackle.fx.component.FxTableView<S> table, java.io.File file, boolean onlySelected)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
-
print
public void print(org.tentackle.fx.component.FxTableView<?> table, java.lang.String title)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
-
-