com.cc.framework.taglib.base
Class OptionTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended bycom.cc.framework.taglib.base.OptionTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag

public class OptionTag
extends javax.servlet.jsp.tagext.BodyTagSupport

Tag handler for the option Tag. The tag generates one single option element with the help of a data model for a <html:select>- or <forms:select>-tag. The tag can thereby process some of the basic data types of the framework.

Since:
1.5.000
Version:
$Revision: 1.11 $
Author:
Harald Schulz
See Also:
Serialized Form

Field Summary
private  boolean disabled
          Is this option disabled?
private  boolean filter
          Specifies if all Strings should be converted into there HTML representation
private  java.lang.String key
          The options value
private  java.lang.String label
          The options text
private  boolean labelRaw
          This flag indicates that the text is set from the tag body
private  org.apache.commons.logging.Log log
          Commons Logging instance.
private  int maxlength
          The maximum String length
private static long serialVersionUID
          Serial Version UID
private static java.lang.Class strutsSelectTag
          Select Tag of the struts framework
private  java.lang.String style
          The style associated with this tag.
private  java.lang.String styleClass
          The named style class associated with this tag.
private  java.lang.String styleId
          The identifier associated with this tag.
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
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
OptionTag()
          Constructor
 
Method Summary
 int doAfterBody()
          Process the body text of this tag (if any).
 int doEndTag()
           
 int doStartTag()
           
 void release()
           
protected  java.lang.String renderOptionElement(OptionsComparator cmp)
          Generate an HTML <option> element.
 void setDisabled(boolean disabled)
          Marks this option as disabled
 void setDisabled(java.lang.String disabled)
          Marks this option as disabled
 void setFilter(java.lang.String filter)
          The automatic HTML coding of the column contents can be activated or disabled with the filter-attribute.
 void setKey(java.lang.String key)
          Specifies the options key.
 void setLabel(java.lang.String label)
          Specifies the label text for the option
 void setMaxlength(int maxlength)
          Specifies the maximum number of characters that are displayed for the option elements
 void setMaxlength(java.lang.String maxlength)
          Specifies the maximum number of characters that are displayed for the option elements
 void setPageContext(javax.servlet.jsp.PageContext pc)
           
 void setStyle(java.lang.String style)
          An HTML-style can be directly specified with this attribute.
 void setStyleClass(java.lang.String styleClass)
          The HTML-class attribute of the element can be specified with this attribute.
 void setStyleId(java.lang.String styleId)
          Set the style identifier for this tag.
protected  java.lang.String text()
          Return the text to be displayed to the user for this option (if any).
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial Version UID

See Also:
Constant Field Values

strutsSelectTag

private static java.lang.Class strutsSelectTag
Select Tag of the struts framework


log

private transient org.apache.commons.logging.Log log
Commons Logging instance.


key

private java.lang.String key
The options value


label

private java.lang.String label
The options text


labelRaw

private boolean labelRaw
This flag indicates that the text is set from the tag body


maxlength

private int maxlength
The maximum String length


disabled

private boolean disabled
Is this option disabled?


style

private java.lang.String style
The style associated with this tag.


styleClass

private java.lang.String styleClass
The named style class associated with this tag.


styleId

private java.lang.String styleId
The identifier associated with this tag.


filter

private boolean filter
Specifies if all Strings should be converted into there HTML representation

Constructor Detail

OptionTag

public OptionTag()
Constructor

Method Detail

setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pc)
See Also:
Tag.setPageContext(PageContext pc)

release

public void release()
See Also:
Tag.release()

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Throws:
javax.servlet.jsp.JspException
See Also:
Tag.doStartTag()

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Process the body text of this tag (if any).

Returns:
SKIP_BODY
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Throws:
javax.servlet.jsp.JspException
See Also:
Tag.doEndTag()

renderOptionElement

protected java.lang.String renderOptionElement(OptionsComparator cmp)
                                        throws javax.servlet.jsp.JspException
Generate an HTML <option> element.

Parameters:
cmp - The options comparator to check if this option is selected
Returns:
HTML option element string
Throws:
javax.servlet.jsp.JspException - if a JSP exception has occurred

text

protected java.lang.String text()
                         throws javax.servlet.jsp.JspException
Return the text to be displayed to the user for this option (if any).

Returns:
the text to display for this option
Throws:
javax.servlet.jsp.JspException - if an error occurs

setStyle

public void setStyle(java.lang.String style)
An HTML-style can be directly specified with this attribute.

Parameters:
style - The style to set

setStyleClass

public void setStyleClass(java.lang.String styleClass)
The HTML-class attribute of the element can be specified with this attribute.

Parameters:
styleClass - The styleClass to set

setStyleId

public void setStyleId(java.lang.String styleId)
Set the style identifier for this tag.

Parameters:
styleId - The new style identifier

setKey

public void setKey(java.lang.String key)
Specifies the options key.

Parameters:
key - The key

setLabel

public void setLabel(java.lang.String label)
Specifies the label text for the option

Parameters:
label - The options label

setMaxlength

public void setMaxlength(java.lang.String maxlength)
                  throws javax.servlet.jsp.JspException
Specifies the maximum number of characters that are displayed for the option elements

Parameters:
maxlength - The maximum number of characters
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to integer

setMaxlength

public void setMaxlength(int maxlength)
Specifies the maximum number of characters that are displayed for the option elements

Parameters:
maxlength - The maximum number of characters

setDisabled

public void setDisabled(java.lang.String disabled)
                 throws javax.servlet.jsp.JspException
Marks this option as disabled

Parameters:
disabled - Disabled state
Throws:
javax.servlet.jsp.JspException - If disabled is not a valid boolean value

setDisabled

public void setDisabled(boolean disabled)
Marks this option as disabled

Parameters:
disabled - Disabled state

setFilter

public void setFilter(java.lang.String filter)
               throws javax.servlet.jsp.JspException
The automatic HTML coding of the column contents can be activated or disabled with the filter-attribute. The default is true

Parameters:
filter - true if the column content should be HTML encoded.
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to boolean


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.