|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.option.AbstractOption
net.sf.freecol.common.option.OptionGroup
net.sf.freecol.common.option.OptionMap
public abstract class OptionMap
Used for grouping objects of Option
.
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 | |
---|---|
OptionMap(org.w3c.dom.Element element,
java.lang.String xmlTagName)
Creates an OptionMap from an XML representation. |
|
OptionMap(java.lang.String xmlTagName)
Creates a new OptionMap . |
|
OptionMap(javax.xml.stream.XMLStreamReader in,
java.lang.String xmlTagName)
Creates an OptionMap from an XML representation. |
Method Summary | |
---|---|
void |
addToMap(OptionGroup og)
Adds the Option s from the given OptionGroup
to the Map . |
boolean |
getBoolean(java.lang.String id)
Gets the boolean value of an option. |
java.io.File |
getFile(java.lang.String id)
Gets the File specified by an option. |
int |
getInteger(java.lang.String id)
Gets the integer value of an option. |
Option |
getObject(java.lang.String id)
Gets the object identified by the given id . |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
void |
load(java.io.File loadFile)
Reads the options from the given file. |
void |
putOption(Option option)
|
void |
save(java.io.File saveFile)
Writes the options to the given file. |
void |
setFile(java.lang.String id,
java.io.File newFileValue)
Allow a File to be set in other ways, as from the user using the Client. |
void |
toXML(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.OptionGroup |
---|
add, getName, getShortDescription, iterator, removeAll |
Methods inherited from class net.sf.freecol.common.option.AbstractOption |
---|
getGroup, isPreviewEnabled, setGroup, setPreviewEnabled, toString |
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, toXMLElement |
Constructor Detail |
---|
public OptionMap(java.lang.String xmlTagName)
OptionMap
.
xmlTagName
- The tag name that should be used for the parent XML-element
returned by Option.toXMLElement(org.w3c.dom.Document)
.public OptionMap(javax.xml.stream.XMLStreamReader in, java.lang.String xmlTagName) throws javax.xml.stream.XMLStreamException
OptionMap
from an XML representation.
in
- The XML stream to read the data from.xmlTagName
- The tag name that should be used for the parent XML-element
returned by Option.toXMLElement(org.w3c.dom.Document)
.
javax.xml.stream.XMLStreamException
- if an error occured during parsing.public OptionMap(org.w3c.dom.Element element, java.lang.String xmlTagName)
OptionMap
from an XML representation.
element
- The XML Element
from which this object
should be constructed.xmlTagName
- The tag name that should be used for the parent XML-element
returned by Option.toXMLElement(org.w3c.dom.Document)
.Method Detail |
---|
public Option getObject(java.lang.String id)
id
.
id
- The ID.
Object
with the given ID.public int getInteger(java.lang.String id)
id
- The id of the option.
java.lang.IllegalArgumentException
- If there is no integer
value associated with the specified option.
java.lang.NullPointerException
- if the given Option
does not exist.public boolean getBoolean(java.lang.String id)
id
- The id of the option.
java.lang.IllegalArgumentException
- If there is no boolean
value associated with the specified option.
java.lang.NullPointerException
- if the given Option
does not exist.public java.io.File getFile(java.lang.String id)
File
specified by an option.
id
- The id of the option.
java.lang.IllegalArgumentException
- If there is no File
associated with the specified option.
java.lang.NullPointerException
- if the given Option
does not exist.public void addToMap(OptionGroup og)
Option
s from the given OptionGroup
to the Map
. This is done recursively if the specified
group has any sub-groups.
og
- The OptionGroup
to be added.public void putOption(Option option)
public void load(java.io.File loadFile)
loadFile
- The File
to read the
options from.public void save(java.io.File saveFile)
saveFile
- The file where the client options should be written.ClientOptions
public void toXML(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException
toXML
in interface Option
toXML
in class FreeColObject
out
- The target stream.
javax.xml.stream.XMLStreamException
- if there are any problems writing
to the stream.FreeColObject.toXML(XMLStreamWriter, Player, boolean, boolean)
public static java.lang.String getXMLElementTagName()
java.lang.UnsupportedOperationException
- at any time, since this
class should get it's XML tag name in the
constructor
public void setFile(java.lang.String id, java.io.File newFileValue)
id
- newFileValue
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |