Package org.opencms.ui.util.table
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
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
ConstructorDescriptionCmsBeanTableBuilder
(Class<T> cls, String view) Creates a new table builder instance for the given bean class and view. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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>
newInstance
(Class<V> cls) 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
setMacroResolver
(CmsMacroResolver resolver) Sets the macro resolver.
-
Constructor Details
-
CmsBeanTableBuilder
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 classview
- the selected view
-
-
Method Details
-
isProbablyMessageKey
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
Convenience method used to create a new instance of a table builder.- Parameters:
cls
- the bean class- Returns:
- the new table builder
-
newInstance
Convenience method used to create a new instance of a table builder.- Parameters:
cls
- the bean classview
- the selected view- Returns:
- the new table builder
-
buildTable
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
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 upbeans
- the beans to display in the table
-
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
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
Sets the macro resolver.- Parameters:
resolver
- the macro resolver
-