|
|||||||||
| 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<OptionGroup>
net.sf.freecol.common.option.OptionGroup
public class OptionGroup
Used for grouping objects of Options.
| Field Summary | |
|---|---|
private static java.util.logging.Logger |
logger
|
private java.util.Map<java.lang.String,Option> |
optionMap
|
private java.util.List<Option> |
options
|
| Fields inherited from class net.sf.freecol.common.option.AbstractOption |
|---|
isDefined |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG |
| Constructor Summary | |
|---|---|
OptionGroup(Specification specification)
|
|
OptionGroup(java.lang.String id)
Creates a new OptionGroup. |
|
OptionGroup(java.lang.String id,
Specification specification)
|
|
| Method Summary | |
|---|---|
void |
add(Option option)
Adds the given Option. |
private void |
addOptionGroup(OptionGroup group)
|
OptionGroup |
clone()
|
boolean |
getBoolean(java.lang.String id)
Gets the boolean value of an option. |
int |
getInteger(java.lang.String id)
Gets the integer value of an option. |
java.lang.String |
getName()
Returns the name of this Option. |
Option |
getOption(java.lang.String id)
|
java.util.List<Option> |
getOptions()
|
java.lang.String |
getShortDescription()
Gives a short description of this Option. |
java.lang.String |
getString(java.lang.String id)
Gets the string value of an option. |
OptionGroup |
getValue()
Returns the OptionGroup itself. |
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. |
void |
setBoolean(java.lang.String id,
boolean value)
Sets the boolean value of an option. |
void |
setInteger(java.lang.String id,
int value)
Sets the integer value of an option. |
void |
setString(java.lang.String id,
java.lang.String value)
Sets the string value of an option. |
void |
setValue(OptionGroup value)
Copy the options of another OptionGroup. |
java.lang.String |
toString()
Debug print helper. |
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 |
|---|
generateChoices, getGroup, isNullValueOK, readAttributes, readOption, setGroup, setValue, setValues |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.freecol.common.option.Option |
|---|
getId, readFromXML, toXML |
| Field Detail |
|---|
private static java.util.logging.Logger logger
private java.util.List<Option> options
private java.util.Map<java.lang.String,Option> optionMap
| Constructor Detail |
|---|
public OptionGroup(java.lang.String id)
OptionGroup.
id - The identifier for this option.public OptionGroup(Specification specification)
public OptionGroup(java.lang.String id,
Specification specification)
| Method Detail |
|---|
public OptionGroup clone()
throws java.lang.CloneNotSupportedException
clone in interface Option<OptionGroup>clone in class AbstractOption<OptionGroup>java.lang.CloneNotSupportedExceptionpublic void add(Option option)
Option.
option - The Option that should be
added to this OptionGroup.private void addOptionGroup(OptionGroup group)
public java.util.List<Option> getOptions()
public Option getOption(java.lang.String 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 void setInteger(java.lang.String id,
int value)
id - The id of the option.value - the new value 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 void setBoolean(java.lang.String id,
boolean value)
id - The id of the option.value - the new value 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.lang.String getString(java.lang.String id)
id - String, option ID
java.lang.IllegalArgumentException - If the specified option is not of String type
java.lang.NullPointerException - if the given Option does not exist.
public void setString(java.lang.String id,
java.lang.String value)
id - String, option IDvalue - String, the new value of the option
java.lang.IllegalArgumentException - If the specified option is not of String type
java.lang.NullPointerException - if the given Option does not exist.public void removeAll()
Options from this OptionGroup.
public java.util.Iterator<Option> iterator()
Iterator for the Options.
Iterator.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXMLImpl in class FreeColObjectout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXMLImpl in class AbstractOption<OptionGroup>in - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered
during parsing.public java.lang.String getName()
Option.
public java.lang.String getShortDescription()
Option. Can for
instance be used as a tooltip text.
Option.public OptionGroup getValue()
getValue in interface Option<OptionGroup>getValue in class AbstractOption<OptionGroup>Object valuepublic void setValue(OptionGroup value)
setValue in interface Option<OptionGroup>setValue in class AbstractOption<OptionGroup>value - an Object valuepublic java.lang.String toString()
toString in interface Option<OptionGroup>toString in class java.lang.Objectpublic static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||