com.ge.research.html
Class SelectTag

java.lang.Object
  extended bycom.ge.research.html.HTMLTag
      extended bycom.ge.research.html.SelectTag

public class SelectTag
extends HTMLTag

Encapsulates all the attributes of an HTML "SELECT" element, its accessors, validations, and default values.

Version:
$Revision: 1.1 $ $Date: 2006/08/11 00:17:31 $
Author:
garbiras
Created on:
Sep 9, 2002

Field Summary
 
Fields inherited from class com.ge.research.html.HTMLTag
HORIZONTAL_LINE, LINEBREAK, reconstructTag, tag, WHITESPACE
 
Constructor Summary
SelectTag()
          Default constructor.
 
Method Summary
 void addOption(OptionTag opt)
          Adds an option to the list of options within the selection.
 boolean getDisabled()
          Returns the value of the HTML Tag DISABLED attribute.
 boolean getMultiple()
          Returns the value of the HTML Tag MULTIPLE attribute.
 java.lang.String getName()
          Returns the value of the HTML Tag NAME attribute.
 int getNumOptions()
          Returns the current count of the number of options in this selection.
 java.lang.String getOnAfterChange()
          Returns the value of the HTML Tag ONAFTERCHANGE behavior.
 java.lang.String getOnBeforeChange()
          Returns the value of the HTML Tag ONBEFORECHANGE behavior.
 java.lang.String getOnChange()
          Returns the value of the HTML Tag ONCHANGE behavior.
 OptionTag getOption(int index)
          Returns the option at the specified index within the list.
 java.util.List getOptions()
          Returns the List of options for this selection.
 java.lang.String getOptionString(int index)
          Returns the string representation of the option at the specified index within the list.
 int getSize()
          Returns the value of the HTML Tag SIZE attribute.
 boolean removeOption(int index)
          Removes the option at the specified index within the list.
 void removeOptions()
          Removes all options from the list of options within the selection.
protected  void resetTagSpecificInformation()
          Resets the tag attributes and content of the HTML Tag to their default values.
 void setDisabled(boolean attribute)
          Sets the HTML Tag DISABLED attribute.
 void setMultiple(boolean attribute)
          Sets the HTML Tag MULTIPLE attribute.
 void setName(java.lang.String attribute)
          Sets the HTML Tag NAME attribute.
 void setOnAfterChange(java.lang.String attribute)
          Sets the HTML Tag ONAFTERCHANGE behavior.
 void setOnBeforeChange(java.lang.String attribute)
          Sets the HTML Tag ONBEFORECHANGE behavior.
 void setOnChange(java.lang.String attribute)
          Sets the HTML Tag ONCHANGE behavior.
 void setOptions(java.util.List list)
          Sets the list of options within the selection.
 void setSize(int attribute)
          Sets the HTML Tag SIZE attribute.
protected  void writeTagSpecificAttributes()
          Adds the tag specific attribute information to the HTML Tag.
protected  void writeTagSpecificData()
          Adds the tag content to the HTML Tag.
 
Methods inherited from class com.ge.research.html.HTMLTag
addAttribute, addAttribute, getId, getOnClick, getOnContextMenu, getOnDblClick, getOnDrag, getOnDragEnd, getOnDragStart, getOnFocus, getOnFocusOut, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getOnMoveEnd, getOnMoveStart, getStyle, getStyleClass, getTitle, removeAttribute, reset, setId, setOnClick, setOnContextMenu, setOnDblClick, setOnDrag, setOnDragEnd, setOnDragStart, setOnFocus, setOnFocusOut, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setOnMoveEnd, setOnMoveStart, setStyle, setStyleClass, setTitle, toString, writeAttribute, writeAttribute, writeAttribute, writeAttribute, writeAttribute, writeAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectTag

public SelectTag()
Default constructor. Calls super(TagPropertyConstants.SELECT_TAG).

See Also:
TagPropertyConstants.SELECT_TAG
Method Detail

addOption

public void addOption(OptionTag opt)
Adds an option to the list of options within the selection. Increments the current count of options within the selection. Sets the value of the HTMLTag.reconstructTag to true

Parameters:
opt - the option to add to the selection
See Also:
HTMLTag.reconstructTag

getDisabled

public boolean getDisabled()
Returns the value of the HTML Tag DISABLED attribute.

Returns:
true if the tag is disabled; false if the tag is enabled

getMultiple

public boolean getMultiple()
Returns the value of the HTML Tag MULTIPLE attribute.

Returns:
true if the tag allows multiple selections; false if the tag allows at most a single selection

getName

public java.lang.String getName()
Returns the value of the HTML Tag NAME attribute.

Returns:
The current value of the HTML Tag NAME attribute

getNumOptions

public int getNumOptions()
Returns the current count of the number of options in this selection. The count is incremented and decremented after each "add" and "remove" method executes, so that the count is always accurate and does not have to be computed each time it is requested.

Returns:
The number of options currently within the selection

getOnChange

public java.lang.String getOnChange()
Returns the value of the HTML Tag ONCHANGE behavior.

Returns:
The current value of the HTML Tag ONCHANGE behavior

getOnBeforeChange

public java.lang.String getOnBeforeChange()
Returns the value of the HTML Tag ONBEFORECHANGE behavior.

Returns:
The current value of the HTML Tag ONBEFORECHANGE behavior

getOnAfterChange

public java.lang.String getOnAfterChange()
Returns the value of the HTML Tag ONAFTERCHANGE behavior.

Returns:
The current value of the HTML Tag ONAFTERCHANGE behavior

