All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.util.html.SelectFormElement

java.lang.Object
   |
   +----com.ibm.as400.util.html.SelectFormElement

public class SelectFormElement
extends Object
implements HTMLTagElement, Serializable
The SelectFormElement class represents a select input type in an HTML form. The trailing slash "/" on the SelectFormElement tag allows it to conform to the XHTML specification.

This example creates a SelectFormElement object with three options and prints out the HTML tag. The first two options added specify the option text, name, and select attributes. The third option added is defined by a SelectOption object.

  SelectFormElement list = new SelectFormElement("list1");
  SelectOption option1 = list.addOption("Option1", "opt1");
  SelectOption option2 = list.addOption("Option2", "opt2", false);
  SelectOption option3 = new SelectOption("Option3", "opt3", true);
  list.addOption(option3);   
  System.out.println(list.getTag());
  

Here is the output of the SelectFormElement tag:

  <select name="list1">
  <option value="opt1">Option1</option>
  <option value="opt2">Option2</option>
  <option value="opt3" selected="selected">Option3</option>
  </select>
  

SelectFormElement objects generate the following events:

See Also:
SelectOption

Constructor Index

 o SelectFormElement()
Constructs a default SelectFormElement object.
 o SelectFormElement(String)
Constructs a SelectFormElement with the specified control name.

Method Index

 o addElementListener(ElementListener)
Adds an addElementListener.
 o addOption(SelectOption)
Adds an option to the select form element.
 o addOption(String, String)
Adds an option with the specified viewable text and initial input value to the select form element.
 o addOption(String, String, boolean)
Adds an option with the specified viewable text, initial input value, and initial selected value to the select form element.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a PropertyChangeListener.
 o addVetoableChangeListener(VetoableChangeListener)
Adds the VetoableChangeListener.
 o getName()
Returns the control name of the select element.
 o getOptionCount()
Returns the number of elements in the option layout.
 o getSize()
Returns the number of visible options.
 o getTag()
Returns the select form element tag.
 o isMultiple()
Indicates if the user can make multiple selections.
 o removeElementListener(ElementListener)
Removes this ElementListener from the internal list.
 o removeOption(SelectOption)
Removes an option from the select form element.
 o removePropertyChangeListener(PropertyChangeListener)
Removes the PropertyChangeListener from the internal list.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes the VetoableChangeListener from the internal list.
 o setMultiple(boolean)
Sets whether the user can make multiple selections.
 o setName(String)
Sets the control name of the select element.
 o setSize(int)
Sets the number of visible options.
 o toString()
Returns the String representation of the select form element tag.

Constructors

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

 o SelectFormElement
 public SelectFormElement(String name)
Constructs a SelectFormElement with the specified control name.

Parameters:
name - The control name of the select element.

Methods

 o addElementListener
 public void addElementListener(ElementListener listener)
Adds an addElementListener. The specified addElementListeners elementAdded method will be called each time a radioforminput is added to the group. The addElementListener object is addded to a list of addElementListeners managed by this RadioFormInputGroup. It can be removed with removeElementListener.

Parameters:
listener - The ElementListener.
See Also:
removeElementListener
 o addOption
 public void addOption(SelectOption option)
Adds an option to the select form element.

Parameters:
option - The select option.
 o addOption
 public SelectOption addOption(String text,
                               String value)
Adds an option with the specified viewable text and initial input value to the select form element.

Parameters:
text - The viewable option text.
value - The option input value.
Returns:
A SelectOption object.
 o addOption
 public SelectOption addOption(String text,
                               String value,
                               boolean selected)
Adds an option with the specified viewable text, initial input value, and initial selected value to the select form element. Only one option can be selected in the select form element at a time.

Parameters:
text - The viewable option text.
value - The option input value.
selected - true if the option defaults as being selected; false otherwise.
Returns:
A SelectOption object.
 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 getName
 public String getName()
Returns the control name of the select element.

Returns:
The control name.
 o getOptionCount
 public int getOptionCount()
Returns the number of elements in the option layout.

Returns:
The number of elements.
 o getSize
 public int getSize()
Returns the number of visible options.

Returns:
The number of options.
 o getTag
 public String getTag()
Returns the select form element tag.

Returns:
The tag.
 o isMultiple
 public boolean isMultiple()
Indicates if the user can make multiple selections.

Returns:
true if multiple selections are allowed; false otherwise.
 o removeOption
 public void removeOption(SelectOption option)
Removes an option from the select form element.

Parameters:
option - The select option.
 o removeElementListener
 public void removeElementListener(ElementListener listener)
Removes this ElementListener from the internal list. If the ElementListener is not on the list, nothing is done.

Parameters:
listener - The ElementListener.
See Also:
addElementListener
 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 setMultiple
 public void setMultiple(boolean multiple) throws PropertyVetoException
Sets whether the user can make multiple selections.

Parameters:
multiple - true if multiple selections are allowed; false otherwise.
Throws: PropertyVetoException
If a change is vetoed.
 o setName
 public void setName(String name) throws PropertyVetoException
Sets the control name of the select element.

Parameters:
The - control name.
Throws: PropertyVetoException
If a change is vetoed.
 o setSize
 public void setSize(int size) throws PropertyVetoException
Sets the number of visible options.

Parameters:
size - The number of options.
Throws: PropertyVetoException
If a change is vetoed.
 o toString
 public String toString()
Returns the String representation of the select form element tag.

Returns:
The tag.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index