Class AbstractListColumnBean<I,V>
- java.lang.Object
-
- 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:
ListColumnAction<I,V>
,Action
- Direct Known Subclasses:
AnyLinkColumn
,PropertyPathActionFactory.PropertyPathAction
,RelatedItemColumn
public abstract class AbstractListColumnBean<I,V> extends Object implements ListColumnAction<I,V>
A simple bean-like implementation of the ListColumn interface. This class is abstract and subclasses must implement theListColumnAction.getValue(DbControl, Object)
method. The default implementation of thegetExportValue(DbControl, Object)
simply copies thegetValue()
result. A subclass that need different values must override thegetExportValue()
method as well.- Since:
- 3.2
- Author:
- Nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private String
clazz
private Enumeration<String,String>
enumeration
private boolean
exportable
private Formatter<?>
exportFormatter
private String
exportProperty
private boolean
filterable
private String
filterProperty
private Formatter<? super V>
formatter
private String
id
private String
property
private boolean
sortable
private String
sortProperty
private String
style
private String
title
private String
tooltip
private Type
valueType
-
Constructor Summary
Constructors Constructor Description AbstractListColumnBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getClazz()
Optional HTML class attribute that is used to style the column through CSS.Enumeration<String,String>
getEnumeration()
Get an enumeration of possible values that can be found in the column.Formatter<?>
getExportFormatter()
Get a formatter that converts the exported value to a string that is written to the file.String
getExportProperty()
Override the default property when this column is used for exporting.Object
getExportValue(DbControl dc, I item)
This implementation simply forward toListColumnAction.getValue(DbControl, Object)
.String
getFilterProperty()
Override the default property when this column is used for filtering.Formatter<? super V>
getFormatter()
Get a formatter that converts the current value to a string that is displayed in the column.String
getId()
ID attribute of the column.String
getProperty()
The property name for referencing data in the column.String
getSortProperty()
Override the default property when this column is used for sorting.String
getStyle()
Optional HTML style attribute that is used to style the column through CSS.String
getTitle()
The column title.String
getTooltip()
An optional tooltip that is displayed when the mouse is over the column header.Type
getValueType()
The data type of the values that are referenced by the property.boolean
isExportable()
A flag to indicate if it is possible to export this column with the generic table exporter or not.boolean
isFilterable()
A flag to indicate if filtering on this column is enabled or not.boolean
isSortable()
A flag to indicate if sorting by this column is enabled for not.void
setClazz(String clazz)
void
setEnumeration(Enumeration<String,String> enumeration)
void
setExportable(boolean exportable)
void
setExportFormatter(Formatter<?> exportFormatter)
void
setExportProperty(String exportProperty)
void
setFilterable(boolean filterable)
void
setFilterProperty(String filterProperty)
void
setFormatter(Formatter<? super V> formatter)
void
setId(String id)
void
setProperty(String property)
void
setSortable(boolean sortable)
void
setSortProperty(String sortProperty)
void
setStyle(String style)
void
setTitle(String title)
void
setTooltip(String tooltip)
void
setValueType(Type valueType)
-
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
getValue
-
-
-
-
Field Detail
-
id
private String id
-
clazz
private String clazz
-
style
private String style
-
title
private String title
-
tooltip
private String tooltip
-
property
private String property
-
valueType
private Type valueType
-
sortable
private boolean sortable
-
sortProperty
private String sortProperty
-
filterable
private boolean filterable
-
filterProperty
private String filterProperty
-
exportable
private boolean exportable
-
exportProperty
private String exportProperty
-
exportFormatter
private Formatter<?> exportFormatter
-
enumeration
private Enumeration<String,String> enumeration
-
-
Method Detail
-
getId
public String 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
public void setId(String id)
-
getClazz
public String 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
public void setClazz(String clazz)
-
getStyle
public String 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
public void setStyle(String style)
-
getTitle
public String getTitle()
Description copied from interface:ListColumnAction
The column title. Required.- Specified by:
getTitle
in interfaceListColumnAction<I,V>
-
setTitle
public void setTitle(String title)
-
getTooltip
public String 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
public void setTooltip(String tooltip)
-
getProperty
public String 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
public void setProperty(String property)
-
getValueType
public Type 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
public void setValueType(Type valueType)
-
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
public String 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
public void setSortProperty(String sortProperty)
-
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
public String 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
public void setFilterProperty(String filterProperty)
-
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
public String 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
public void setExportProperty(String exportProperty)
-
getEnumeration
public Enumeration<String,String> 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
public void setEnumeration(Enumeration<String,String> enumeration)
-
getFormatter
public Formatter<? super V> 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()
-
getExportFormatter
public Formatter<?> 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
public void setExportFormatter(Formatter<?> exportFormatter)
-
getExportValue
public Object getExportValue(DbControl dc, I item)
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
-
-