Class AbstractListColumnBean<I,V>
java.lang.Object
net.sf.basedb.clients.web.extensions.DynamicActionAttributeSupport
net.sf.basedb.clients.web.extensions.list.AbstractListColumnBean<I,V>
- Type Parameters:
I
- The type of items that are listedV
- The type of value that is returned by the getValue() method
- All Implemented Interfaces:
DynamicActionAttributes
,ListColumnAction<I,
,V> Action
- Direct Known Subclasses:
AnyLinkColumn
,PropertyPathActionFactory.PropertyPathAction
,RelatedItemColumn
public abstract class AbstractListColumnBean<I,V>
extends DynamicActionAttributeSupport
implements ListColumnAction<I,V>
A simple bean-like implementation of the ListColumn interface.
This class is abstract and subclasses must implement the
ListColumnAction.getValue(DbControl, Object)
method. The default implementation
of the getExportValue(DbControl, Object)
simply copies the getValue()
result. A subclass that need different
values must override the getExportValue()
method as well.- Since:
- 3.2, 3.20 DynamicActionAttributeSupport
- Author:
- Nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
private String
private String
private Formatter<Collection<? super V>>
private boolean
private Enumeration<String,
String> private boolean
private Formatter<?>
private String
private String
private boolean
private String
private String
private String
private String
private String
private boolean
private String
private String
private String
private String
private String
private Type
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionOptional extra classes to add to table cell (td) tags for this column.Optional extra style definition to add to table cell (td) tags for this column.getClazz()
Optional HTML class attribute that is used to style the column through CSS.Formatter<Collection<? super V>>
Get a formatter that is intended to format a collection of values that have been retrieved from this action.boolean
If set, text overflow check is disabled for this column.Get an enumeration of possible values that can be found in the column.Formatter<?>
Get a formatter that converts the exported value to a string that is written to the file.Override the default property when this column is used for exporting.Alternative column title that should be used when exporting data from a table.getExportValue
(DbControl dc, I item) This implementation simply forward toListColumnAction.getValue(DbControl, Object)
.Extra CSS class to add to the filter table cell.Override the default property when this column is used for filtering.A text to display in the filter cell when the column is not filterable.Get a formatter that converts the current value to a string that is displayed in the column.getId()
ID attribute of the column.The property name for referencing data in the column.Override the default property when this column is used for sorting.getStyle()
Optional HTML style attribute that is used to style the column through CSS.An optional subtitle.getTitle()
The column title.An optional tooltip that is displayed when the mouse is over the column header.The data type of the values that are referenced by the property.boolean
A flag to indicate if it is possible to export this column with the generic table exporter or not.boolean
A flag to indicate if filtering on this column is enabled or not.boolean
A flag to indicate if sorting by this column is enabled for not.void
setCellClass
(String cellClass) void
setCellStyle
(String cellStyle) void
void
setCollectionFormatter
(Formatter<Collection<? super V>> collectionFormatter) void
setDisableOverflowCheck
(boolean disableOverflowCheck) void
setEnumeration
(Enumeration<String, String> enumeration) void
setExportable
(boolean exportable) void
setExportFormatter
(Formatter<?> exportFormatter) void
setExportProperty
(String exportProperty) void
setExportTitle
(String title) void
setFilterable
(boolean filterable) void
setFilterClass
(String filterClass) void
setFilterProperty
(String filterProperty) void
setFilterText
(String filterText) void
setFormatter
(Formatter<? super V> formatter) void
void
setProperty
(String property) void
setSortable
(boolean sortable) void
setSortProperty
(String sortProperty) void
void
setSubtitle
(String subtitle) void
void
setTooltip
(String tooltip) void
setValueType
(Type valueType) Methods inherited from class net.sf.basedb.clients.web.extensions.DynamicActionAttributeSupport
addAttributes, getAttributesString, getDynamicActionAttributes, setDynamicActionAttributesSource, setDynamicAttribute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.basedb.clients.web.extensions.list.ListColumnAction
getDynamicActionAttributes, getValue
-
Field Details
-
id
-
clazz
-
style
-
title
-
subtitle
-
exportTitle
-
cellClass
-
cellStyle
-
disableOverflowCheck
private boolean disableOverflowCheck -
tooltip
-
property
-
valueType
-
sortable
private boolean sortable -
sortProperty
-
filterable
private boolean filterable -
filterProperty
-
filterText
-
filterClass
-
exportable
private boolean exportable -
exportProperty
-
exportFormatter
-
enumeration
-
formatter
-
collectionFormatter
-
-
Constructor Details
-
AbstractListColumnBean
public AbstractListColumnBean()
-
-
Method Details
-
getId
Description copied from interface:ListColumnAction
ID attribute of the column. This is requried and must be a unique id among all columns in the list.- Specified by:
getId
in interfaceListColumnAction<I,
V>
-
setId
-
getClazz
Description copied from interface:ListColumnAction
Optional HTML class attribute that is used to style the column through CSS.- Specified by:
getClazz
in interfaceListColumnAction<I,
V>
-
setClazz
-
getStyle
Description copied from interface:ListColumnAction
Optional HTML style attribute that is used to style the column through CSS.- Specified by:
getStyle
in interfaceListColumnAction<I,
V>
-
setStyle
-
getTitle
Description copied from interface:ListColumnAction
The column title. Required.- Specified by:
getTitle
in interfaceListColumnAction<I,
V>
-
setTitle
-
getExportTitle
Description copied from interface:ListColumnAction
Alternative column title that should be used when exporting data from a table. The default implementation return the regular column title without any HTML markup.- Specified by:
getExportTitle
in interfaceListColumnAction<I,
V>
-
setExportTitle
-
getSubtitle
Description copied from interface:ListColumnAction
An optional subtitle.- Specified by:
getSubtitle
in interfaceListColumnAction<I,
V>
-
setSubtitle
-
getCellClass
Description copied from interface:ListColumnAction
Optional extra classes to add to table cell (td) tags for this column.- Specified by:
getCellClass
in interfaceListColumnAction<I,
V>
-
setCellClass
-
getCellStyle
Description copied from interface:ListColumnAction
Optional extra style definition to add to table cell (td) tags for this column.- Specified by:
getCellStyle
in interfaceListColumnAction<I,
V>
-
setCellStyle
-
getDisableOverflowCheck
public boolean getDisableOverflowCheck()Description copied from interface:ListColumnAction
If set, text overflow check is disabled for this column. If not set, the global settings for the logged in user is used.- Specified by:
getDisableOverflowCheck
in interfaceListColumnAction<I,
V>
-
setDisableOverflowCheck
public void setDisableOverflowCheck(boolean disableOverflowCheck) -
getTooltip
Description copied from interface:ListColumnAction
An optional tooltip that is displayed when the mouse is over the column header.- Specified by:
getTooltip
in interfaceListColumnAction<I,
V>
-
setTooltip
-
getProperty
Description copied from interface:ListColumnAction
The property name for referencing data in the column. This is optional but is needed to enable filtering, sorting and/or exporting.- Specified by:
getProperty
in interfaceListColumnAction<I,
V> - Returns:
- The property or null
-
setProperty
-
getValueType
Description copied from interface:ListColumnAction
The data type of the values that are referenced by the property. Required if a property has been set.- Specified by:
getValueType
in interfaceListColumnAction<I,
V> - Returns:
- The data type of the values
-
setValueType
-
isSortable
public boolean isSortable()Description copied from interface:ListColumnAction
A flag to indicate if sorting by this column is enabled for not. The sort uses the default property unless it has been overridden byListColumnAction.getSortProperty()
.- Specified by:
isSortable
in interfaceListColumnAction<I,
V> - Returns:
- TRUE to enable sorting, FALSE to disable
-
setSortable
public void setSortable(boolean sortable) -
getSortProperty
Description copied from interface:ListColumnAction
Override the default property when this column is used for sorting.- Specified by:
getSortProperty
in interfaceListColumnAction<I,
V> - Returns:
- NULL if the default property should be used for sorting
-
setSortProperty
-
isFilterable
public boolean isFilterable()Description copied from interface:ListColumnAction
A flag to indicate if filtering on this column is enabled or not. The filter uses the default property unless it has been overridden byListColumnAction.getFilterProperty()
.- Specified by:
isFilterable
in interfaceListColumnAction<I,
V> - Returns:
- TRUE to enable filtering, FALSE to disable
-
setFilterable
public void setFilterable(boolean filterable) -
getFilterProperty
Description copied from interface:ListColumnAction
Override the default property when this column is used for filtering.- Specified by:
getFilterProperty
in interfaceListColumnAction<I,
V> - Returns:
- NULL if the default property should be used for filtering
-
setFilterProperty
-
getFilterText
Description copied from interface:ListColumnAction
A text to display in the filter cell when the column is not filterable.- Specified by:
getFilterText
in interfaceListColumnAction<I,
V>
-
setFilterText
-
getFilterClass
Description copied from interface:ListColumnAction
Extra CSS class to add to the filter table cell.- Specified by:
getFilterClass
in interfaceListColumnAction<I,
V>
-
setFilterClass
-
isExportable
public boolean isExportable()Description copied from interface:ListColumnAction
A flag to indicate if it is possible to export this column with the generic table exporter or not. The export uses the default property unless it has been overridden byListColumnAction.getExportProperty()
.- Specified by:
isExportable
in interfaceListColumnAction<I,
V> - Returns:
- TRUE to enable exporting, FALSE to disable
-
setExportable
public void setExportable(boolean exportable) -
getExportProperty
Description copied from interface:ListColumnAction
Override the default property when this column is used for exporting.- Specified by:
getExportProperty
in interfaceListColumnAction<I,
V> - Returns:
- NULL if the default property should be used for exporting
-
setExportProperty
-
getEnumeration
Description copied from interface:ListColumnAction
Get an enumeration of possible values that can be found in the column. This is used to generate a filter with a drop-down containing checkboxes for each option. If no enumeration is specified, a default filter input field is used.- Specified by:
getEnumeration
in interfaceListColumnAction<I,
V>
-
setEnumeration
-
getFormatter
Description copied from interface:ListColumnAction
Get a formatter that converts the current value to a string that is displayed in the column. The string may include HTML that is required for proper display. TheFormatter.format(Object)
method is called once for every item that is listed in the table.- Specified by:
getFormatter
in interfaceListColumnAction<I,
V> - Returns:
- A formatter, or null to simply use
Object.toString()
-
setFormatter
-
getExportFormatter
Description copied from interface:ListColumnAction
Get a formatter that converts the exported value to a string that is written to the file. TheFormatter.format(Object)
method is called once for every item that is listed in the table.- Specified by:
getExportFormatter
in interfaceListColumnAction<I,
V> - Returns:
- A formatter, or null to simply use
Object.toString()
-
setExportFormatter
-
getCollectionFormatter
Description copied from interface:ListColumnAction
Get a formatter that is intended to format a collection of values that have been retrieved from this action. The default implementation will return a formatter that creates a comma-separated string of the individual values where each value is formatted with the formatter fromListColumnAction.getFormatter()
.- Specified by:
getCollectionFormatter
in interfaceListColumnAction<I,
V>
-
setCollectionFormatter
-
getExportValue
This implementation simply forward toListColumnAction.getValue(DbControl, Object)
. If the exported value should be different from the regular value the subclass must override this method as well.- Specified by:
getExportValue
in interfaceListColumnAction<I,
V> - Parameters:
dc
- An open DbControl than can be used to query the databaseitem
- The current item- Returns:
- The value that should be exported
-