net.sf.freecol.common.option
Class RangeOption
java.lang.Object
net.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.option.AbstractOption
net.sf.freecol.common.option.SelectOption
net.sf.freecol.common.option.RangeOption
- All Implemented Interfaces:
- Option
public class RangeOption
- extends SelectOption
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.
RangeOption differs from SelectOption, as the value being selected represents
a numeric measurement, defined by a bounded range of comparable values.
As the graphical component rendering a range option only works with a
conventional index, this implies to manage a fixed rank for each possible values.
Constructor Summary |
RangeOption(javax.xml.stream.XMLStreamReader in)
Creates a new RangeOption . |
Method Summary |
int |
getValueRank()
Gets the rank of the current selected value in the list of values of this
RangeOption . |
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 |
void |
setValueRank(int rank)
Sets the value through the rank in the list of values of this
RangeOption . |
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 |
RangeOption
public RangeOption(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
- Creates a new
RangeOption
.
- Parameters:
in
- The XMSStreamReader
to read the data from
- Throws:
javax.xml.stream.XMLStreamException
getValueRank
public int getValueRank()
- Gets the rank of the current selected value in the list of values of this
RangeOption
.
- Returns:
- The value.
setValueRank
public void setValueRank(int rank)
- Sets the value through the rank in the list of values of this
RangeOption
.
- Parameters:
rank
- The rank of the value to be set.
getXMLElementTagName
public static java.lang.String getXMLElementTagName()
- Gets the tag name of the root element representing this object.
- Returns:
- "rangeOption".
getXMLItemElementTagName
public java.lang.String getXMLItemElementTagName()
- Gets the tag name of the item element
- Overrides:
getXMLItemElementTagName
in class SelectOption
- Returns:
- "rangeValue".