org.apache.beehive.netui.tags.html
Class HtmlGroupBaseTag

Object
  extended by TagSupport
      extended by BodyTagSupport
          extended by AbstractClassicTag
              extended by HtmlGroupBaseTag
All Implemented Interfaces:
Serializable, BodyTag, IterationTag, JspTag, Tag, IDataAccessProvider, HtmlConstants, IAttributeConsumer, INetuiTag
Direct Known Subclasses:
CheckBoxGroup, RadioButtonGroup

public abstract class HtmlGroupBaseTag
extends AbstractClassicTag
implements IDataAccessProvider, HtmlConstants, IAttributeConsumer

Abstract base class that provides the dataSource, defaultValue, and optionsDataSource attributes.

See Also:
Serialized Form

Field Summary
protected  ConstantRendering _cr
           
protected  String _dataSource
           
protected  Object _defaultValue
           
protected  boolean _disabled
           
protected  String _labelStyle
           
protected  String _labelStyleClass
           
protected  Object _optionsDataSource
           
protected  Object _repCurItem
           
protected  boolean _repeater
           
protected  int _repIdx
           
 String HORIZONTAL_VALUE
          Constant defining a horizontal layout of the options.
 String VERTICAL_VALUE
          Constant defining a vertical layout of the options.
 
Fields inherited from class AbstractClassicTag
DefaultNamingChain, EMPTY_STRING, NETUI_UNIQUE_CNT
 
Fields inherited from class BodyTagSupport
bodyContent
 
Fields inherited from class TagSupport
id, pageContext
 
Fields inherited from interface HtmlConstants
ABBR, ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, AREA, AXIS, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COLSPAN, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEADERS, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LANGUAGE, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, ROWSPAN, RULES, SCOPE, SCRIPT, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TBODY, TD, TEXT, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
HtmlGroupBaseTag()
           
 
Method Summary
protected  void addOption(AbstractRenderAppender buffer, String type, String optionValue, String optionDisplay, int idx, String altText, char accessKey, boolean disabled)
          This will create a new option in the HTML.
protected  String doNaming()
           
protected  Object evaluateDataSource()
          Return the Object that is represented by the specified data source.
protected  Object evaluateOptionsDataSource()
          Return the real value of the optionDataSource attribute.
 int getCurrentIndex()
          Get the current index in this iteration.
 Object getCurrentItem()
          Get the current data item in this IDataAccessProvider.
 Object getCurrentMetadata()
          Get a metadata object for the current item.
 String getDataSource()
          Gets the tag's data source (can be an expression).
 String getLabelStyle()
          Return the label style for each contained CheckBoxOption..
 String getLabelStyleClass()
          Return the label style class for each contained CheckBoxOption..
protected  List getNamingChain()
          Return an ArrayList which represents a chain of INameInterceptor objects.
 Object getOptionsDataSource()
          Gets the options datasource value (an expression).
 IDataAccessProvider getProviderParent()
          Get the parent IDataAccessProvider of a IDataAccessProvider.
 String getQualifiedDataSourceName()
          Return the qualified name of the checkBoxGroup.
 boolean isDisabled()
          Returns the boolean value or expression indicating the disable state of the RadioButtonGroup.
abstract  boolean isMatched(String value, Boolean defaultValue)
           
 boolean isRepeater()
          Gets whether a repeating contained options is on.
 boolean isVertical()
          Returns true if vertical layout is set.
protected  void localRelease()
          Release any acquired resources.
 void setAttribute(String name, String value, String facet)
          Base support for the attribute tag.
 void setDataSource(String dataSource)
          Sets the tag's data source (can be an expression).
 void setDefaultValue(Object defaultValue)
          Sets the default value (can be an expression).
 void setDisabled(boolean disabled)
          Set the disable state either with the literal "true" or "false" or with an expression.
 void setLabelStyle(String labelStyle)
          Set the label style for each contained CheckBoxOption.
 void setLabelStyleClass(String labelStyleClass)
          Set the label style class for each contained CheckBoxOption.
 void setOptionsDataSource(Object optionsDataSource)
          Sets the options datasource value (an expression).
 void setOrientation(String orientation)
          Set the orientation of the resulting options group.
 void setRepeater(boolean repeater)
          Set whether repeating of contains options is on.
 void setStyle(String style)
          Sets the style of the rendered html tag.
 void setStyleClass(String styleClass)
          Sets the style class of the rendered html tag.
 
