org.apache.beehive.netui.tags
Class AbstractSimpleTag

Object
  extended by SimpleTagSupport
      extended by AbstractSimpleTag
All Implemented Interfaces:
JspTag, SimpleTag, INetuiTag
Direct Known Subclasses:
AbstractCell, Attribute, Base, Behavior, BindingUpdateErrors, Caption, ConfigurePager, Content, DataGrid, DeclarePageInput, ErrorBaseTag, Exceptions, Footer, FormatTag, Header, RenderPager, Rows, ScriptBlock, Tree, TreeContent, TreeHtmlAttribute, TreeItem, TreeLabel, TreePropertyOverride

public abstract class AbstractSimpleTag
extends SimpleTagSupport
implements INetuiTag


Constructor Summary
AbstractSimpleTag()
           
 
Method Summary
protected  String getBufferBody(boolean trim)
           
protected  IScriptReporter getHtmlTag(ServletRequest req)
          This method will return the scriptReporter that is represented by the HTML tag.
protected  String getIdForTagId(String tagId)
          This method will generate a real id based upon the passed in tagId.
protected  String getInlineError()
           
protected  PageContext getPageContext()
          This method will attempt to cast the JspContext into a PageContext.
protected  IScriptReporter getScriptReporter()
          Return the closest ScriptReporter in the parental chain.
abstract  String getTagName()
          Return the name of the tag.
protected  Locale getUserLocale()
          This method will return the user local of the request.
protected  boolean hasErrors()
          This method will return true if there have been any errors registered on this tag.
 void registerTagError(AbstractPageError error)
           
 void registerTagError(String message, Throwable e)
          This will report an error from a tag.
protected  void reportErrors()
          This method will write out the String returned by getErrorsReport to the response output stream.
protected  String rewriteName(String name)
          This method will rewrite the name (id) by passing it to the URL Rewritter and getting back a value.
protected  String setNonEmptyValueAttribute(String attrValue)
          Filter out the empty string value and return either the value or null.
protected  String setRequiredValueAttribute(String attrValue, String attrName)
          Report an error if the value of attrValue is equal to the empty string, otherwise return that value.
protected  void write(String string)
          This mehod will write the passed string to the response.
 
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

AbstractSimpleTag

public AbstractSimpleTag()
Method Detail

getTagName

public abstract String getTagName()
Return the name of the tag. Used by error reporting to get the name of the tag.

Specified by:
getTagName in interface INetuiTag
Returns:
the name of the tag.

getBufferBody

protected String getBufferBody(boolean trim)
                        throws JspException,
                               IOException
Parameters:
trim -
Returns:
Throws:
JspException
IOException

setRequiredValueAttribute

protected final String setRequiredValueAttribute(String attrValue,
                                                 String attrName)
                                          throws JspException
Report an error if the value of attrValue is equal to the empty string, otherwise return that value. If attrValue is equal to the empty string, an error is registered and null is returned.

Parameters:
attrValue - The value to be checked for the empty string
attrName - The name of the attribute
Returns:
either the attrValue if it is not the empty string or null
Throws:
JspException - A JspException will be thrown if inline error reporting is turned off.

setNonEmptyValueAttribute

protected final String setNonEmptyValueAttribute(String attrValue)
Filter out the empty string value and return either the value or null. When the value of attrValue is equal to the empty string this will return null, otherwise it will return the value of attrValue.

Parameters:
attrValue - This is the value we will check for the empty string.
Returns:
either the value of attrValue or null

getUserLocale

protected Locale getUserLocale()
This method will return the user local of the request.

Returns:
the Locale object to use when rendering this tag

getPageContext

protected PageContext getPageContext()
This method will attempt to cast the JspContext into a PageContext. If this fails, it will log an exception.

Returns:
PageContext

write

protected final void write(String string)
                    throws JspException
This mehod will write the passed string to the response.

Parameters:
string - to be written to the response.
Throws:
JspException

registerTagError

public void registerTagError(String message,
                             Throwable e)
                      throws JspException
This will report an error from a tag. The error will contain a message. If error reporting is turned off, the message will be returned and the caller should throw a JspException to report the error.

Specified by:
registerTagError in interface INetuiTag
Parameters:
message - - the message to register with the error
Throws:
JspException - - if in-page error reporting is turned off this method will always throw a JspException.

registerTagError

public void registerTagError(AbstractPageError error)
                      throws JspException
Specified by:
registerTagError in interface INetuiTag
Throws:
JspException

hasErrors

protected boolean hasErrors()
This method will return true if there have been any errors registered on this tag. Otherwise it returns false

Returns:
true if errors have been reported on this tag.

reportErrors

protected void reportErrors()
                     throws JspException
This method will write out the String returned by getErrorsReport to the response output stream.

Throws:
JspException - if write throws an exception.
See Also:
write(java.lang.String)

getInlineError

protected String getInlineError()

getScriptReporter

protected IScriptReporter getScriptReporter()
Return the closest ScriptReporter in the parental chain. Searching starts at this node an moves upward through the parental chain.

Returns:
a ScriptReporter or null if there is not one found.

getHtmlTag

protected IScriptReporter getHtmlTag(ServletRequest req)
This method will return the scriptReporter that is represented by the HTML tag.

Returns:

rewriteName

protected final String rewriteName(String name)
This method will rewrite the name (id) by passing it to the URL Rewritter and getting back a value.

Parameters:
name - the name that will be rewritten
Returns:
a name that has been rewritten by the URLRewriterService.

getIdForTagId

protected final String getIdForTagId(String tagId)
This method will generate a real id based upon the passed in tagId. The generated id will be constucted by searching upward for all the script containers that have a scope id set. These will form a fully qualified id.

Parameters:
tagId - The base tagId set on a tag
Returns:
an id value formed by considering all of the scope id's found in the tag hierarchy.