net.sf.freecol.common.option
Class OptionGroup

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption
          extended by net.sf.freecol.common.option.OptionGroup
All Implemented Interfaces:
Option
Direct Known Subclasses:
ActionManager, OptionMap

public class OptionGroup
extends AbstractOption

Used for grouping objects of Options.


Field Summary
private static java.util.logging.Logger logger
           
private  java.util.ArrayList<Option> options
           
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
isDefined, NO_ID, previewEnabled
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE
 
Constructor Summary
OptionGroup()
          Creates a new OptionGroup.
OptionGroup(java.lang.String id)
          Creates a new OptionGroup.
OptionGroup(javax.xml.stream.XMLStreamReader in)
          Creates a new OptionGroup.
 
Method Summary
 void add(Option option)
          Adds the given Option.
 java.lang.String getName()
          Returns the name of this Option.
 java.lang.String getShortDescription()
          Gives a short description of this Option.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 java.util.Iterator<Option> iterator()
          Returns an Iterator for the Options.
protected  void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void removeAll()
          Removes all of the Options from this OptionGroup.
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
getGroup, isPreviewEnabled, setGroup, setPreviewEnabled, toString
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, hasAbility, hasAttribute, hasListeners, readAttributes, readChildren, readFromArrayElement, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, setId, toArrayElement, toArrayElement, toListElement, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.option.Option
addPropertyChangeListener, getId, readFromXML, readFromXMLElement, removePropertyChangeListener, toXML, toXMLElement
 

Field Detail

logger

private static java.util.logging.Logger logger

options

private java.util.ArrayList<Option> options
Constructor Detail

OptionGroup

public OptionGroup()
Creates a new OptionGroup.


OptionGroup

public OptionGroup(java.lang.String id)
Creates a new OptionGroup.

Parameters:
id - The identifier for this option. This is used when the object should be found in an OptionGroup.

OptionGroup

public OptionGroup(javax.xml.stream.XMLStreamReader in)
            throws javax.xml.stream.XMLStreamException
Creates a new OptionGroup.

Parameters:
in - The XMLStreamReader containing the data.
Throws:
javax.xml.stream.XMLStreamException
Method Detail

add

public void add(Option option)
Adds the given Option.

Parameters:
option - The Option that should be added to this OptionGroup.

removeAll

public void removeAll()
Removes all of the Options from this OptionGroup.


iterator

public java.util.Iterator<Option> iterator()
Returns an Iterator for the Options.

Returns:
The Iterator.

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 FreeColObject
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.

Overrides:
readFromXMLImpl in class FreeColObject
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:
"optionGroup".

getName

public java.lang.String getName()
Returns the name of this Option.

Specified by:
getName in interface Option
Overrides:
getName in class AbstractOption
Returns:
The name as provided in the constructor.

getShortDescription

public java.lang.String getShortDescription()
Gives a short description of this Option. Can for instance be used as a tooltip text.

Specified by:
getShortDescription in interface Option
Overrides:
getShortDescription in class AbstractOption
Returns:
A short description of this Option.