Class ColumnDef
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
net.sf.basedb.clients.web.taglib.StylableTag
net.sf.basedb.clients.web.taglib.table.ColumnDef
- All Implemented Interfaces:
Serializable
,DynamicAttributes
,IterationTag
,JspTag
,Tag
,DynamicActionAttributes
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 annotation=true|false enumeration=... smartenum=true|false title=... sortable=true|false filterable=true|false exportable=true|false show=always|never|auto tooltip=... formatter=... unit=... subtitle=... >
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.
|
title | - | no | The title of the column. The value is displayed in the header row. |
title | - | no | As subtitle of the column. The value is displayed in a header row below the filter 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 | 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:
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Iterator implementation that returns a single null value and nothing more. -
Field Summary
Modifier and TypeFieldDescriptionprivate Enumeration<String,
String> Options for enum.private boolean
If the column is exportable or notprivate String
Optional property used for exporting.private String
Alternate title to use when exporting.private ExtensionsInvoker<ListColumnAction<?,
?>> private boolean
If the column is filterable or notprivate String
Extra CSS class to add to the filter table cell.private String
Optional property used for filtering.private String
Text to display in the filter cell when the column is not filterable.private Formatter<?>
private boolean
If the property is an annotation or not.private JspContext
private boolean
private String
The name of the property on the item class.private static final long
private String
If the column should be visible or not.private boolean
private boolean
If the column is sortable or notprivate String
Optional property used for sorting.private String
The subtitle of the column.private Table
The parent <tbl:table> tag.private String
The title of the column.private String
A tooltip with explaining text.private Unit
private Type
The type of data in the property.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
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
appendPermissionOption
(StringBuilder sb, Permission selected, Permission toAdd, String display) org.json.simple.JSONObject
Get a JSON representation of this column definition.int
Formatter<?>
protected String
Optional prefix to include in the 'id' attribute.getShow()
getTitle()
getUnit()
boolean
boolean
boolean
boolean
void
setAnnotation
(boolean isAnnotation) void
setDatatype
(String dataType) void
setEnumeration
(Enumeration<String, String> enumeration) void
setExportable
(boolean exportable) void
setExportproperty
(String exportProperty) void
setExporttitle
(String title) <I> void
setExtensions
(ExtensionsInvoker<ListColumnAction<I, ?>> extensions) void
setFilterable
(boolean filterable) void
setFilterclass
(String filterClass) void
setFilterproperty
(String filterProperty) void
setFiltertext
(String filterText) void
setFormatter
(Formatter<?> formatter) void
setJspcontext
(JspContext jspContext) void
setMultiple
(boolean multiple) void
setProperty
(String property) void
void
setSmartenum
(boolean smartEnum) void
setSortable
(boolean sortable) void
setSortproperty
(String sortProperty) void
setSubtitle
(String subtitle) void
void
setTooltip
(String tooltip) void
void
setValueType
(Type valueType) Methods inherited from class net.sf.basedb.clients.web.taglib.StylableTag
addDynamicAttributes, addIdAndStyles, getClazz, getDynamicActionAttributes, getDynamicAttribute, getFullClass, getStyle, getSubclass, initDefaultAttributes, resetDynamicAttributes, setClazz, setDynamicAttribute, setMoreDynamicAttributes, setPageContext, setStyle, setSubclass
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
table
The parent <tbl:table> tag. -
property
The name of the property on the item class. -
isAnnotation
private boolean isAnnotationIf the property is an annotation or not. -
sortProperty
Optional property used for sorting. -
filterProperty
Optional property used for filtering. -
exportProperty
Optional property used for exporting. -
valueType
The type of data in the property. -
title
The title of the column. -
exportTitle
Alternate title to use when exporting.- Since:
- 3.19.12
-
subtitle
The subtitle of the column.- Since:
- 3.18
-
show
If the column should be visible or not. Valid values are: always, never, auto -
sortable
private boolean sortableIf the column is sortable or not -
filterable
private boolean filterableIf the column is filterable or not -
filterText
Text to display in the filter cell when the column is not filterable.- Since:
- 3.20
-
filterClass
Extra CSS class to add to the filter table cell.- Since:
- 3.20
-
exportable
private boolean exportableIf the column is exportable or not -
tooltip
A tooltip with explaining text. -
enumeration
Options for enum. -
smartEnum
private boolean smartEnum -
multiple
private boolean multiple -
formatter
-
unit
-
jspContext
-
extensions
-
-
Constructor Details
-
ColumnDef
public ColumnDef()
-
-
Method Details
-
setProperty
-
getProperty
-
setAnnotation
public void setAnnotation(boolean isAnnotation) -
isAnnotation
public boolean isAnnotation() -
setSortproperty
-
getSortproperty
-
setFilterproperty
-
getFilterproperty
-
setExportproperty
-
getExportproperty
-
setDatatype
-
getDatatype
-
setValueType
-
getValueType
-
setTitle
-
getTitle
-
setExporttitle
-
getExporttitle
-
setSubtitle
- Since:
- 3.18
-
getSubtitle
- Since:
- 3.18
-
setShow
-
getShow
-
setSortable
public void setSortable(boolean sortable) -
isSortable
public boolean isSortable() -
setFilterable
public void setFilterable(boolean filterable) -
isFilterable
public boolean isFilterable() -
setFiltertext
- Since:
- 3.20
-
getFiltertext
-
setFilterclass
- Since:
- 3.20
-
getFilterclass
-
setExportable
public void setExportable(boolean exportable) -
isExportable
public boolean isExportable() -
setTooltip
-
getTooltip
-
setEnumeration
-
getEnumeration
-
setMultiple
public void setMultiple(boolean multiple) - Since:
- 2.8
-
setSmartenum
public void setSmartenum(boolean smartEnum) - Since:
- 2.7
-
setFormatter
-
getFormatter
-
setUnit
- Since:
- 2.9
-
getUnit
- Since:
- 2.9
-
setJspcontext
- Since:
- 3.2
-
setExtensions
- Since:
- 3.2
-
getIdPrefix
Description copied from class:StylableTag
Optional prefix to include in the 'id' attribute. SeeStylableTag.addIdAndStyles(StringBuilder, String...)
.- Overrides:
getIdPrefix
in classStylableTag
- Returns:
- The default implementation return an empty string
-
asJsonObject
public org.json.simple.JSONObject asJsonObject()Get a JSON representation of this column definition.- Since:
- 3.3
-
doStartTag
- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Throws:
JspException
-
appendPermissionOption
private void appendPermissionOption(StringBuilder sb, Permission selected, Permission toAdd, String display)
-