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

Object
  extended by SimpleTagSupport
      extended by AbstractSimpleTag
          extended by AbstractDataGridHtmlTag
All Implemented Interfaces:
JspTag, SimpleTag, INetuiTag
Direct Known Subclasses:
AbstractCell, Caption, DataGrid, Footer, Header, RenderPager, Row, Rows

public abstract class AbstractDataGridHtmlTag
extends AbstractSimpleTag

This class is a base class for all data grid tags that render HTML output for the grid. This base class provides services to its subclasses including lookup of the DataGridTagModel for the current data grid. In addition, this class exposes tagId generation functionality. These methods are used to create strings that will be written onto HTML tags for the "id" or "name" attributes. Such identifiers can be created in one of two ways -- indexed or un-indexed. An un-indexed tag identifier is one that the page author is responsible for making unique within a given scope in the rendered output. An indexed tag identifier is one that the data grid will suffix with the index for the current row in the grid. This is used to help create unique identifiers from JSP tags that are rendered repeatedly. For example, a SpanCell renders an HTML <span> tag; with its tagId attribute set, it will render a tag identifier for every row in the page. The indexed is added as a suffix in order to help page authors create more unique identifiers. Ultimately, the page author is responsible for ensuring that their tag identifiers are unique within a scope.


Constructor Summary
AbstractDataGridHtmlTag()
           
 
Method Summary
protected  void applyIndexedTagId(AbstractHtmlState state, String tagId)
          Create an indexed tag identifier given a state object and a base tag identifier.
protected  void applyTagId(AbstractHtmlState state, String tagId)
          Create an un-indexed tag identifier for the given state object.
protected  DataGridTagModel lookupDataGridTagModel()
          Get the DataGridTagModel for the data grid.
protected  String renderDefaultNameAndId(HttpServletRequest request, AbstractHtmlState state, String id, String name)
           
protected  String renderNameAndId(HttpServletRequest request, AbstractHtmlState state, Form parentForm)
           Generate a name and id given a AbstractHtmlState object.
 
Methods inherited from class AbstractSimpleTag
getBufferBody, getHtmlTag, getIdForTagId, getInlineError, getPageContext, getScriptReporter, getTagName, getUserLocale, hasErrors, registerTagError, registerTagError, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class SimpleTagSupport
doTag, findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext, setParent
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDataGridHtmlTag

public AbstractDataGridHtmlTag()
Method Detail

lookupDataGridTagModel

protected final DataGridTagModel lookupDataGridTagModel()
Get the DataGridTagModel for the data grid.

Returns:
the data grid tag model

applyIndexedTagId

protected final void applyIndexedTagId(AbstractHtmlState state,
                                       String tagId)
                                throws JspException
Create an indexed tag identifier given a state object and a base tag identifier. The tagId will have the index of the current item in the data grid attached as a suffix to the the given base identifier.

Parameters:
state - the AbstractHtmlState upon which the tag identifier will be set once created
tagId - the base tag identifier name
Throws:
JspException

applyTagId

protected final void applyTagId(AbstractHtmlState state,
                                String tagId)
                         throws JspException
Create an un-indexed tag identifier for the given state object.

Parameters:
state - the AbstractHtmlState upon which the tag identifier will be set once created
tagId - the base tag identifier
Throws:
JspException

renderNameAndId

protected final String renderNameAndId(HttpServletRequest request,
                                       AbstractHtmlState state,
                                       Form parentForm)

Generate a name and id given a AbstractHtmlState object. Data grid callers may invoke this method with subclasses rendering markup containing tags that must set HTML tag IDs for use via JavaScript on the client.
Assumptions:

Parameters:
state - the HTML state whose tag id to set
parentForm - a Form tag if one contains this tag
Returns:
String a block of JavaScript if script must e rendered to the page in order to support lookups of HTML elements using a tag id. If returned, the String must be rendered to the output stream. null if no script must be rendered.

renderDefaultNameAndId

protected String renderDefaultNameAndId(HttpServletRequest request,
                                        AbstractHtmlState state,
                                        String id,
                                        String name)