org.apache.beehive.netui.tags.databinding.datagrid
Class HeaderCell

Object
  extended by SimpleTagSupport
      extended by AbstractSimpleTag
          extended by AbstractDataGridHtmlTag
              extended by AbstractCell
                  extended by HeaderCell
All Implemented Interfaces:
JspTag, SimpleTag, IFormattable, IAttributeConsumer, IBehaviorConsumer, INetuiTag

public class HeaderCell
extends AbstractCell
implements IFormattable, IBehaviorConsumer, IAttributeConsumer

This tag is used to render an HTML table header cell and should generally be used inside of the data grid's Header tag. Cells rendered with this tag usually appear at the top of a column of data displayed in a grid. Content for the body of a table header cell can be specified in one of two ways:

This tag can accept in its body any content which is allowable inside of a JSP SimpleTag. If the header text attribute is provided, it will supercede the content rendered by the body, though the body will still be evaluated.

The header cell is also able to display UI for showing and changing the sort and filter state of a data grid. By default, this tag renders a clickable arrow indicating the sort state and allow ing a page user to change the sort state. The state of a sort is usually associated with the data displayed in a column though the data in the column and the expression used to sort the data are loosely coupled via a 'sort expression'. The sort expression text is used to lookup the Sort state from the DataGridState associated with the containing data grid. If sorts are found, this tag will render the appropriate UI for the sort. Only a single sort may be associated with the sort expression. The clickable link rendered for changing the sort state is built using either the setSortHref(String) or the setSortAction(String) attributes. Sort UI rendering can be disabled using the setDisableSortRendering(boolean) attribute. Custom UI can be rendered for changing or displaying the sort state by providing a body for this tag and using the JSP EL data bindable DataGridState object available via the data grid's dataGrid implicit object.

The header cell provides attributes for supporting authoring of filter UI, but this tag does not by default implement a filter UI. The attributes are provided here so that their values can be data bound when building custom filter UI.

The set of JSP implicit objects available to the body include:


Constructor Summary
HeaderCell()
           
 
Method Summary
protected  void applyAttributes()
          Apply the tag's attributes to the HeaderCellModel.
 String getTagName()
          The name of this tag; this value is used for error reporting.
protected  CellModel internalGetCellModel()
          Implementation of AbstractCell.internalGetCellModel() that exposes the HeaderCellModel which is storing state for this tag.
protected  void renderCell(AbstractRenderAppender appender)
          Render the header cell's contents.
protected  void renderHeaderCellContents(AbstractRenderAppender appender, String jspFragmentOutput)
          Render the contents of the body of the HTML th tag into the given AbstractRenderAppender
 void setAttribute(String name, String value, String facet)
           Implementation of the IAttributeConsumer interface.
 void setBehavior(String name, Object value, String facet)
           Implementation of the IBehaviorConsumer interface that extends the functionality of this tag beyond that exposed via the JSP tag attributes.
 void setCellAbbr(String abbr)
          Sets the value of the abbreviated form of the content for the HTML th tag.
 void setCellAlign(String align)
          Sets the value of the horizontal align attribute for the HTML th tag..
 void setCellAxis(String axis)
          Sets the value of the axis attribute for the HTML th tag.
 void setCellChar(String alignChar)
          Sets the value of the horizontal alignment character attribute for the HTML th tag.
 void setCellCharoff(String alignCharOff)
          Sets the value of the horizontal alignment character offset for the HTML th tag..
 void setCellColspan(int colSpan)
          Sets the value of the colspan attribute for the HTML th tag.
 void setCellDir(String dir)
          Sets the value of the text direction attribute for the HTML th tag.
 void setCellHeaders(String headers)
          Sets the value of the headers attribute for the HTML th tag.
 void setCellLang(String lang)
          Sets the value of the language attribute for the HTML th tag.
 void setCellOnClick(String onClick)
          Sets the onClick JavaScript for the HTML th tag.
 void setCellOnDblClick(String onDblClick)
          Sets the onDblClick JavaScript for the HTML th tag.
 void setCellOnKeyDown(String onKeyDown)
          Sets the onKeyDown JavaScript for the HTML th tag.
 void setCellOnKeyPress(String onKeyPress)
          Sets the onKeyPress JavaScript for the HTML th tag.
 void setCellOnKeyUp(String onKeyUp)
          Sets the onKeyUp JavaScript for the HTML th tag.
 void setCellOnMouseDown(String onMouseDown)
          Sets the onMouseDown JavaScript for the HTML th tag.
 void setCellOnMouseMove(String onMouseMove)
          Sets the onMouseMove JavaScript for the HTML th tag.
 void setCellOnMouseOut(String onMouseOut)
          Sets the onMouseOut JavaScript for the HTML th tag.
 void setCellOnMouseOver(String onMouseOver)
          Sets the onMouseOver JavaScript for the HTML th tag.
 void setCellOnMouseUp(String onMouseUp)
          Sets the onMouseUp JavaScript for the HTML th tag.
 void setCellRowspan(int rowSpan)
          Sets the value of the rowspan attribute for the HTML th tag.
 void setCellScope(String scope)
          Sets the value of the scope attribute for the HTML th tag.
 void setCellStyle(String style)
          Sets the style for the HTML th tag.
 void setCellStyleClass(String styleClass)
          Sets the style class for the HTML th tag.
 void setCellTagId(String tagId)
          Set the name of the tagId for the HTML th tag.
 void setCellTitle(String title)
          Sets the value of the title attribute for the HTML th tag.
 void setCellValign(String align)
          Sets the value of the vertical alignment attribute for the HTML th tag.
 void setDisableFilterRendering(boolean disableFilterRendering)
          Set a boolean which can be used to enable / disable rendering of UI associated with filtering inside of the data grid.
 void setDisableSortRendering(boolean disableSortRendering)
          Set a boolean which can be used to enable / disable rendering of UI associated with sorting inside of the data grid.
 void setFilterAction(String filterAction)
          Set the name of an action used to perform filtering on a data grid.
 void setFilterExpression(String filterExpression)
          Set the filter expression for this header cell.
 void setFilterHref(String filterHref)
          Set an href used to build URIs to change the filter state for this header cell.
 void setHeaderText(String headerText)
          Deprecated.  
 void setScopeId(String scopeId)
          Sets the scopeId for any anchors rendered by this header cell.
 void setSortAction(String sortAction)
          Set the name of an action used to perform sorting on a data grid.
 void setSortExpression(String sortExpression)
          Set the sort expression for this header cell.
 void setSortHref(String sortHref)
          Set an href used to build URIs to change the sort state for this header cell.
 void setValue(Object value)
          Deprecated.  
 
