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:
- ElementEvent - The events fired are:
- elementAdded
- elementRemoved
- PropertyChangeEvent
- VetoableChangeEvent
- See Also:
- SelectOption
-
SelectFormElement()
- Constructs a default SelectFormElement object.
-
SelectFormElement(String)
- Constructs a SelectFormElement with the specified control name.
-
addElementListener(ElementListener)
- Adds an addElementListener.
-
addOption(SelectOption)
- Adds an option to the select form element.
-
addOption(String, String)
- Adds an option with the specified viewable text and initial input
value to the select form element.
-
addOption(String, String, boolean)
- Adds an option with the specified viewable text, initial input value,
and initial selected value to the select form element.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a PropertyChangeListener.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds the VetoableChangeListener.
-
getName()
- Returns the control name of the select element.
-
getOptionCount()
- Returns the number of elements in the option layout.
-
getSize()
- Returns the number of visible options.
-
getTag()
- Returns the select form element tag.
-
isMultiple()
- Indicates if the user can make multiple selections.
-
removeElementListener(ElementListener)
- Removes this ElementListener from the internal list.
-
removeOption(SelectOption)
- Removes an option from the select form element.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes the PropertyChangeListener from the internal list.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes the VetoableChangeListener from the internal list.
-
setMultiple(boolean)
- Sets whether the user can make multiple selections.
-
setName(String)
- Sets the control name of the select element.
-
setSize(int)
- Sets the number of visible options.
-
toString()
- Returns the String representation of the select form element tag.
SelectFormElement
public SelectFormElement()
- Constructs a default SelectFormElement object.
SelectFormElement
public SelectFormElement(String name)
- Constructs a SelectFormElement with the specified control name.
- Parameters:
- name - The control name of the select element.
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
addOption
public void addOption(SelectOption option)
- Adds an option to the select form element.
- Parameters:
- option - The select option.
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.
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.
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
getName
public String getName()
- Returns the control name of the select element.
- Returns:
- The control name.
getOptionCount
public int getOptionCount()
- Returns the number of elements in the option layout.
- Returns:
- The number of elements.
getSize
public int getSize()
- Returns the number of visible options.
- Returns:
- The number of options.
getTag
public String getTag()
- Returns the select form element tag.
- Returns:
- The tag.
isMultiple
public boolean isMultiple()
- Indicates if the user can make multiple selections.
- Returns:
- true if multiple selections are allowed; false otherwise.
removeOption
public void removeOption(SelectOption option)
- Removes an option from the select form element.
- Parameters:
- option - The select option.
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
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
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.
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.
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.
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