getOption

public OptionTag getOption(int index)
                    throws java.lang.IndexOutOfBoundsException
Returns the option at the specified index within the list.

Parameters:
index - the index of the list of options to extract
Returns:
The option at the specified index
Throws:
java.lang.IndexOutOfBoundsException - If index is negative or if index is greater than or equal to the value of getNumOptions()

getOptions

public java.util.List getOptions()
Returns the List of options for this selection. Each element of the List is of type OptionTag

Returns:
The List of options, of type OptionTag, within the selection

getOptionString

public java.lang.String getOptionString(int index)
                                 throws java.lang.IndexOutOfBoundsException
Returns the string representation of the option at the specified index within the list.

Parameters:
index - the index of the list of options to extract
Returns:
The string representation of the option object at the specified index
Throws:
java.lang.IndexOutOfBoundsException - If index is negative or if index is greater than or equal to the value of getNumOptions()
See Also:
getOption(int)

getSize

public int getSize()
Returns the value of the HTML Tag SIZE attribute.

Returns:
The current value of the HTML Tag SIZE attribute

removeOption

public boolean removeOption(int index)
                     throws java.lang.IndexOutOfBoundsException
Removes the option at the specified index within the list. Decrements the current count of options within the table. Sets the value of the HTMLTag.reconstructTag to true

Parameters:
index - the index of the list of options to remove
Returns:
true if the option was successfully removed; otherwise an exception is thrown
Throws:
java.lang.IndexOutOfBoundsException - If index is negative or if index is greater than or equal to the value of getNumOptions()
See Also:
HTMLTag.reconstructTag

removeOptions

public void removeOptions()
Removes all options from the list of options within the selection. Updates the current option count to zero. Sets the value of the HTMLTag.reconstructTag to true

See Also:
HTMLTag.reconstructTag

setDisabled

public void setDisabled(boolean attribute)
Sets the HTML Tag DISABLED attribute. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - true if this HTML Tag should be disabled; false if this HTML Tag should be enabled.
See Also:
HTMLTag.reconstructTag

setMultiple

public void setMultiple(boolean attribute)
Sets the HTML Tag MULTIPLE attribute. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - true if this HTML Tag should allow multiple selections; false if this HTML Tag should allow at most a single selection.
See Also:
HTMLTag.reconstructTag

setName

public void setName(java.lang.String attribute)
Sets the HTML Tag NAME attribute. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - the new value for the HTML Tag NAME attribute
See Also:
HTMLTag.reconstructTag

setOnChange

public void setOnChange(java.lang.String attribute)
Sets the HTML Tag ONCHANGE behavior. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - the new value for the HTML Tag ONCHANGE behavior
See Also:
HTMLTag.reconstructTag

setOnBeforeChange

public void setOnBeforeChange(java.lang.String attribute)
Sets the HTML Tag ONBEFORECHANGE behavior. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - the new value for the HTML Tag ONBEFORECHANGE behavior
See Also:
HTMLTag.reconstructTag

setOnAfterChange

public void setOnAfterChange(java.lang.String attribute)
Sets the HTML Tag ONAFTERCHANGE behavior. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - the new value for the HTML Tag ONAFTERCHANGE behavior
See Also:
HTMLTag.reconstructTag

setOptions

public void setOptions(java.util.List list)
                throws java.lang.ClassCastException
Sets the list of options within the selection. If list is not null or empty, checks to make sure that all elements of list are of type OptionTag. If so, it first removes all previously existing options, updating the current option count to zero. Then it adds the contents of the list argument to the list of options, in the same order as they appear in list. If during this operation an element of list is found to not be of type OptionTag, then the option list is purged and an exception is thrown.

Parameters:
list - the new list of options for this selection
Throws:
java.lang.ClassCastException - If any elements of list are not of type OptionTag. If this is found to be the case prior to attempting to add the list contents to this tag, then the original list of options is left unchanged. If however this is found during updating the option list, then the entire list is purged.
See Also:
removeOptions(), addOption(com.ge.research.html.OptionTag)

setSize

public void setSize(int attribute)
Sets the HTML Tag SIZE attribute. Sets the value of the HTMLTag.reconstructTag to true.

Parameters:
attribute - the new value for the HTML Tag SIZE attribute
See Also:
HTMLTag.reconstructTag

resetTagSpecificInformation

protected void resetTagSpecificInformation()
Description copied from class: HTMLTag
Resets the tag attributes and content of the HTML Tag to their default values. Called by HTMLTag.reset(). This method is not implemented in HTMLTag. Subclasses that contain tag content information should implement this method to set their information to their default values.

Overrides:
resetTagSpecificInformation in class HTMLTag
See Also:
HTMLTag.reset()

writeTagSpecificAttributes

protected void writeTagSpecificAttributes()
Description copied from class: HTMLTag
Adds the tag specific attribute information to the HTML Tag. Called by HTMLTag.toString(). This method is not implemented in HTMLTag. Subclasses that contain additional attribute information should implement this method to write those attributes in the inline tag.

Overrides:
writeTagSpecificAttributes in class HTMLTag
See Also:
HTMLTag.toString()

writeTagSpecificData

protected void writeTagSpecificData()
Description copied from class: HTMLTag
Adds the tag content to the HTML Tag. Called by HTMLTag.toString(). This method is not implemented in HTMLTag. Subclasses that contain tag content information should implement this method to writeout that content in between the opening and closing tags.

Overrides:
writeTagSpecificData in class HTMLTag
See Also:
HTMLTag.toString()