Methods inherited from class AbstractClassicTag
applyNamingChain, getErrorsReport, getIdForTagId, getNextId, getScriptReporter, getTagName, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write
 
Methods inherited from class BodyTagSupport
doAfterBody, doEndTag, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent
 
Methods inherited from class TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Tag
getParent, setPageContext, setParent
 

Field Detail

HORIZONTAL_VALUE

public final String HORIZONTAL_VALUE
Constant defining a horizontal layout of the options.

See Also:
Constant Field Values

VERTICAL_VALUE

public final String VERTICAL_VALUE
Constant defining a vertical layout of the options.

See Also:
Constant Field Values

_cr

protected ConstantRendering _cr

_dataSource

protected String _dataSource

_defaultValue

protected Object _defaultValue

_optionsDataSource

protected Object _optionsDataSource

_disabled

protected boolean _disabled

_labelStyle

protected String _labelStyle

_labelStyleClass

protected String _labelStyleClass

_repeater

protected boolean _repeater

_repIdx

protected int _repIdx

_repCurItem

protected Object _repCurItem
Constructor Detail

HtmlGroupBaseTag

public HtmlGroupBaseTag()
Method Detail

isMatched

public abstract boolean isMatched(String value,
                                  Boolean defaultValue)
Parameters:
value -
Returns:
boolean

setAttribute

public void setAttribute(String name,
                         String value,
                         String facet)
                  throws JspException
Base support for the attribute tag. This is overridden to prevent setting the href attribute. The checkBoxGroup and radioButtonGroup support two facets, input and span. The input is the default and will attach attributes to the <input> element. The span facet will attach attributes to the <span> elements which represents the label.

Specified by:
setAttribute in interface IAttributeConsumer
Parameters:
name - The name of the attribute. This value may not be null or the empty string.
value - The value of the attribute. This may contain an expression.
facet - The name of a facet to which the attribute will be applied. This is optional.
Throws:
JspException - A JspException may be thrown if there is an error setting the attribute.

getQualifiedDataSourceName

public final String getQualifiedDataSourceName()
                                        throws JspException
Return the qualified name of the checkBoxGroup. The qualified name is the created by calling doNaming().

Returns:
the qualified name based upon the dataSource name.
Throws:
JspException

isDisabled

public boolean isDisabled()
Returns the boolean value or expression indicating the disable state of the RadioButtonGroup.

Returns:
the disabled state (true or false) or an expression

setDisabled

public void setDisabled(boolean disabled)
Set the disable state either with the literal "true" or "false" or with an expression.

Parameters:
disabled - - true or false or an expression

setOrientation

public void setOrientation(String orientation)
Set the orientation of the resulting options group. The layout will be either horizontal or vertical. The default is horizontal.

Parameters:
orientation - - true or false or an expression

isVertical

public boolean isVertical()
Returns true if vertical layout is set.

Returns:
true if vertical layout is set

setRepeater

public void setRepeater(boolean repeater)
Set whether repeating of contains options is on.

Parameters:
repeater - - the repeater value ("true" or "false")

isRepeater

public boolean isRepeater()
Gets whether a repeating contained options is on.

Returns:
the repeater value

setStyle

public void setStyle(String style)
Sets the style of the rendered html tag.

Parameters:
style - - the html style.

setStyleClass

public void setStyleClass(String styleClass)
Sets the style class of the rendered html tag.

Parameters:
styleClass - - the html style class.

getLabelStyle

public String getLabelStyle()
Return the label style for each contained CheckBoxOption..

