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 listed
V - 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 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
Author:
Nicklas
  • Field Details

    • id

      private String id
    • clazz

      private String clazz
    • style

      private String style
    • title

      private String title
    • subtitle

      private String subtitle
    • cellClass

      private String cellClass
    • cellStyle

      private String cellStyle
    • disableOverflowCheck

      private boolean disableOverflowCheck
    • 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
    • formatter

      private Formatter<? super V> formatter
    • collectionFormatter

      private Formatter<Collection<? super V>> collectionFormatter
  • Constructor Details

    • AbstractListColumnBean

      public AbstractListColumnBean()
  • Method Details

    • 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 interface ListColumnAction<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 interface ListColumnAction<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 interface ListColumnAction<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 interface ListColumnAction<I,​V>
    • setTitle

      public void setTitle​(String title)
    • getSubtitle

      public String getSubtitle()
      Description copied from interface: ListColumnAction
      An optional subtitle.
      Specified by:
      getSubtitle in interface ListColumnAction<I,​V>
    • setSubtitle

      public void setSubtitle​(String subtitle)
    • getCellClass

      public String getCellClass()
      Description copied from interface: ListColumnAction
      Optional extra classes to add to table cell (td) tags for this column.
      Specified by:
      getCellClass in interface ListColumnAction<I,​V>
    • setCellClass

      public void setCellClass​(String cellClass)
    • getCellStyle

      public String getCellStyle()
      Description copied from interface: ListColumnAction
      Optional extra style definition to add to table cell (td) tags for this column.
      Specified by:
      getCellStyle in interface ListColumnAction<I,​V>
    • setCellStyle

      public void setCellStyle​(String cellStyle)
    • 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 interface ListColumnAction<I,​V>
    • setDisableOverflowCheck

      public void setDisableOverflowCheck​(boolean disableOverflowCheck)
    • 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 interface ListColumnAction<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 interface ListColumnAction<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 interface ListColumnAction<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 by ListColumnAction.getSortProperty().
      Specified by:
      isSortable in interface ListColumnAction<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 interface ListColumnAction<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 by ListColumnAction.getFilterProperty().
      Specified by:
      isFilterable in interface ListColumnAction<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 interface ListColumnAction<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 by ListColumnAction.getExportProperty().
      Specified by:
      isExportable in interface ListColumnAction<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 interface ListColumnAction<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 interface ListColumnAction<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. The Formatter.format(Object) method is called once for every item that is listed in the table.
      Specified by:
      getFormatter in interface ListColumnAction<I,​V>
      Returns:
      A formatter, or null to simply use Object.toString()
    • setFormatter

      public void setFormatter​(Formatter<? super V> formatter)
    • 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. The Formatter.format(Object) method is called once for every item that is listed in the table.
      Specified by:
      getExportFormatter in interface ListColumnAction<I,​V>
      Returns:
      A formatter, or null to simply use Object.toString()
    • setExportFormatter

      public void setExportFormatter​(Formatter<?> exportFormatter)
    • getCollectionFormatter

      public Formatter<Collection<? super V>> 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 from ListColumnAction.getFormatter().
      Specified by:
      getCollectionFormatter in interface ListColumnAction<I,​V>
    • setCollectionFormatter

      public void setCollectionFormatter​(Formatter<Collection<? super V>> collectionFormatter)
    • getExportValue

      public Object getExportValue​(DbControl dc, I item)
      This implementation simply forward to ListColumnAction.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 interface ListColumnAction<I,​V>
      Parameters:
      dc - An open DbControl than can be used to query the database
      item - The current item
      Returns:
      The value that should be exported