com.taggercat.tags
Class ListOptionListTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.taggercat.tags.ListOptionListTag
All Implemented Interfaces:
java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class ListOptionListTag
extends javax.servlet.jsp.tagext.TagSupport

This tag creates an option list that is filled from a List or Map object rather than from a code table, or other data source. The List or Map object can be in any accessible scope.

List objects are used where the stored value is the same as the display value. Map objects are used when the stored value is a key to the display value ( a coded value list ).

Alternatively, you can specify the list values setting the listOptions attribute to a comma-separated list. If the listOptions attribute is set in conjunction with the listVar attribute, and the listVar instance does not exist, then the listVar named scope variable will be created from the listOptions attribute list.

Example:

<select name="Part Selection" style="WIDTH:120px" >
 <tc:listOptionList dsn='partType' displayField='type'
 listVar='application.ExtraParts' /> </select>

Example with QBF field.

<select name='employees.qbf.EmpType' style='WIDTH:120px'>
   <tc:listOptionList listVar='session.ColorOptions' emptyItem='true'
   selected='employees.qbf.EmpType'/>
 </select>

Example with an explicit list.

<tc:listmenu  dsn='account' field='accountType' style='WIDTH:120px' >
     <tc:listOptionList listVar='applicationScope.accountTypes' listOptions='savings,checking,investment' />
 </tc:listmenu >

Example with an explicit map list.

<tc:listmenu  dsn='account' field='accountTypeId' style='WIDTH:120px' >
     <tc:listOptionList listVar='applicationScope.accountTypeCodes' mapOptions='1:savings,2:checking,3:investment' />
 </tc:listmenu >

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ListOptionListTag()
           
 
Method Summary
 int doEndTag()
          Resets the tags internal state.
 int doStartTag()
          Creates and the option list tags and sends them to the page.
 java.lang.String getDsn()
          Gets the sources data source name.
 java.lang.String getSelected()
          Gets the selected item.
 java.lang.String getSelectedStyleclass()
          Gets the CSS style class to be used to selected items in the option list.
 java.lang.String getStyleclass()
          Gets the CSS style class to be used to items in the option list.
 void setDsn(java.lang.String dsn)
          Set the name of the data source this field to test as a boolean ( optional ).
 void setEmptyItem(boolean emptyItem)
          Set to true to add an empty item to the option list.
 void setField(java.lang.String field)
          Sets the field name attribute ( optional ).
 void setListOptions(java.lang.String listOptions)
          Sets the listOptions attribute.
 void setListVar(java.lang.String listVar)
          Sets the listVar attribute .
 void setMapOptions(java.lang.String mapOptions)
          Sets the mapOptions attribute.
 void setMissingItemStyleclass(java.lang.String missingItemStyleclass)
          Sets the CSS style class to be used to display a missing, and selected items in the option list.
 void setSelected(java.lang.String selected)
          Sets the selected attribute.
 void setSelectedStyleclass(java.lang.String selectedStyleclass)
          Sets the CSS style class to be used to selected items in the option list.
 void setStyleclass(java.lang.String styleclass)
          Sets the CSS style class to be used to items in the option list.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListOptionListTag

public ListOptionListTag()
Method Detail

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Resets the tags internal state.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspException
Returns:
EVAL_PAGE

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Creates and the option list tags and sends them to the page.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspException
Returns:
SKIP_BODY

getDsn

public java.lang.String getDsn()
Gets the sources data source name.

Returns:
the source data source

getSelected

public java.lang.String getSelected()
Gets the selected item.

Returns:
the selected item

getSelectedStyleclass

public java.lang.String getSelectedStyleclass()
Gets the CSS style class to be used to selected items in the option list.

Returns:
the CSS style class to be used to selected items in the option list.

getStyleclass

public java.lang.String getStyleclass()
Gets the CSS style class to be used to items in the option list.

Returns:
the CSS style class to be used to items in the option list

setEmptyItem

public void setEmptyItem(boolean emptyItem)
Set to true to add an empty item to the option list.

Parameters:
emptyItem - The new codeField value

setDsn

public void setDsn(java.lang.String dsn)
Set the name of the data source this field to test as a boolean ( optional ).

Parameters:
dsn - the new dsn fieldValue

setField

public void setField(java.lang.String field)
Sets the field name attribute ( optional ).

Parameters:
field - the new field fieldValue

setListVar

public void setListVar(java.lang.String listVar)
Sets the listVar attribute .

Parameters:
listVar - the new listVar fieldValue

setSelected

public void setSelected(java.lang.String selected)
Sets the selected attribute. This is a value that is used to locate the current item in the option list. If a selected value is not specified, then the field value from the current tcEntity in the specified DSN is used.

Parameters:
selected - The new selected value

setListOptions

public void setListOptions(java.lang.String listOptions)
Sets the listOptions attribute. This is a comma-separated list of items to be used in the list. If you use this attribute without setting the listVar attribute, then the list is created with each tag instance. If you use this attribute, and set the listVar attribute, the list is created an saved to the listVar named scope attribute.

Parameters:
listOptions - The list of options

setMapOptions

public void setMapOptions(java.lang.String mapOptions)
Sets the mapOptions attribute. This attribute is a comma-separated string of name-value pairs of the form name1:value1,name2:value2,nameN:valueN and will be converted into a Map object. If you use this attribute without setting the listVar attribute, then the list is created with each tag instance. If you use this attribute, and set the listVar attribute, the list is created an saved to the listVar named scope attribute.

Parameters:
mapOptions - The map name-value pairs

setSelectedStyleclass

public void setSelectedStyleclass(java.lang.String selectedStyleclass)
Sets the CSS style class to be used to selected items in the option list.

Parameters:
selectedStyleclass - the CSS style class to be used to selected items in the option list.

setStyleclass

public void setStyleclass(java.lang.String styleclass)
Sets the CSS style class to be used to items in the option list.

Parameters:
styleclass - the CSS style class to be used to items in the option list

setMissingItemStyleclass

public void setMissingItemStyleclass(java.lang.String missingItemStyleclass)
Sets the CSS style class to be used to display a missing, and selected items in the option list. Where the missing item is defined as on that exists in the child data source but not in the list of options provided

Parameters:
missingItemStyleclass - the CSS style class to be used to missing items in the option list.