Methods inherited from class AbstractCell
addFormatter, addStateAttribute, doTag, formatterHasError, renderEmptyCell
 
Methods inherited from class AbstractDataGridHtmlTag
applyIndexedTagId, applyTagId, lookupDataGridTagModel, renderDefaultNameAndId, renderNameAndId
 
Methods inherited from class AbstractSimpleTag
getBufferBody, getHtmlTag, getIdForTagId, getInlineError, getPageContext, getScriptReporter, getUserLocale, hasErrors, registerTagError, registerTagError, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface IFormattable
addFormatter, formatterHasError
 

Constructor Detail

HeaderCell

public HeaderCell()
Method Detail

getTagName

public String getTagName()
The name of this tag; this value is used for error reporting.

Specified by:
getTagName in interface INetuiTag
Specified by:
getTagName in class AbstractSimpleTag
Returns:
the String name of this tag

setHeaderText

public void setHeaderText(String headerText)
Deprecated. 

Sets the String text to render for this table header cell. This text will be rendered inside of the <th> tags.

Parameters:
headerText - The text to render.

setValue

public void setValue(Object value)
Deprecated. 

Sets the Object value to render for this table header cell. This text will be rendered inside of the <th> tags. This value will be formatted when formatters are applied to header cells.

Parameters:
value - The text to format and render

setScopeId

public void setScopeId(String scopeId)
Sets the scopeId for any anchors rendered by this header cell.

Parameters:
scopeId -

setDisableFilterRendering

public void setDisableFilterRendering(boolean disableFilterRendering)
Set a boolean which can be used to enable / disable rendering of UI associated with filtering inside of the data grid.

Parameters:
disableFilterRendering - boolean to enable / disable filter UI rendering

setFilterExpression

public void setFilterExpression(String filterExpression)
Set the filter expression for this header cell. The value of this attribute is used to lookup Filter state for a data grid If filters are found matching this filter expression, the column is said to be 'filtered'. When a column is filtered, it is possible for the header cell UI to change to allow changing or removing the filter. By default, no UI is rendered for filtered columns. To have data cells rendered with filter information, this filter expression value should be set on the AbstractHtmlTableCell.setFilterExpression(String) attribute for cell tags rendered inside of the Rows tag.

Parameters:
filterExpression - the filter expression

setFilterAction

public void setFilterAction(String filterAction)
Set the name of an action used to perform filtering on a data grid. This action must exist in the context of the current Page Flow. It is used to build anchor URIs that when clicked change or display UI that allows for change to the cell's filter state. Only one of this and the setFilterHref(String) may be set on this tag.

