com.taggercat.tags
Class DataSourceOptionListTag

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

public class DataSourceOptionListTag
extends AbstractExpEvalTag

This tag creates an option list that is filled from a Datasource rather than from a application code table. The data source is filterable, and can be any data source that is defined in the user's model object.

The condition filter for the data source can be any valid expression supported by the expression evaluator.

After the option list is completed, and a selected tcEntity is set, the data source cursor is then set to the selected item's tcEntity.

You can later use this selected value in subsequent expressions.

 <select name="Part Selection" style="WIDTH:120px" >
  <tc:dsOptionList dsn='partType' displayField='type' codeField='typeID'
   selectedFK='orderitem.partId' condition='partType.typeID NE 12' />
  </select>
 

Example with QBF field.

 <select name='employees.qbf.EmpType' style='WIDTH:120px'>
    <tc:dsOptionList dsn='employeeType' codeField='id' displayField='name'
    emptyItem='true'
    selected='employees.qbf.EmpTypeId'/>
  </select>
 

Example with option groups.

<tc:listmenu dsn='MetaProperty' field='codeTable' style='width:80%' > <optgroup label="Regular Code Table" > <tc:listOptionList listVar="pageScope.codeTableEntityNames" emptyItem="true" /> </optgroup> <optgroup label="Global Code Table" > <tc:dsOptionList dsn="CodedList" codeField="name" displayField="name" /> </optgroup> </tc:listmenu >

Example with an expression for selected.

<select name="userDefinedSearch.rowID" size="1" onchange="tcSubmitRequest( document.form1,'${param.dsName}','selectUserDefinedSearch' )" style="width:200px;" > <option value="-1">-- None Selected --</option> <tc:dsOptionList dsn="userDefinedSearch" displayField="searchName" selected="${ sessionScope.ctsSelectedSearches[requestScope.currentTemplateGUID] }" condition="userDefinedSearch.guid= requestScope.currentTemplateGUID " /> </select>

Simple list with a condition expression.

<tc:listmenu dsn='csvColMapping' field='doattributeName' style='WIDTH:160px' > <tc:dsOptionList dsn="validCSVDOAttribute" displayField="attributeName" codeField="attributeName" emptyItem="true" condition="validCSVDOAttribute.validcsvdataobject = csvImportDef.validcsvdataobject" /> </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
DataSourceOptionListTag()
           
 
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 getCodeField()
          Gets the sources data source name.
 java.lang.String getDisplayField()
          Gets the name of the display field.
 java.lang.String getDsn()
          Gets the sources data source name.
 java.lang.String getFilter()
          Gets the filter expression string.
 java.lang.String getSelected()
          Gets the selected item.
 java.lang.String getSelectedFK()
          Gets the selectedFK attribute.
 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 setCodeField(java.lang.String codeField)
          Sets the code Field name attribute option items.
 void setCondition(java.lang.String expression)
          Sets the condition filter to be applied to source data source.
 void setDisplayField(java.lang.String displayField)
          Sets the display field name attribute for the option items.
 void setDsn(java.lang.String dsn)
          Set the name of the source data source used to fill the option list.
 void setEmptyItem(boolean emptyItem)
          Set to true to add an empty item to the option list.
 void setSelected(java.lang.String selected)
          Sets the selected attribute.
 void setSelectedFK(java.lang.String selectedFK)
          Sets the selectedFK 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.
 void setTitleProperty(java.lang.String titleProperty)
           
 java.lang.String toString()
          A string representation of this tag's attributes.
 
Methods inherited from class com.taggercat.tags.AbstractExpEvalTag
getModel, resolveProperty, setScope, setValue, setVar
 
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, wait, wait, wait
 

Constructor Detail

DataSourceOptionListTag

public DataSourceOptionListTag()
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 AbstractExpEvalTag
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 AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
SKIP_BODY

getCodeField

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

Returns:
the source data source

getDisplayField

public java.lang.String getDisplayField()
Gets the name of the display field.

Returns:
the name of the display field

getDsn

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

Returns:
the source data source

getFilter

public java.lang.String getFilter()
Gets the filter expression string.

Returns:
the filter expression

getSelected

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

Returns:
the selected item

getSelectedFK

public java.lang.String getSelectedFK()
Gets the selectedFK attribute.

Returns:
the selectedFK

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

setCodeField

public void setCodeField(java.lang.String codeField)
Sets the code Field name attribute option items.

Parameters:
codeField - The new codeField value

setCondition

public void setCondition(java.lang.String expression)
Sets the condition filter to be applied to source data source.

If a condition filter is not specified, then all rows from the source data source will be included in the option list.

Parameters:
expression - The filter expression

setDisplayField

public void setDisplayField(java.lang.String displayField)
Sets the display field name attribute for the option items.

Parameters:
displayField - The new displayField value

setDsn

public void setDsn(java.lang.String dsn)
Set the name of the source data source used to fill the option list.

Parameters:
dsn - The name of the source data source

setSelected

public void setSelected(java.lang.String selected)
Sets the selected attribute. This is a value that is used to match one of the code field in one of the rows of the source DSN.

If a selected value is not specified, then the selected tcEntity is matched using the selectedFK DSN & Field.

Parameters:
selected - The new selected value

setSelectedFK

public void setSelectedFK(java.lang.String selectedFK)
Sets the selectedFK attribute. This is a dot delimited name of the form DSN.FIELD. Where DSN is the name of a child table, and FIELD is the name of the of foreign key column in the child table. The selected attribute, and the selectedFK attributes are mutually exclusive.

If this value is specified, then the item selected in the list will be the one matching the foreign key value from the current tcEntity in the child table.

Parameters:
selectedFK - The selectedFK value

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

toString

public java.lang.String toString()
A string representation of this tag's attributes.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this tag's attributes

setTitleProperty

public void setTitleProperty(java.lang.String titleProperty)