Class Table
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
net.sf.basedb.clients.web.taglib.StylableTag
net.sf.basedb.clients.web.taglib.table.Table
- All Implemented Interfaces:
Serializable
,DynamicAttributes
,IterationTag
,JspTag
,Tag
,DynamicActionAttributes
This is the main tag for the table. It must be located inside
a
<base:page>
tag.
Syntax:
<tbl:table id=... clazz=.... style=... title=... sortby=... direction=ASC|DESC columns=... filterrows=... sc=... item=... subcontext=... action=... stickyheaders=... dragcolumns=true|false|null >
Attribute | Default value | Required | Description |
id | - | yes |
The ID of the table. 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:
table = document.getElementById('<id>'); |
clazz | - | 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.
|
title | - | no |
An optional title that will be displayed in <h3>
format directly above the table.
|
sortby | - | no |
Matches the property attribute on a <tbl:columdef> tag.
This column will then be marked with an upwards or downward pointer
according to the direction attribute.
|
direction | asc | no |
The value should be either asc or desc to
indicate if the rows are sorted in ascending or descending order.
Other values are interpreted as asc .
|
columns | - | no |
A comma-separatd list of column ID:s. Only columns with an ID in the list
will be shown in the table. The special value all shows all
columns. Individual columns may override this setting by
specifying always or never instead of the default
auto value in their show attribute.
|
filterrows | 1 | no | Number of filter rows that should be displayed in the table. |
action | name of current page | no | The action property of the <form> tag. |
sc | - | no | The current SessionControl object. Used by some child taglibs for generating context sensitive information. |
item | - | no | The current Item object. Used by some child taglibs for generating context sensitive information (ie. PresetSelector). |
subcontext | "" (empty string) | no | The name of the current subcontext. Used by some child taglibs for generating context sensitive information (ie. PresetSelector). |
stickyheaders | - | no | Enable sticky headers and optionally set the name of a sticky column. Do not set this attribute if the table should not have sticky headers. |
dragcolumns | null | no | If set, controls if columns can be re-ordered by dragging them in the GUI. If null, the feature is enabled only if the "action" and "item" attributes are not null. |
The <tbl:table>
may contain the following subtags:
<tbl:toolbar>
: Creates a toolbar with buttons<tbl:navigator>
: Creates the page navigator<tbl:data>
: Begins the data section
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
private boolean
"all" was specified for the columns attribute.private String
Which columns that should be visible and their orderThe ID of all defined columnsprivate Boolean
private int
Keep track of which class to use for the next row.private List<ListColumnAction>
private StringBuilder
private Item
private org.json.simple.JSONArray
private int
private int
Number of filter rows in the table.private int
private Page
The parent <base:page> tag.private static final String[]
The class names for even and odd row respectively.private SessionControl
private static final long
private String
The column to sort by.private Map<String,
ItemContext.SortDirection> private ItemContext.SortDirection
ASC or DESCprivate String
The id of a column that is "sticky".private boolean
If sticky headers is enabled or not.private String
private String
An optional title of the table.The ID of all visible columns, sorted by the order they should appear.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 TypeMethodDescription(package private) void
addColumnDef
(ColumnDef cd, ListColumnAction extensionColumn) (package private) void
addFilteredColumn
(String columnId, String filterProperty, boolean visible) (package private) void
(package private) boolean
Can header columns be dragged for re-ordering?int
doEndTag()
int
(package private) void
(package private) void
(package private) String
getDirectionImage
(ItemContext.SortDirection direction) Get sort direction <img> element for the given direction.(package private) List<ListColumnAction>
int
(package private) Formatter<?>
getFormatter
(String columnId) getItem()
(package private) String
(package private) int
(package private) Page
getPage()
getSc()
(package private) ItemContext.SortDirection
getSortDirection
(String colum) Get the sort direction on the given column.getTitle()
boolean
(package private) boolean
isColumnSticky
(String columnId) (package private) boolean
isColumnVisible
(String columnId) (package private) int
(package private) int
void
(package private) void
setColumnContent
(String columnId, String content) (package private) void
setColumnFilter
(String columnId, int row, String filterHtml) void
setColumns
(String columns) void
setDirection
(String direction) void
setDirection
(ItemContext.SortDirection direction) void
setDragcolumns
(Boolean dragColumns) void
setFilterrows
(int filterRows) void
(package private) void
setNumColumns
(int numColumns) void
setSc
(SessionControl sc) void
void
setStickyheaders
(String stickyCol) void
setSubcontext
(String subcontext) void
(package private) int
writeColumnFilters
(int row) (package private) int
(package private) int
Methods inherited from class net.sf.basedb.clients.web.taglib.StylableTag
addDynamicAttributes, addIdAndStyles, getClazz, getDynamicActionAttributes, getDynamicAttribute, getFullClass, getIdPrefix, getStyle, getSubclass, initDefaultAttributes, setClazz, setDynamicAttribute, setMoreDynamicAttributes, setPageContext, setStyle, setSubclass
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setParent, setValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
page
The parent <base:page> tag. -
title
An optional title of the table. -
sortby
The column to sort by. Should match the sort attribute on the column tag. -
sortColumns
-
action
-
sc
-
itemType
-
subcontext
-
sortDirection
ASC or DESC -
columns
Which columns that should be visible and their order -
stickyHeaders
private boolean stickyHeadersIf sticky headers is enabled or not. -
stickyCol
The id of a column that is "sticky". -
numFilterRows
private int numFilterRowsNumber of filter rows in the table. -
evenodd
private int evenoddKeep track of which class to use for the next row. -
rowclass
The class names for even and odd row respectively. -
allVisible
private boolean allVisible"all" was specified for the columns attribute. -
visibleColumns
The ID of all visible columns, sorted by the order they should appear. -
definedColumns
The ID of all defined columns -
columnContent
-
columnFilter
-
columnSubtitle
-
columnFormatter
-
extensionColumns
-
jsonColumnDefs
private org.json.simple.JSONArray jsonColumnDefs -
numHeaderColumns
private int numHeaderColumns -
numFilteredColumns
private int numFilteredColumns -
dragColumns
-
-
Constructor Details
-
Table
public Table()
-
-
Method Details
-
setTitle
-
getTitle
-
setColumns
-
getColumns
-
setStickyheaders
- Since:
- 3.18.1
-
hasStickyHeaders
public boolean hasStickyHeaders()- Since:
- 3.18.1
-
getStickyCol
- Since:
- 3.18.1
-
setDragcolumns
- Since:
- 3.8
-
getDragcolumns
-
setFilterrows
public void setFilterrows(int filterRows) - Since:
- 3.5
-
getFilterrows
public int getFilterrows() -
setSortby
-
getSortby
-
setAction
-
getAction
-
setSc
-
getSc
-
setItem
-
getItem
-
setSubcontext
-
getSubcontext
-
setDirection
-
setDirection
-
getDirection
-
getPage
Page getPage() -
addColumnDef
-
endColumnDefinitions
void endColumnDefinitions() -
isColumnVisible
-
getVisibleColumns
-
isColumnSticky
-
getFormatter
-
setColumnContent
-
getColumnContent
-
getColumnSubtitles
-
setColumnFilter
-
addFilteredColumn
-
getHiddenFilteredColumns
-
writeColumns
- Throws:
Exception
-
writeColumnFilters
- Throws:
Exception
-
writeColumnSubtitles
-
endColumnFilters
void endColumnFilters() -
getSortDirection
Get the sort direction on the given column. If it is not used for sorting, null is returned.- Since:
- 3.3
-
getDirectionImage
Get sort direction <img> element for the given direction. Return an empty string if direction = null.- Since:
- 3.3
-
getNextRowClass
String getNextRowClass() -
addHidden
-
numVisibleColumns
int numVisibleColumns() -
getNumFilteredColumns
int getNumFilteredColumns() -
setNumColumns
void setNumColumns(int numColumns) -
numHeaderColumns
int numHeaderColumns() -
getExtensionColumns
List<ListColumnAction> getExtensionColumns() -
allowColumnDrag
boolean allowColumnDrag()Can header columns be dragged for re-ordering? IfsetDragcolumns(Boolean)
has been set we use that value, otherwise we only allow it if the "action" attribute has been set.- Since:
- 3.8
-
doStartTag
- Specified by:
doStartTag
in interfaceTag
- Overrides:
doStartTag
in classTagSupport
- Throws:
JspException
-
doEndTag
- Specified by:
doEndTag
in interfaceTag
- Overrides:
doEndTag
in classTagSupport
- Throws:
JspException
-