All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.util.html.SelectOption
java.lang.Object
|
+----com.ibm.as400.util.html.SelectOption
- public class SelectOption
- extends Object
- implements HTMLTagElement, Serializable
The SelectOption class represents an option in an HTML option form element.
The option form element is then used in an HTML select form element, which represents a group of
selectable options. The trailing slash "/" on the SelectOption tag allows it to conform to
the XHTML specification.
This example creates a SelectOption object named item1 that is initially selected.
SelectOption item1 = new SelectOption("Item1", "item1", true);
System.out.println(item1.getTag());
Here is the output of the SelectOption tag:
<option value="item1" selected="selected">Item1</option>
SelectOption objects generate the following events:
- PropertyChangeEvent
- VetoableChangeEvent
- See Also:
- SelectFormElement
-
SelectOption()
- Constructs a default SelectOption object.
-
SelectOption(String, String)
- Constructs a SelectOption object with the specified viewable text and initial
input value.
-
SelectOption(String, String, boolean)
- Constructs a SelectOption object with the specified viewable text,
initial input value, and initial selected value.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a PropertyChangeListener.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds the VetoableChangeListener.
-
getTag()
- Returns the select option tag.
-
getTag(String)
- Returns the select option tag with the new viewable option text.
-
getText()
- Returns the viewable option text.
-
getValue()
- Returns the input value used when the field is submitted.
-
isSelected()
- Indicates if the option defaults to being selected.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes the PropertyChangeListener from the internal list.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes the VetoableChangeListener from the internal list.
-
setSelected(boolean)
- Sets whether the option defaults as being selected.
-
setText(String)
- Sets the option text with the specified viewable text.
-
setValue(String)
- Sets the input value used when the field is submitted.
-
toString()
- Returns the String representation of the select option tag.
SelectOption
public SelectOption()
- Constructs a default SelectOption object.
SelectOption
public SelectOption(String text,
String value)
- Constructs a SelectOption object with the specified viewable text and initial
input value. By default, the option is not selected.
- Parameters:
- text - The veiwable option text.
- value - The input value used when the field is submitted.
SelectOption
public SelectOption(String text,
String value,
boolean selected)
- Constructs a SelectOption object with the specified viewable text,
initial input value, and initial selected value.
- Parameters:
- text - The viewable option text.
- value - The input value used when the field is submitted.
- selected - Whether the option defaults as being selected.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a PropertyChangeListener. The specified PropertyChangeListener's
propertyChange method will be called each time the value of any
bound property is changed.
- Parameters:
- listener - The PropertyChangeListener.
- See Also:
- removePropertyChangeListener
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds the VetoableChangeListener. The specified VetoableChangeListener's
vetoableChange method will be called each time the value of any
constrained property is changed.
- Parameters:
- listener - The VetoableChangeListener.
- See Also:
- removeVetoableChangeListener
getTag
public String getTag()
- Returns the select option tag.
- Returns:
- The tag.
getTag
public String getTag(String text)
- Returns the select option tag with the new viewable option text.
The original text of the select option object is not changed/updated.
- Parameters:
- text - The new option text.
- Returns:
- The tag.
getText
public String getText()
- Returns the viewable option text.
- Returns:
- The option text.
getValue
public String getValue()
- Returns the input value used when the field is submitted.
- Returns:
- The input value.
isSelected
public boolean isSelected()
- Indicates if the option defaults to being selected.
- Returns:
- true if defaults as selected; false otherwise.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes the PropertyChangeListener from the internal list.
If the PropertyChangeListener is not on the list, nothing is done.
- Parameters:
- listener - The PropertyChangeListener.
- See Also:
- addPropertyChangeListener
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes the VetoableChangeListener from the internal list.
If the VetoableChangeListener is not on the list, nothing is done.
- Parameters:
- listener - The VetoableChangeListener.
- See Also:
- addVetoableChangeListener
setSelected
public void setSelected(boolean selected) throws PropertyVetoException
- Sets whether the option defaults as being selected.
- Parameters:
- selected - Whether the option defaults as selected.
- Throws: PropertyVetoException
- If a change is vetoed.
setText
public void setText(String text) throws PropertyVetoException
- Sets the option text with the specified viewable text.
- Parameters:
- text - The option text.
- Throws: PropertyVetoException
- If a change is vetoed.
setValue
public void setValue(String value) throws PropertyVetoException
- Sets the input value used when the field is submitted.
- Parameters:
- value - The input value.
- Throws: PropertyVetoException
- If a change is vetoed.
toString
public String toString()
- Returns the String representation of the select option tag.
- Returns:
- The tag.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index