2.17.2: 2011-06-17

net.sf.basedb.clients.web.taglib.table
Class ColumnDef

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by net.sf.basedb.clients.web.taglib.table.ColumnDef
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag

public class ColumnDef
extends TagSupport

This tag defines a column in the table. It should be placed directly after the <tbl:table> tag.

Syntax:

   <tbl:columndef
      id=...
      clazz=...
      style=...
      property=...
      sortproperty=...
      filterproperty=...
      exportproperty=...
      datatype=int|long|float|double|string|date|boolean
      collection=true|false
      annotation=true|false
      enum=...
      enumeration=...
      smartenum=true|false
      title=...
      sortable=true|false
      filterable=true|false
      exportable=true|false
      show=always|never|auto
      tooltip=...
      formatter=...
      unit=...
   >

Attribute Default value Required Description
id - yes The ID of the column. Should be unique among the columns in the table. Do not use all as an ID since it is has a special meaning. The value of this attribute goes directly into the standard HTML id attribute. This means that if you need a reference to the table object in your own JavaScript code, you may for example use the following code:
column = document.getElementById('<id>');
The ID is also used for cross-referencing between the different tags. For example, <tbl:data columns="..."> and <tbl:cell column="...">.
clazz columnheader no The value if this attribute goes directly into the standard HTML class attribute. This allows you to apply different styles to different tables.
style - no The value if this attribute goes directly into the standard HTML style attribute. This allows you to apply different styles to different tables.
property - no The name of the property on the item objects of this column. If the property isn't a property of the root item, prepend the value with a dollar sign ($) to indicate that the root alias should not be used when using this property in a query.
sortproperty - no The name of the property to sort on when sorting on this column. If not specified, it takes the same value as the property value.
filterproperty - no The name of the property to filter on when filtering on this column. If not specified, it takes the same value as the property value.
exportproperty - no The name of the property to export on when exporting on this column. If not specified, it takes the same value as the property value.
collection false no If the property can contain a collection of values or only a single value.
title - no The title of the column. The value is displayed in the header row.
sortable false no If the table can be sorted by this column or not. If a true value is specified the title will be linked to a function that resubmits the page with the new sort order information.
filterable false no If the table can be filtered by this column or not.
exportable no no If values in this column can be exported or not.
show auto no Specify if this column should be visible or hidden. If the value is always the column is always shown, if the value is never the column is never shown, if the value is auto it is only shown if it appears in the columns attribute of the <tbl:data> tag.
enumeration - no A Enumeration<String, String> object containing the possible values of this property. This is used to generate a selection list for the filter.
smartenum false (true for annotations) no If the filter for an enumeration column should be displayed as a free text field or a selection list. Default is to use a selection list. Use this option only if both the hidden key and the displayed value of the enumeration is the same. The "smartness" of this options is that as the user types text, the browser will dynamically display a list of options matching the entered text.
multiple true no If it should be possible to select multiple options for an 'enumeration' or only a single option. The default value is true.
formatter - no A Formatter that formats the values in this column. If no formatter is specified the value is ouput as is. Values that should be formated must be specified in the <cell value="..."> attribute. Any tag content is outputted as entered.
unit - no An options Unit object that should be unit the values are stored with in the database. Setting this property enables filter expressions with units.

This tag has no subtags.

Version:
2.0
Author:
Nicklas
See Also:
Serialized Form

Field Summary
private  String clazz
          Optional class attribute
private  String dataType
          The type of data in the property.
private  Enumeration<String,String> enumeration
           
private  boolean exportable
          If the column is exportable or not
private  String exportProperty
          Optional property used for exporting.
private  boolean filterable
          If the column is filterable or not
private  String filterProperty
          Optional property used for filtering.
private  Formatter<?> formatter
           
private  boolean isAnnotation
          If the property is an annotation or not.
private  boolean isCollection
          If the property is a collection or not.
private  String jsEnum
          Options for enum.
private  boolean multiple
           
private  String property
          The name of the property on the item class.
private static long serialVersionUID
           
private  String show
          If the column should be visible or not.
private  boolean smartEnum
           
private  boolean sortable
          If the column is sortable or not
private  String sortProperty
          Optional property used for sorting.
private  String style
          Optional style attribute
private  Table table
          The parent <tbl:table> tag.
private  String title
          The title of the column.
private  String tooltip
          A tooltip with explaining text.
