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:

See Also:
SelectFormElement

Constructor Index

 o SelectOption()
Constructs a default SelectOption object.
 o SelectOption(String, String)
Constructs a SelectOption object with the specified viewable text and initial input value.
 o SelectOption(String, String, boolean)
Constructs a SelectOption object with the specified viewable text, initial input value, and initial selected value.

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
Adds a PropertyChangeListener.
 o addVetoableChangeListener(VetoableChangeListener)
Adds the VetoableChangeListener.
 o getTag()
Returns the select option tag.
 o getTag(String)
Returns the select option tag with the new viewable option text.
 o getText()
Returns the viewable option text.
 o getValue()
Returns the input value used when the field is submitted.
 o isSelected()
Indicates if the option defaults to being selected.
 o removePropertyChangeListener(PropertyChangeListener)
Removes the PropertyChangeListener from the internal list.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes the VetoableChangeListener from the internal list.
 o setSelected(boolean)
Sets whether the option defaults as being selected.
 o setText(String)
Sets the option text with the specified viewable text.
 o setValue(String)
Sets the input value used when the field is submitted.
 o toString()
Returns the String representation of the select option tag.

Constructors

 o SelectOption
 public SelectOption()
Constructs a default SelectOption object.

 o 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.
 o 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.

Methods

 o 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
 o 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
 o getTag
 public String getTag()
Returns the select option tag.

Returns:
The tag.
 o 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.
 o getText
 public String getText()
Returns the viewable option text.

Returns:
The option text.
 o getValue
 public String getValue()
Returns the input value used when the field is submitted.

Returns:
The input value.
 o isSelected
 public boolean isSelected()
Indicates if the option defaults to being selected.

Returns:
true if defaults as selected; false otherwise.
 o 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
 o 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
 o 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.
 o 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.
 o 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.
 o 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