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

Object
  extended by SimpleTagSupport
      extended by AbstractSimpleTag
          extended by AbstractDataGridHtmlTag
              extended by AbstractCell
All Implemented Interfaces:
JspTag, SimpleTag, INetuiTag
Direct Known Subclasses:
AbstractHtmlTableCell, HeaderCell

public abstract class AbstractCell
extends AbstractDataGridHtmlTag

Abstract base class for JSP tags that render data grid cells. This class provides support to subclasses in several areas:


Constructor Summary
AbstractCell()
           
 
Method Summary
 void addFormatter(FormatTag.Formatter formatter)
          Add a FormatTag.Formatter.
protected  void addStateAttribute(AbstractHtmlState state, String name, String value)
           Add an HTML state attribute to a AbstractHtmlState object.
protected  void applyAttributes()
          Utility method invoked during tag rendering.
 void doTag()
           This method implements the rendering process for data grid cells.
 void formatterHasError()
          Indicate that a formatter has reported an error so the formatter should output it's body text.
protected abstract  CellModel internalGetCellModel()
           Abstract method implemented by subclasses.
protected abstract  void renderCell(AbstractRenderAppender appender)
           Abstract method implemented by subclasses to perform cell-specific rendering.
protected  void renderEmptyCell(AbstractRenderAppender appender)
          Utility method usable by subclasses that renders an HTML   to represent an empty HTML table cell.
 
Methods inherited from class AbstractDataGridHtmlTag
applyIndexedTagId, applyTagId, lookupDataGridTagModel, renderDefaultNameAndId, renderNameAndId
 
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
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

AbstractCell

public AbstractCell()
Method Detail

addFormatter

public void addFormatter(FormatTag.Formatter formatter)
Add a FormatTag.Formatter. Subclasses can optionally use the support formatting; formatters are added to the CellModel associated with an instance of the subclass.

Parameters:
formatter - the formatter to add

formatterHasError

public void formatterHasError()
Indicate that a formatter has reported an error so the formatter should output it's body text.


doTag

public void doTag()
           throws JspException,
                  IOException

This method implements the rendering process for data grid cells. When the data grid's rendering state is not DataGridTagModel.RENDER_STATE_START, this tag processes its body. The tag performs the following steps in order:

  1. The tag invokes its applyAttributes() method to allow subclasses to apply attributes to their CellModel instances at a well known time. Any errors in attribute checking should be thrown here.
  2. The tag adds the CellModel associated with the data grid to the JspContext under the key cellModel.
  3. Rendering is performed by invoking renderCell(org.apache.beehive.netui.tags.rendering.AbstractRenderAppender). If content is rendered when the body of the tag is rendered, it is written to the output stream.
  4. The tag removes the CellModel instance. If an exception is thrown after the CellModel is added to the JspContext, it the cell model will still be removed from the JspContext.

Specified by:
doTag in interface SimpleTag
Overrides:
doTag in class SimpleTagSupport
Throws:
JspException
IOException

internalGetCellModel

protected abstract CellModel internalGetCellModel()

Abstract method implemented by subclasses. Implementers should return the CellModel associated with the UI that is being rendered by the JSP tag.

Returns:
the cell's CellModel

renderCell

protected abstract void renderCell(AbstractRenderAppender appender)
                            throws IOException,
                                   JspException

Abstract method implemented by subclasses to perform cell-specific rendering.

Parameters:
appender - the AbstractRenderAppender to which any output should be rendered
Throws:
IOException
JspException

renderEmptyCell

protected void renderEmptyCell(AbstractRenderAppender appender)
Utility method usable by subclasses that renders an HTML   to represent an empty HTML table cell.

Parameters:
appender - the AbstractRenderAppender to which any output should be rendered

applyAttributes

protected void applyAttributes()
                        throws JspException
Utility method invoked during tag rendering. Subclasses should place attribute validation logic here.

Throws:
JspException - if application of attributes fails

addStateAttribute

protected final void addStateAttribute(AbstractHtmlState state,
                                       String name,
                                       String value)
                                throws JspException

Add an HTML state attribute to a AbstractHtmlState object. This method performs checks on common attributes and sets their values on the state object or throws an exception.

For the HTML tags it is not legal to set the id or name attributes. In addition, the base tag does not allow facets to be set. If the attribute is legal it will be added to the general expression map stored in the AbstractHtmlState of the tag.

Parameters:
state - the state object to which attributes are appliedn
name - the name of an attribute
value - the value of the attribute
Throws:
JspException - when an error occurs setting the attribute on the state object