net.sf.freecol.common.option
Class SelectOption

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.SelectOption
All Implemented Interfaces:
Option
Direct Known Subclasses:
RangeOption

public class SelectOption
extends AbstractOption

Represents an option where the valid choice is an integer and the choices are represented by strings. In general, these strings are localized by looking up the key of the choice, which consists of the id of the AbstractObject followed by a "." followed by the value of the option string. The automatic localization can be suppressed with the doNotLocalize parameter, however. There are two reasons to do this: either the option strings should not be localized at all (because they are language names, for example), or the option strings have already been localized (because they do not use the default keys, for example).


Field Summary
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
NO_ID
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
SelectOption(javax.xml.stream.XMLStreamReader in)
          Creates a new SelectOption.
 
Method Summary
 java.util.Map<java.lang.Integer,java.lang.String> getItemValues()
          Gets the range values of this RangeOption.
 int getValue()
          Gets the current value of this SelectOption.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 java.lang.String getXMLItemElementTagName()
          Gets the tag name of the item element This method is not static to ensure proper overriding in readFromXMLImpl.
 void setValue(int value)
          Sets the value of this SelectOption.
 
Methods inherited from class net.sf.freecol.common.option.AbstractOption
getGroup, getName, getShortDescription, 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, readFromXML, readFromXMLElement, removePropertyChangeListener, removePropertyChangeListener, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, writeAttribute, writeFreeColGameObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.option.Option
addPropertyChangeListener, getId, readFromXML, readFromXMLElement, removePropertyChangeListener, toXML, toXMLElement
 

Constructor Detail

SelectOption

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

Parameters:
in - The XMSStreamReader to read the data from
Throws:
javax.xml.stream.XMLStreamException
Method Detail

getValue

public int getValue()
Gets the current value of this SelectOption.

Returns:
The value.

setValue

public void setValue(int value)
Sets the value of this SelectOption.

Parameters:
value - The value to be set.

getItemValues

public java.util.Map<java.lang.Integer,java.lang.String> getItemValues()
Gets the range values of this RangeOption.

Returns:
The value.

getXMLElementTagName

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

Returns:
"selectOption".

getXMLItemElementTagName

public java.lang.String getXMLItemElementTagName()
Gets the tag name of the item element This method is not static to ensure proper overriding in readFromXMLImpl.

Returns:
"selectValue".