it.eng.spago.taglib.html
Class OptionsCollectionTag

java.lang.Object
  extended by TagSupport
      extended by it.eng.spago.taglib.html.OptionsCollectionTag

public class OptionsCollectionTag
extends TagSupport

Tag for creating multiple <select> options from a collection. The collection may be part of the enclosing form, or may be independent of the form. Each element (SourceBean) of the collection must expose a 'label' and a 'value', the attribute names of which are configurable by attributes of this tag.

If "isLabelKey" is valorized to true the "label" is used to retrieve a message from the resource bundle.

Since:
Struts 1.1
Version:
$Rev: 376841 $ $Date: 2004-11-03 14:20:47 -0500 (Wed, 03 Nov 2004) $

Field Summary
protected  boolean filter
          Should the label values be filtered for HTML sensitive characters?
protected  java.lang.String isLabelKey
          Say if label are to be used as keys to retrive from bundle
protected  java.lang.String label
          The name of the bean property containing the label.
protected  java.lang.String listAttribute
           
protected static MessageBundleReference messages
          The message resources for this package.
protected  java.lang.String paramName
          The attribute paramName is used in conjunction with the attribute paramValue and the attribute listAttribute to filter a SourceBeanAttribute.
protected  java.lang.String paramValue
           
protected  java.lang.String property
          The name of the property to use to build the values collection.
protected  java.lang.String value
          The name of the bean property containing the value.
 
Constructor Summary
OptionsCollectionTag()
           
 
Method Summary
protected  void addOption(java.lang.StringBuffer sb, java.lang.String label, java.lang.String value, boolean matched)
          Add an option element to the specified StringBuffer based on the specified parameters.
 int doStartTag()
          Process the start of this tag.
 boolean getFilter()
           
 java.lang.String getIsLabelKey()
           
protected  java.util.Iterator getIterator(java.lang.Object collection)
          Return an iterator for the options collection.
 java.lang.String getLabel()
           
 java.lang.String getListAttribute()
           
 java.lang.String getParamName()
           
 java.lang.String getParamValue()
           
 java.lang.String getProperty()
           
 java.lang.String getScope()
           
 java.lang.String getStyle()
           
 java.lang.String getStyleClass()
           
 java.lang.String getValue()
           
 void release()
          Release any acquired resources.
 void setFilter(boolean filter)
           
 void setIsLabelKey(java.lang.String isLabelKeys)
           
 void setLabel(java.lang.String label)
           
 void setListAttribute(java.lang.String listAttribute)
           
 void setParamName(java.lang.String paramName)
           
 void setParamValue(java.lang.String paramValue)
           
 void setProperty(java.lang.String property)
           
 void setScope(java.lang.String scope)
           
 void setStyle(java.lang.String style)
           
 void setStyleClass(java.lang.String styleClass)
           
 void setValue(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected static MessageBundleReference messages
The message resources for this package.


filter

protected boolean filter
Should the label values be filtered for HTML sensitive characters?


label

protected java.lang.String label
The name of the bean property containing the label.


listAttribute

protected java.lang.String listAttribute
See Also:
paramName

isLabelKey

protected java.lang.String isLabelKey
Say if label are to be used as keys to retrive from bundle


paramName

protected java.lang.String paramName
The attribute paramName is used in conjunction with the attribute paramValue and the attribute listAttribute to filter a SourceBeanAttribute. In this way is possible to navigate a SourceBean to a path that indicate a list of SourceBeanAttribute to filter; the filter is rappresented with the pair (paramName, paramValue). If the obtained attribute contain a list identified by listAttribute, this list is returned.


paramValue

protected java.lang.String paramValue
See Also:
paramName

property

protected java.lang.String property
The name of the property to use to build the values collection.


value

protected java.lang.String value
The name of the bean property containing the value.

Constructor Detail

OptionsCollectionTag

public OptionsCollectionTag()
Method Detail

getFilter

public boolean getFilter()

setFilter

public void setFilter(boolean filter)

getLabel

public java.lang.String getLabel()

setLabel

public void setLabel(java.lang.String label)

getProperty

public java.lang.String getProperty()

setProperty

public void setProperty(java.lang.String property)

getStyle

public java.lang.String getStyle()

setStyle

public void setStyle(java.lang.String style)

getStyleClass

public java.lang.String getStyleClass()

setStyleClass

public void setStyleClass(java.lang.String styleClass)

getValue

public java.lang.String getValue()

setValue

public void setValue(java.lang.String value)

doStartTag

public int doStartTag()
               throws JspException
Process the start of this tag.

Throws:
JspException - if a JSP exception has occurred

release

public void release()
Release any acquired resources.


addOption

protected void addOption(java.lang.StringBuffer sb,
                         java.lang.String label,
                         java.lang.String value,
                         boolean matched)
                  throws JspException
Add an option element to the specified StringBuffer based on the specified parameters.

Note that this tag specifically does not support the styleId tag attribute, which causes the HTML id attribute to be emitted. This is because the HTML specification states that all "id" attributes in a document have to be unique. This tag will likely generate more than one option element element, but it cannot use the same id value. It's conceivable some sort of mechanism to supply an array of id values could be devised, but that doesn't seem to be worth the trouble.

If "isLabelKey" is valorized to true the "label" is used to retrieve a message from the resource bundle.

Parameters:
sb - StringBuffer accumulating our results
value - Value to be returned to the server for this option
label - Value to be shown to the user for this option
matched - Should this value be marked as selected?
Throws:
JspException

getIterator

protected java.util.Iterator getIterator(java.lang.Object collection)
                                  throws JspException
Return an iterator for the options collection.

Parameters:
collection - Collection to be iterated over
Throws:
JspException - if an error occurs

getIsLabelKey

public java.lang.String getIsLabelKey()

setIsLabelKey

public void setIsLabelKey(java.lang.String isLabelKeys)

getScope

public java.lang.String getScope()

setScope

public void setScope(java.lang.String scope)

getParamName

public java.lang.String getParamName()

setParamName

public void setParamName(java.lang.String paramName)

getParamValue

public java.lang.String getParamValue()

setParamValue

public void setParamValue(java.lang.String paramValue)

getListAttribute

public java.lang.String getListAttribute()

setListAttribute

public void setListAttribute(java.lang.String listAttribute)