Parameters:
filterAction - the filter action

setFilterHref

public void setFilterHref(String filterHref)
Set an href used to build URIs to change the filter state for this header cell. Only one of this and the setFilterAction(String) attribute may be set on this tag.

Parameters:
filterHref - the filter href

setDisableSortRendering

public void setDisableSortRendering(boolean disableSortRendering)
Set a boolean which can be used to enable / disable rendering of UI associated with sorting inside of the data grid.

Parameters:
disableSortRendering - boolean to enable / disable sort UI rendering

setSortExpression

public void setSortExpression(String sortExpression)
Set the sort expression for this header cell. The value of this attribute is used to lookup Sort state for a data grid If sorts are found matching this filter expression, the column is said to be 'sorted'. When a column is sorted, it is possible for the header cell UI to change to allow changing or removing the filter. By default, the UI for sorting is a clickable arrow that indicates whether a column of data is sorted ascending, descending, or not at all. To have data cells rendered with sort information, this sort expression value should be set on the AbstractHtmlTableCell.setSortExpression(String) attribute for cell tags rendered inside of the Rows tag.

Parameters:
sortExpression - the sort expression

setSortAction

public void setSortAction(String sortAction)
Set the name of an action used to perform sorting on a data grid. This action must exist in the context of the current Page Flow. It is used to build anchor URIs that when clicked change or display UI that allows for change to the cell's sort state. Only one of this and the setSortHref(String) may be set on this tag.

Parameters:
sortAction - the sort action

setSortHref

public void setSortHref(String sortHref)
Set an href used to build URIs to change the sort state for this header cell. Only one of this and the setSortAction(String) attribute may be set on this tag.

Parameters:
sortHref - the sort href

setCellOnClick

public void setCellOnClick(String onClick)
Sets the onClick JavaScript for the HTML th tag.

Parameters:
onClick - the onClick event.

setCellOnDblClick

public void setCellOnDblClick(String onDblClick)
Sets the onDblClick JavaScript for the HTML th tag.

Parameters:
onDblClick - the onDblClick event.

setCellOnKeyDown

public void setCellOnKeyDown(String onKeyDown)
Sets the onKeyDown JavaScript for the HTML th tag.

Parameters:
onKeyDown - the onKeyDown event.

setCellOnKeyUp

public void setCellOnKeyUp(String onKeyUp)
Sets the onKeyUp JavaScript for the HTML th tag.

Parameters:
onKeyUp - the onKeyUp event.

setCellOnKeyPress

public void setCellOnKeyPress(String onKeyPress)
Sets the onKeyPress JavaScript for the HTML th tag.

Parameters:
onKeyPress - the onKeyPress event.

setCellOnMouseDown

public void setCellOnMouseDown(String onMouseDown)
Sets the onMouseDown JavaScript for the HTML th tag.

Parameters:
onMouseDown - the onMouseDown event.

setCellOnMouseUp

public void setCellOnMouseUp(String onMouseUp)
Sets the onMouseUp JavaScript for the HTML th tag.

Parameters:
onMouseUp - the onMouseUp event.

setCellOnMouseMove

public void setCellOnMouseMove(String onMouseMove)
Sets the onMouseMove JavaScript for the HTML th tag.

Parameters:
onMouseMove - the onMouseMove event.

setCellOnMouseOut

public void setCellOnMouseOut(String onMouseOut)
Sets the onMouseOut JavaScript for the HTML th tag.

Parameters:
onMouseOut - the onMouseOut event.

setCellOnMouseOver

public void setCellOnMouseOver(String onMouseOver)
Sets the onMouseOver JavaScript for the HTML th tag.

Parameters:
onMouseOver - the onMouseOver event.

setCellStyle

public void setCellStyle(String style)
Sets the style for the HTML th tag.

Parameters:
style - the style

setCellStyleClass

public void setCellStyleClass(String styleClass)
Sets the style class for the HTML th tag.

Parameters:
styleClass - the style class

setCellTitle

public void setCellTitle(String title)
Sets the value of the title attribute for the HTML th tag.

Parameters:
title - the title

setCellRowspan

public void setCellRowspan(int rowSpan)
Sets the value of the rowspan attribute for the HTML th tag.

Parameters:
rowSpan - the rowspan

setCellColspan

public void setCellColspan(int colSpan)
Sets the value of the colspan attribute for the HTML th tag.

Parameters:
colSpan - the colspan

setCellAlign

public void setCellAlign(String align)
Sets the value of the horizontal align attribute for the HTML th tag..

