org.jscience.sociology.forms
Class MultipleChoiceBox

java.lang.Object
  extended by org.jscience.sociology.forms.FormElement
      extended by org.jscience.sociology.forms.ChoiceBox
          extended by org.jscience.sociology.forms.MultipleChoiceBox
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CheckBox, MenuBox

public abstract class MultipleChoiceBox
extends ChoiceBox

This abstract class is the superclass of classes representing the multiple choice input elements of a form, like Checkboxes, Combo Boxes and List Boxes.

See Also:
ChoiceBox, MenuBox, CheckBox, Serialized Form

Constructor Summary
MultipleChoiceBox()
           
 
Method Summary
 java.lang.String chosen(java.lang.String value)
          Will return "selected", "checked" or "".
 void setValue(java.lang.String value)
          Sets the initially selected value of this field.
 
Methods inherited from class org.jscience.sociology.forms.ChoiceBox
addToValues
 
Methods inherited from class org.jscience.sociology.forms.FormElement
getErrorMessage, getName, getValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipleChoiceBox

public MultipleChoiceBox()
Method Detail

setValue

public void setValue(java.lang.String value)
Sets the initially selected value of this field. In forms.xml you set the initial field value(s) like this:

 

<field-value state="selected">thevalue</field-value> or <field-value state="checked">thevalue</field-value>

Overrides:
setValue in class FormElement
Parameters:
value - the initially selected value.

chosen

public java.lang.String chosen(java.lang.String value)
Will return "selected", "checked" or "". In case the choice represented by value is unselected, the empty string will be returned.

This method is used in the presentation layer of this API.

This method is internally used by generateXML() and generateXmlAsString() methods of class Form.

Specified by:
chosen in class ChoiceBox
Parameters:
value - the value of the MultipleChoiceBox item whose status is returned by this method.
Returns:
"selected", "checked" or "".