net.sf.freecol.common.option
Class BooleanOption

java.lang.Object
  extended by net.sf.freecol.common.option.AbstractOption
      extended by net.sf.freecol.common.option.BooleanOption
All Implemented Interfaces:
Option

public class BooleanOption
extends AbstractOption

Represents an option that can be either true or false.


Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String LICENSE
           
static java.lang.String REVISION
           
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
NO_ID
 
Constructor Summary
BooleanOption(java.lang.String id, java.lang.String name, java.lang.String shortDescription, boolean defaultValue)
          Creates a new BooleanOption.
 
Method Summary
 boolean getValue()
          Gets the current value of this BooleanOption.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void setValue(boolean value)
          Sets the current value of this BooleanOption.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
 
Methods inherited from class net.sf.freecol.common.option.AbstractOption
addPropertyChangeListener, firePropertyChange, getId, getName, getShortDescription, readFromXML, readFromXMLElement, removePropertyChangeListener, toString, toXML, toXMLElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

LICENSE

public static final java.lang.String LICENSE
See Also:
Constant Field Values

REVISION

public static final java.lang.String REVISION
See Also:
Constant Field Values
Constructor Detail

BooleanOption

public BooleanOption(java.lang.String id,
                     java.lang.String name,
                     java.lang.String shortDescription,
                     boolean defaultValue)
Creates a new BooleanOption.

Parameters:
id - The identifier for this option. This is used when the object should be found in an OptionGroup.
name - The name of the Option. This text is used for identifying the option for a user. Example: The text related to a checkbox.
shortDescription - Should give a short description of the BooleanOption. This might be used as a tooltip text.
defaultValue - The default value of this option.
Method Detail

getValue

public boolean getValue()
Gets the current value of this BooleanOption.

Returns:
The value.

setValue

public void setValue(boolean value)
Sets the current value of this BooleanOption.

Parameters:
value - The value.

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Specified by:
toXMLImpl in class AbstractOption
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

readFromXMLImpl

protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
                        throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Specified by:
readFromXMLImpl in class AbstractOption
Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"booleanOption".