Class CmsBeanTableBuilder<T>

java.lang.Object
org.opencms.ui.util.table.CmsBeanTableBuilder<T>
Type Parameters:
T - The class of the bean containing the metadata of the table

public class CmsBeanTableBuilder<T> extends Object
Builds a table based on a given bean class.

The columns of the table correspond to getters of the given bean class with the Column annotation.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new table builder instance for the given bean class and view.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    buildTable(com.vaadin.v7.ui.Table table, List<T> beans)
    Sets up a table and uses the given beans to fill its rows, but does not actually create the table instance; it uses the passed in table instance instead.
    com.vaadin.v7.ui.Table
    buildTable(List<T> beans)
    Builds a table and uses the given beans to fill its rows.
    com.vaadin.v7.ui.Table.CellStyleGenerator
    Creates a default cell style generator which just returns the value of the styleName attribute in a Column annotation for cells in that column.
    com.vaadin.v7.data.Container.Filter
    getDefaultFilter(String filterString)
    Creates a default filter which just searches the lower case version of the result of the toString() method applied to all columns with the annotation attribute filterable = true.
    Gets the macro resolver which is used for column headers.
    static boolean
    Checks if the given string is likely a message key.
    static <V> CmsBeanTableBuilder<V>
    Convenience method used to create a new instance of a table builder.
    static <V> CmsBeanTableBuilder<V>
    newInstance(Class<V> cls, String view)
    Convenience method used to create a new instance of a table builder.
    void
    Sets the macro resolver.

    Methods inherited from class java.lang.Object

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

    • CmsBeanTableBuilder

      public CmsBeanTableBuilder(Class<T> cls, String view)
      Creates a new table builder instance for the given bean class and view.

      Depending on the view configuration of the columns, columns may be hidden depending on the view.

      Parameters:
      cls - the bean class
      view - the selected view
  • Method Details

    • isProbablyMessageKey

      public static boolean isProbablyMessageKey(String str)
      Checks if the given string is likely a message key.

      Parameters:
      str - the input string
      Returns:
      true if this is probably a message key
    • newInstance

      public static <V> CmsBeanTableBuilder<V> newInstance(Class<V> cls)
      Convenience method used to create a new instance of a table builder.

      Parameters:
      cls - the bean class
      Returns:
      the new table builder
    • newInstance

      public static <V> CmsBeanTableBuilder<V> newInstance(Class<V> cls, String view)
      Convenience method used to create a new instance of a table builder.

      Parameters:
      cls - the bean class
      view - the selected view
      Returns:
      the new table builder
    • buildTable

      public com.vaadin.v7.ui.Table buildTable(List<T> beans)
      Builds a table and uses the given beans to fill its rows.

      Parameters:
      beans - the beans to display in the table
      Returns:
      the finished table
    • buildTable

      public void buildTable(com.vaadin.v7.ui.Table table, List<T> beans)
      Sets up a table and uses the given beans to fill its rows, but does not actually create the table instance; it uses the passed in table instance instead.

      Parameters:
      table - the table to set up
      beans - the beans to display in the table
    • getDefaultCellStyleGenerator

      public com.vaadin.v7.ui.Table.CellStyleGenerator getDefaultCellStyleGenerator()
      Creates a default cell style generator which just returns the value of the styleName attribute in a Column annotation for cells in that column.

      Returns:
      the default cell style generator
    • getDefaultFilter

      public com.vaadin.v7.data.Container.Filter getDefaultFilter(String filterString)
      Creates a default filter which just searches the lower case version of the result of the toString() method applied to all columns with the annotation attribute filterable = true.

      Parameters:
      filterString - the string for which to filter
      Returns:
      the default filter for the given filter string
    • getMacroResolver

      Gets the macro resolver which is used for column headers.

      Returns:
      the macro resolver for column headers
    • setMacroResolver

      public void setMacroResolver(CmsMacroResolver resolver)
      Sets the macro resolver.

      Parameters:
      resolver - the macro resolver