net.sf.jolene.dom
Class Option

java.lang.Object
  extended by net.sf.jolene.dom.Option

public final class Option
extends java.lang.Object

A select option object.

Since:
Nov 30, 2003
Author:
Dan Howard

Constructor Summary
Option()
          Creates a new Option object.
Option(int value, java.lang.String text)
          Creates an Option object using an int value and String text parameters.
Option(java.lang.String value, java.lang.String text)
          Creates an Option object using the String value and text parameters.
 
Method Summary
 int getIndex()
          Return the index of this option in the list of selections.
 java.lang.String getText()
          Get the option text.
 java.lang.String getValue()
          Get the option value.
 boolean isSelected()
          Determines if the option is currently selected.
 void setSelected(boolean selected)
          Sets the option as currently selected.
 void setText(java.lang.String string)
          Sets the text to display in the option.
 void setValue(java.lang.String string)
          Sets the value which would be submitted when the form is submitted.
 java.lang.String toString()
          Renders the option.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Option

public Option()
Creates a new Option object.


Option

public Option(java.lang.String value,
              java.lang.String text)
Creates an Option object using the String value and text parameters.

Parameters:
value - The value of the option
text - The display text of the option

Option

public Option(int value,
              java.lang.String text)
Creates an Option object using an int value and String text parameters.

Parameters:
value - The value of the option
text - The display text of the option
Method Detail

getIndex

public int getIndex()
Return the index of this option in the list of selections.

Returns:
the index of this option in the list of selections.

getText

public java.lang.String getText()
Get the option text.

Returns:
text

getValue

public java.lang.String getValue()
Get the option value.

Returns:
value

isSelected

public boolean isSelected()
Determines if the option is currently selected. This boolean value is read/write.

Returns:
selected

setSelected

public void setSelected(boolean selected)
Sets the option as currently selected.

Parameters:
selected - boolean

setText

public void setText(java.lang.String string)
Sets the text to display in the option.

Parameters:
string - text to display.

setValue

public void setValue(java.lang.String string)
Sets the value which would be submitted when the form is submitted.

Parameters:
string - value of the option.

toString

public java.lang.String toString()
Renders the option.

Overrides:
toString in class java.lang.Object
Returns:
The option as a html string.