Returns:
the label style

setLabelStyle

public void setLabelStyle(String labelStyle)
Set the label style for each contained CheckBoxOption.

Parameters:
labelStyle - - the label style

getLabelStyleClass

public String getLabelStyleClass()
Return the label style class for each contained CheckBoxOption..

Returns:
the label style

setLabelStyleClass

public void setLabelStyleClass(String labelStyleClass)
Set the label style class for each contained CheckBoxOption.

Parameters:
labelStyleClass - - the label style

setDataSource

public void setDataSource(String dataSource)
                   throws JspException
Sets the tag's data source (can be an expression).

Parameters:
dataSource - the data source
Throws:
JspException

getDataSource

public String getDataSource()
Gets the tag's data source (can be an expression).

Specified by:
getDataSource in interface IDataAccessProvider
Returns:
the data source

getCurrentIndex

public int getCurrentIndex()
Get the current index in this iteration. This should be a zero based integer that increments after each iteration.

Specified by:
getCurrentIndex in interface IDataAccessProvider
Returns:
the current index of iteration or 0

getCurrentItem

public Object getCurrentItem()
Get the current data item in this IDataAccessProvider.

Specified by:
getCurrentItem in interface IDataAccessProvider
Returns:
the current data item or null

getCurrentMetadata

public Object getCurrentMetadata()
Get a metadata object for the current item. This interface is optional, and implementations of this interface are provided by the IDataAccessProvider interface. See these implementations for information about their support for current item metadata.

Specified by:
getCurrentMetadata in interface IDataAccessProvider
Returns:
the current metadata or null if no metadata can be found or metadata is not supported by a IDataAccessProvider implementation

getProviderParent

public IDataAccessProvider getProviderParent()
Get the parent IDataAccessProvider of a IDataAccessProvider. A IDataAccessProvider implementation may be able to nest IDataAccessProviders. In this case, it can be useful to be able to also nest access to data from parent providers. Implementations of this interface are left with having to discover and export parents. The return value from this call on an implementing Object can be null.

Specified by:
getProviderParent in interface IDataAccessProvider
Returns:
the parent IDataAccessProvider or null if this method is not supported or the parent can not be found.

getNamingChain

protected List getNamingChain()
Return an ArrayList which represents a chain of INameInterceptor objects. This method by default returns null and should be overridden by objects that support naming.

Overrides:
getNamingChain in class AbstractClassicTag
Returns:
an ArrayList that will contain INameInterceptor objects.

evaluateDataSource

protected Object evaluateDataSource()
                             throws JspException
Return the Object that is represented by the specified data source.

Returns:
Object
Throws:
JspException

doNaming

protected String doNaming()
                   throws JspException
Throws:
JspException

setDefaultValue

public void setDefaultValue(Object defaultValue)
                     throws JspException
Sets the default value (can be an expression).

Parameters:
defaultValue - - the default value
Throws:
JspException

getOptionsDataSource

public Object getOptionsDataSource()
Gets the options datasource value (an expression).

Returns:
the options datasource

setOptionsDataSource

public void setOptionsDataSource(Object optionsDataSource)
                          throws JspException
Sets the options datasource value (an expression).

Parameters:
optionsDataSource - - the options datasource
Throws:
JspException

evaluateOptionsDataSource

protected Object evaluateOptionsDataSource()
                                    throws JspException
Return the real value of the optionDataSource attribute. The value returned will always be an instance of Iterator This value reflects the result of expression evaluation on the options data source.

Returns:
the object that represents the options data source.
Throws:
JspException

addOption

protected void addOption(AbstractRenderAppender buffer,
                         String type,
                         String optionValue,
                         String optionDisplay,
                         int idx,
                         String altText,
                         char accessKey,
                         boolean disabled)
                  throws JspException
This will create a new option in the HTML.

Throws:
JspException

localRelease

protected void localRelease()
Release any acquired resources.

Overrides:
localRelease in class AbstractClassicTag