Parameters:
align - the horizontal alignment

setCellChar

public void setCellChar(String alignChar)
Sets the value of the horizontal alignment character attribute for the HTML th tag.

Parameters:
alignChar - the alignment character

setCellCharoff

public void setCellCharoff(String alignCharOff)
Sets the value of the horizontal alignment character offset for the HTML th tag..

Parameters:
alignCharOff - the horizontal alignment character offset

setCellValign

public void setCellValign(String align)
Sets the value of the vertical alignment attribute for the HTML th tag.

Parameters:
align - the vertical alignment attribute

setCellLang

public void setCellLang(String lang)
Sets the value of the language attribute for the HTML th tag.

Parameters:
lang - the language attribute

setCellDir

public void setCellDir(String dir)
Sets the value of the text direction attribute for the HTML th tag.

Parameters:
dir - the text direction

setCellAbbr

public void setCellAbbr(String abbr)
Sets the value of the abbreviated form of the content for the HTML th tag.

Parameters:
abbr - the abbr

setCellAxis

public void setCellAxis(String axis)
Sets the value of the axis attribute for the HTML th tag.

Parameters:
axis - the axis

setCellHeaders

public void setCellHeaders(String headers)
Sets the value of the headers attribute for the HTML th tag.

Parameters:
headers - the headers

setCellScope

public void setCellScope(String scope)
Sets the value of the scope attribute for the HTML th tag.

Parameters:
scope - the scope

setCellTagId

public void setCellTagId(String tagId)
                  throws JspException
Set the name of the tagId for the HTML th tag.

Parameters:
tagId - the the name of the tagId for the th tag.
Throws:
JspException

setAttribute

public void setAttribute(String name,
                         String value,
                         String facet)
                  throws JspException

Implementation of the IAttributeConsumer interface. This allows users of the anchorCell tag to extend the attribute set that is rendered by the HTML anchor. This method accepts the following facets:

Facet NameOperation
headerAdds an attribute with the provided name and value to the attributes rendered on the <th> tag.
The HeaderCell tag defaults to the setting attributes on the header when the facet name is unset.

Specified by:
setAttribute in interface IAttributeConsumer
Parameters:
name - the name of the attribute
value - the value of the attribute
facet - the facet for the attribute
Throws:
JspException - thrown when the facet is not recognized

setBehavior

public void setBehavior(String name,
                        Object value,
                        String facet)
                 throws JspException

Implementation of the IBehaviorConsumer interface that extends the functionality of this tag beyond that exposed via the JSP tag attributes. This method accepts the following facets:

Facet NameOperation
rendererExtends the cell decorator chain used to implement rendering for this tag
The renderer facet accepts the following behavior names. The value of each should be a String classname of a class that extends the CellDecorator base class.
extendsAdd an additional decorator to the currently configured cell decorator chain.
sortReplace the currently configured sort decorator with one created from this class name.

Specified by:
setBehavior in interface IBehaviorConsumer
Parameters:
name - the name of the behavior
value - the value of the behavior
facet - th ebehavior's facet
Throws:
JspException - when the behavior's facet isnot recognized

internalGetCellModel

protected CellModel internalGetCellModel()
Implementation of AbstractCell.internalGetCellModel() that exposes the HeaderCellModel which is storing state for this tag.

Specified by:
internalGetCellModel in class AbstractCell
Returns:
this tag's cell model

renderCell

protected void renderCell(AbstractRenderAppender appender)
                   throws IOException,
                          JspException
Render the header cell's contents. This method sets the style information on the HTML th tag and then calls the renderHeaderCellContents(org.apache.beehive.netui.tags.rendering.AbstractRenderAppender, String) method to render the contents of the cell.

Specified by:
renderCell in class AbstractCell
Parameters:
appender - the AbstractRenderAppender to which the output from this tag should be added
Throws:
IOException
JspException

renderHeaderCellContents

protected void renderHeaderCellContents(AbstractRenderAppender appender,
                                        String jspFragmentOutput)
                                 throws IOException,
                                        JspException
Render the contents of the body of the HTML th tag into the given AbstractRenderAppender

Parameters:
appender - the AbstractRenderAppender for the output
jspFragmentOutput - the result of having evaluated the tag's JspFragment
Throws:
IOException - when an error occurs writing to the output stream
JspException - when an error occurs evaluating the JspFragment for this body

applyAttributes

protected void applyAttributes()
                        throws JspException
Apply the tag's attributes to the HeaderCellModel.

Overrides:
applyAttributes in class AbstractCell
Throws:
JspException - when errors are encountered applying the attributes