com.pushtotest.tool.parser.html
Class SelectElement

java.lang.Object
  extended by com.pushtotest.tool.parser.html.FormElementWrapper
      extended by com.pushtotest.tool.parser.html.SelectElement
All Implemented Interfaces:
FormElement, Selectable

public class SelectElement
extends FormElementWrapper
implements Selectable

This form element represents a Select element.


Constructor Summary
SelectElement()
           
 
Method Summary
 void addOption(OptionElement element)
          Adds an option form element to this select.
 java.util.List getOptions()
          Gets the list of options for this select.
 java.lang.String getType()
          The type of this element.
 java.lang.String getValueAsString()
          The value parameter as a string.
 java.util.List getValues()
          Returns a list of all of the selected options in this select element.
 boolean isSelected()
          Is this element selected, checked, etc.
 void select(boolean select)
          Sets the selection value of this element.
 void setMultiple(boolean multiple)
          Sets the multiple value to a boolean.
 void setValueAsString(java.lang.String value)
          Sets the value of this form element as a string representation.
 boolean supportsMultiple()
          Does this form element support multiple selections.
 java.lang.String toString()
          A string representation of this select element.
 
Methods inherited from class com.pushtotest.tool.parser.html.FormElementWrapper
getId, getLabel, getName, getParentForm, isXhtml, setId, setLabel, setName, setParentForm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SelectElement

public SelectElement()
Method Detail

getType

public java.lang.String getType()
The type of this element.

Specified by:
getType in interface FormElement
Specified by:
getType in class FormElementWrapper
Returns:
The type of this element.

getValueAsString

public java.lang.String getValueAsString()
The value parameter as a string.

Specified by:
getValueAsString in interface FormElement
Specified by:
getValueAsString in class FormElementWrapper
Returns:
The value of this element as a string.

getValues

public java.util.List getValues()
Returns a list of all of the selected options in this select element.

Returns:
a List of Strings that are the values of the selected elements.

setValueAsString

public void setValueAsString(java.lang.String value)
Sets the value of this form element as a string representation. Some elements might have other value setter methods, this is to insure that all of them have one common one.

Specified by:
setValueAsString in interface FormElement
Specified by:
setValueAsString in class FormElementWrapper
Parameters:
value - The value of the form element as a string.
Throws:
java.lang.IllegalArgumentException - If the value can not be parsed into a valid value.

addOption

public void addOption(OptionElement element)
Adds an option form element to this select.

Parameters:
element - The Option element to add to this select.

getOptions

public java.util.List getOptions()
Gets the list of options for this select.

Returns:
the List of option form elements.

toString

public java.lang.String toString()
A string representation of this select element.

Overrides:
toString in class java.lang.Object
Returns:
The string that is like this element.

isSelected

public boolean isSelected()
Is this element selected, checked, etc. This always returns false for the select element.

Specified by:
isSelected in interface Selectable
Returns:
Whether or not this element is selected.

select

public void select(boolean select)
Sets the selection value of this element. Some elements might not support multiple selects (e.g. radio), so calling this with true will cause them to possibly unselect other values. This is ignored in the select element.

Specified by:
select in interface Selectable
Parameters:
select - Whether or not this element should be selected.

setMultiple

public void setMultiple(boolean multiple)
Sets the multiple value to a boolean. Some implementations should ignore this setting because they will always or never support multiples.

Specified by:
setMultiple in interface Selectable
Parameters:
multiple - Sets the multiple value.

supportsMultiple

public boolean supportsMultiple()
Does this form element support multiple selections. Could be constant (e.g. checkbox would be true and radio would be false) or (like selects) could depend on parameters in the form element.

Specified by:
supportsMultiple in interface Selectable
Returns:
Whether this Selectable item supports multiple selections.