org.w3c.tools.forms
Class OptionField

java.lang.Object
  extended by org.w3c.tools.forms.FormField
      extended by org.w3c.tools.forms.OptionField
Direct Known Subclasses:
BooleanField

public class OptionField
extends FormField


Field Summary
 
Fields inherited from class org.w3c.tools.forms.FormField
manager, name, title
 
Constructor Summary
OptionField(FormManager manager, java.lang.String name, java.lang.String title, java.lang.String[] options, int value)
          Create an option field.
 
Method Summary
 boolean acceptChange(int idx)
          Do we accept to change to the given (valid) index ?
 java.awt.Component getEditor()
          Get an editor to edit this option's value.
 int getIntValue()
          Get the selected option as its index in our array of options.
 java.lang.String getStringValue()
          Get the selected option as a String.
 java.lang.Object getValue()
          Get this field's value in its native type.
 void setValue(int idx, boolean notify, boolean update)
          Set this option's value.
 void setValue(java.lang.Object value, boolean notify, boolean update)
          Set this option's value.
 void setValue(java.lang.String value, boolean notify, boolean update)
          Set this option's value.
 
Methods inherited from class org.w3c.tools.forms.FormField
getName, getTitle, gotFocus, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionField

public OptionField(FormManager manager,
                   java.lang.String name,
                   java.lang.String title,
                   java.lang.String[] options,
                   int value)
            throws IllegalFieldValueException
Create an option field.

Throws:
IllegalFieldValueException - if the value isn't accepted
Method Detail

acceptChange

public boolean acceptChange(int idx)
Do we accept to change to the given (valid) index ?


getValue

public java.lang.Object getValue()
Get this field's value in its native type.

Specified by:
getValue in class FormField
Returns:
The currently selected option as a String.

getIntValue

public int getIntValue()
Get the selected option as its index in our array of options.


getStringValue

public java.lang.String getStringValue()
Get the selected option as a String.


setValue

public void setValue(java.lang.Object value,
                     boolean notify,
                     boolean update)
              throws IllegalFieldValueException
Set this option's value.

Specified by:
setValue in class FormField
Parameters:
value - The new value.
update - Should we update the editor view.
notify - Should we notify the manager for this change ?
Throws:
IllegalFieldValueException - if the value isn't accepted

setValue

public void setValue(int idx,
                     boolean notify,
                     boolean update)
              throws IllegalFieldValueException
Set this option's value.

Parameters:
idx - The index of the option to set.
update - Should we update our editor's view.
Throws:
IllegalFieldValueException - if the value isn't accepted

setValue

public void setValue(java.lang.String value,
                     boolean notify,
                     boolean update)
              throws IllegalFieldValueException
Set this option's value.

Throws:
IllegalFieldValueException - if the value isn't accepted

getEditor

public java.awt.Component getEditor()
Get an editor to edit this option's value.