2.17.2: 2011-06-17

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

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

public class Table
extends TagSupport

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=...
      sc=...
      item=...
      subcontext=...
      action=...
   >

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.
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).

The <tbl:table> may contain the following subtags:

Version:
2.0
Author:
Nicklas
See Also:
Serialized Form

Field Summary
private  String action
           
private  boolean allVisible
          "all" was specified for the columns attribute.
private  String clazz
          Optional class attribute
private  Map<String,String> columnContent
           
private  Map<String,String> columnFilter
           
private  Map<String,Formatter<?>> columnFormatter
           
private  String columns
          Which columns that should be visible and their order
private  int evenodd
          Keep track of which class to use for the next row.
private  List<String> hiddenFilteredColumns
           
private  StringBuilder hiddenForm
           
private  Item itemType
           
private  int numFilteredColumns
           
private  int numHeaderColumns
           
private  Page page
          The parent <base:page> tag.
private static String[] rowclass
          The class names for even and odd row respectively.
private  SessionControl sc
           
private  StringBuilder script
           
private static long serialVersionUID
           
private  String sortby
          The column to sort by.
private  Set<String> sortbyMultiple
           
private  ItemContext.SortDirection sortDirection
          ASC or DESC
private  String style
          Optional style attribute
private  String subcontext
           
private  String title
          An optional title of the table.
private  LinkedHashSet<String> visibleColumns
          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
Table()
           
 
Method Summary
(package private)  void addColumnDef(ColumnDef cd)
           
(package private)  void addFilteredColumn(String columnId, boolean visible)
           
(package private)  void addHeaderColumn(int colspan)
           
(package private)  void addHidden(String name, String value)
           
(package private)  void addScript(String theScript)
           
 int doEndTag()
           
 int doStartTag()
           
 String getAction()
           
 String getClazz()
           
(package private)  Map<String,String> getColumnContent()
           
 String getColumns()
           
 ItemContext.SortDirection getDirection()
           
(package private)  String getDirectionImage()
           
(package private)  Formatter<?> getFormatter(String columnId)
           
(package private)  List<String> getHiddenFilteredColumns()
           
 Item getItem()
           
(package private)  String getNextRowClass()
           
(package private)  int getNumFilteredColumns()
           
(package private)  Page getPage()
           
(package private)  ItemContext.SortDirection getReverseDirection()
           
 SessionControl getSc()
           
 String getSortby()
           
 String getStyle()
           
 String getSubcontext()
           
 String getTitle()
           
(package private)  Set<String> getVisibleColumns()
           
(package private)  boolean isColumnVisible(String columnId)
           
(package private)  boolean isSortedby(String sortcolumn)
           
(package private)  int numHeaderColumns()
           
(package private)  int numVisibleColumns()
           
 void setAction(String action)
           
 void setClazz(String clazz)
           
(package private)  void setColumnContent(String columnId, String content)
           
(package private)  void setColumnFilter(String columnId, String filterHtml)
           
 void setColumns(String columns)
           
 void setDirection(ItemContext.SortDirection direction)
           
 void setDirection(String direction)
           
 void setItem(Item itemType)
           
 void setSc(SessionControl sc)
           
 void setSortby(String sortby)
           
 void setStyle(String style)
           
 void setSubcontext(String subcontext)
           
 void setTitle(String title)
           
(package private)  void writeColumnFilters()
           
(package private)  void writeColumns()
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, 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

page

private Page page
The parent <base:page> tag.


clazz

private String clazz
Optional class attribute


style

private String style
Optional style attribute


title

private String title
An optional title of the table.


sortby

private String sortby
The column to sort by. Should match the sort attribute on the column tag.


sortbyMultiple

private Set<String> sortbyMultiple

action

private String action

sc

private transient SessionControl sc

itemType

private Item itemType

subcontext

private String subcontext

sortDirection

private ItemContext.SortDirection sortDirection
ASC or DESC


columns

private String columns
Which columns that should be visible and their order


hiddenForm

private StringBuilder hiddenForm

script

private StringBuilder script

evenodd

private int evenodd
Keep track of which class to use for the next row.


rowclass

private static final String[] rowclass
The class names for even and odd row respectively.


allVisible

private boolean allVisible
"all" was specified for the columns attribute.


visibleColumns

private LinkedHashSet<String> visibleColumns
The ID of all visible columns, sorted by the order they should appear.


columnContent

private Map<String,String> columnContent

columnFilter

private Map<String,String> columnFilter

columnFormatter

private transient Map<String,Formatter<?>> columnFormatter

hiddenFilteredColumns

private List<String> hiddenFilteredColumns

numHeaderColumns

private int numHeaderColumns

numFilteredColumns

private int numFilteredColumns
Constructor Detail

Table

public Table()
Method Detail

setClazz

public void setClazz(String clazz)

getClazz

public String getClazz()

setStyle

public void setStyle(String style)

getStyle

public String getStyle()

setTitle

public void setTitle(String title)

getTitle

public String getTitle()

setColumns

public void setColumns(String columns)

getColumns

public String getColumns()

setSortby

public void setSortby(String sortby)

getSortby

public String getSortby()

setAction

public void setAction(String action)

getAction

public String getAction()

setSc

public void setSc(SessionControl sc)

getSc

public SessionControl getSc()

setItem

public void setItem(Item itemType)

getItem

public Item getItem()

setSubcontext

public void setSubcontext(String subcontext)

getSubcontext

public String getSubcontext()

setDirection

public void setDirection(String direction)

setDirection

public void setDirection(ItemContext.SortDirection direction)

getDirection

public ItemContext.SortDirection getDirection()

getPage

Page getPage()

addScript

void addScript(String theScript)

addColumnDef

void addColumnDef(ColumnDef cd)

isColumnVisible

boolean isColumnVisible(String columnId)

getVisibleColumns

Set<String> getVisibleColumns()

getFormatter

Formatter<?> getFormatter(String columnId)

setColumnContent

void setColumnContent(String columnId,
                      String content)

getColumnContent

Map<String,String> getColumnContent()

setColumnFilter

void setColumnFilter(String columnId,
                     String filterHtml)

addFilteredColumn

void addFilteredColumn(String columnId,
                       boolean visible)

getHiddenFilteredColumns

List<String> getHiddenFilteredColumns()

writeColumns

void writeColumns()
            throws Exception
Throws:
Exception

writeColumnFilters

void writeColumnFilters()
                  throws Exception
Throws:
Exception

isSortedby

boolean isSortedby(String sortcolumn)

getReverseDirection

ItemContext.SortDirection getReverseDirection()

getDirectionImage

String getDirectionImage()

getNextRowClass

String getNextRowClass()

addHidden

void addHidden(String name,
               String value)

numVisibleColumns

int numVisibleColumns()

getNumFilteredColumns

int getNumFilteredColumns()

addHeaderColumn

void addHeaderColumn(int colspan)

numHeaderColumns

int numHeaderColumns()

doStartTag

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

doEndTag

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

2.17.2: 2011-06-17