private  Unit unit
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ColumnDef()
           
 
Method Summary
private  void appendPermissionOption(StringBuilder sb, Permission selected, Permission toAdd, String display)
           
 int doStartTag()
           
 String getClazz()
           
 String getDatatype()
           
 String getEnum()
           
 Enumeration<String,String> getEnumeration()
           
 String getExportproperty()
           
 String getFilterproperty()
           
 Formatter<?> getFormatter()
           
 String getProperty()
           
 String getShow()
           
 String getSortproperty()
           
 String getStyle()
           
 String getTitle()
           
 String getTooltip()
           
 Unit getUnit()
           
 Type getValueType()
           
 boolean isAnnotation()
           
 boolean isCollection()
           
 boolean isExportable()
           
 boolean isFilterable()
           
 boolean isSortable()
           
 void setAnnotation(boolean isAnnotation)
           
 void setClazz(String clazz)
           
 void setCollection(boolean isCollection)
           
 void setDatatype(String dataType)
           
 void setEnum(String jsEnum)
           
 void setEnumeration(Enumeration<String,String> enumeration)
           
 void setExportable(boolean exportable)
           
 void setExportproperty(String exportProperty)
           
 void setFilterable(boolean filterable)
           
 void setFilterproperty(String filterProperty)
           
 void setFormatter(Formatter<?> formatter)
           
 void setMultiple(boolean multiple)
           
 void setProperty(String property)
           
 void setShow(String show)
           
 void setSmartenum(boolean smartEnum)
           
 void setSortable(boolean sortable)
           
 void setSortproperty(String sortProperty)
           
 void setStyle(String style)
           
 void setTitle(String title)
           
 void setTooltip(String tooltip)
           
 void setUnit(Unit unit)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

table

private Table table
The parent <tbl:table> tag.


clazz

private String clazz
Optional class attribute


style

private String style
Optional style attribute


property

private String property
The name of the property on the item class.


isCollection

private boolean isCollection
If the property is a collection or not.


isAnnotation

private boolean isAnnotation
If the property is an annotation or not.


sortProperty

private String sortProperty
Optional property used for sorting.


filterProperty

private String filterProperty
Optional property used for filtering.


exportProperty

private String exportProperty
Optional property used for exporting.


dataType

private String dataType
The type of data in the property.


title

private String title
The title of the column.


show

private String show
If the column should be visible or not. Valid values are: always, never, auto


sortable

private boolean sortable
If the column is sortable or not


filterable

private boolean filterable
If the column is filterable or not


exportable

private boolean exportable
If the column is exportable or not


tooltip

private String tooltip
A tooltip with explaining text.


jsEnum

private String jsEnum
Options for enum.


enumeration

private Enumeration<String,String> enumeration

smartEnum

private boolean smartEnum

multiple

private boolean multiple

formatter

private transient Formatter<?> formatter

unit

private transient Unit unit
Constructor Detail

ColumnDef

public ColumnDef()
Method Detail

setClazz

public void setClazz(String clazz)

getClazz

public String getClazz()

setStyle

public void setStyle(String style)

getStyle

public String getStyle()

setProperty

public void setProperty(String property)

getProperty

public String getProperty()

setCollection

public void setCollection(boolean isCollection)

isCollection

public boolean isCollection()

setAnnotation

public void setAnnotation(boolean isAnnotation)

isAnnotation

public boolean isAnnotation()

setSortproperty

public void setSortproperty(String sortProperty)

getSortproperty

public String getSortproperty()

setFilterproperty

public void setFilterproperty(String filterProperty)

getFilterproperty

public String getFilterproperty()

setExportproperty

public void setExportproperty(String exportProperty)

getExportproperty

public String getExportproperty()

setDatatype

public void setDatatype(String dataType)

getDatatype

public String getDatatype()

getValueType

public Type getValueType()

setTitle

public void setTitle(String title)

getTitle

public String getTitle()

setShow

public void setShow(String show)

getShow

public String getShow()

setSortable

public void setSortable(boolean sortable)

isSortable

public boolean isSortable()

setFilterable

public void setFilterable(boolean filterable)

isFilterable

public boolean isFilterable()

setExportable

public void setExportable(boolean exportable)

isExportable

public boolean isExportable()

setTooltip

public void setTooltip(String tooltip)

getTooltip

public String getTooltip()

setEnum

public void setEnum(String jsEnum)

getEnum

public String getEnum()

setEnumeration

public void setEnumeration(Enumeration<String,String> enumeration)

getEnumeration

public Enumeration<String,String> getEnumeration()

setMultiple

public void setMultiple(boolean multiple)
Since:
2.8

setSmartenum

public void setSmartenum(boolean smartEnum)
Since:
2.7

setFormatter

public void setFormatter(Formatter<?> formatter)

getFormatter

public Formatter<?> getFormatter()

setUnit

public void setUnit(Unit unit)
Since:
2.9

getUnit

public Unit getUnit()
Since:
2.9

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Throws:
JspException

appendPermissionOption

private void appendPermissionOption(StringBuilder sb,
                                    Permission selected,
                                    Permission toAdd,
                                    String display)

2.17.2: 2011-06-17