net.sf.freecol.common.option
Class RangeOption
java.lang.Object
net.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.option.AbstractOption<java.lang.Integer>
net.sf.freecol.common.option.IntegerOption
net.sf.freecol.common.option.SelectOption
net.sf.freecol.common.option.RangeOption
- All Implemented Interfaces:
- java.lang.Cloneable, Option<java.lang.Integer>
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.
|
Field Summary |
private static java.util.logging.Logger |
logger
|
|
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. |
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.IntegerOption |
clone, getMaximumValue, getMinimumValue, getStringValue, getValue, setMaximumValue, setMinimumValue, setValue, setValue, setValue, toString |
| Methods inherited from class net.sf.freecol.common.model.FreeColObject |
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
logger
private static java.util.logging.Logger logger
RangeOption
public RangeOption(Specification specification)
- Creates a new
RangeOption.
- Parameters:
specification - The specification this option belongs
to. May be null.
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.
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.
- Overrides:
toXMLImpl in class SelectOption
- Parameters:
out - The target stream.
- Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
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".