Class 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 with Persistent) gets its own column, except the default attributes from PersistentObject and object ids for object relations.
      static TableUtilities getInstance()
      The singleton.
      void print​(org.tentackle.fx.component.FxTableView<?> table, java.lang.String title)
      Prints a table view.
      Tables need a special handling for multiple pages.
      java.io.File selectSpreadsheetFile​(java.lang.String tableName, javafx.stage.Stage owner)
      Selects the spreadsheet file.
      java.io.File selectXmlFile​(java.lang.String tableName, javafx.stage.Stage owner)
      Selects the XML file.
      <S> void toSpreadsheet​(org.tentackle.fx.component.FxTableView<S> table, java.io.File file, boolean onlySelected)
      Converts the table to a spreadsheet file.
      <S> void toXml​(org.tentackle.fx.component.FxTableView<S> table, java.io.File file, boolean onlySelected)
      Exports a table to an XML file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TableUtilities

        public TableUtilities()
    • 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 with Persistent) gets its own column, except the default attributes from PersistentObject and object ids for object relations.
        Type Parameters:
        T - the PDO type
        Parameters:
        pdoClass - the PDO class
        bundle - 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 name
        owner - 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 name
        owner - 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 view
        file - the output file
        onlySelected - 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 view
        file - the output file
        onlySelected - 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 print
        title - the optional title, null if take from table's configuration