|
|||||||||
| 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<AbstractUnit>
net.sf.freecol.common.option.AbstractUnitOption
public class AbstractUnitOption
Represents an option where the valid choice is an AbstractUnit.
| Field Summary | |
|---|---|
private static UnitTypeOption.TypeSelector |
DEFAULT_SELECTOR
|
private static java.util.logging.Logger |
logger
|
private IntegerOption |
number
An Option to determine the number of the AbstractUnit. |
private StringOption |
role
An Option to determine the Role of the AbstractUnit. |
private UnitTypeOption |
unitType
An Option to determine the UnitType of the AbstractUnit. |
private AbstractUnit |
value
|
| 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 | |
|---|---|
AbstractUnitOption(Specification specification)
Creates a new AbstractUnitOption. |
|
AbstractUnitOption(java.lang.String id)
Creates a new AbstractUnitOption. |
|
AbstractUnitOption(java.lang.String id,
Specification specification)
|
|
| Method Summary | |
|---|---|
AbstractUnitOption |
clone()
|
void |
generateChoices()
Generate the choices to provide to the UI based on the generateChoices value. |
IntegerOption |
getNumber()
Get the Number value. |
StringOption |
getRole()
Get the Role value. |
UnitTypeOption |
getUnitType()
Get the UnitType value. |
AbstractUnit |
getValue()
Gets the current value of this AbstractUnitOption. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
isNullValueOK()
Returns whether null is an acceptable value for
this Option. |
void |
readFromXML(javax.xml.stream.XMLStreamReader in)
Initializes this object from an XML-representation of this object, unless the PARTIAL_ATTRIBUTE tag is present which indicates a partial update of an existing object. |
void |
setNumber(IntegerOption newNumber)
Set the Number value. |
void |
setRole(StringOption newRole)
Set the Role value. |
void |
setUnitType(UnitTypeOption newUnitType)
Set the UnitType value. |
void |
setValue(AbstractUnit value)
Sets the value of this AbstractUnitOption. |
java.lang.String |
toString()
Returns a textual representation of this object. |
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 |
|---|
getGroup, readAttributes, readFromXMLImpl, 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, toXML |
| Field Detail |
|---|
private static java.util.logging.Logger logger
private static final UnitTypeOption.TypeSelector DEFAULT_SELECTOR
private AbstractUnit value
private UnitTypeOption unitType
private StringOption role
private IntegerOption number
| Constructor Detail |
|---|
public AbstractUnitOption(java.lang.String id)
AbstractUnitOption.
Get the UnitType value.
id - The identifier for this option. This is used when the object
should be found in an OptionGroup.public AbstractUnitOption(Specification specification)
AbstractUnitOption.
specification - The specification this option belongs
to. May be null.
public AbstractUnitOption(java.lang.String id,
Specification specification)
| Method Detail |
|---|
public AbstractUnitOption clone()
clone in interface Option<AbstractUnit>clone in class AbstractOption<AbstractUnit>public AbstractUnit getValue()
AbstractUnitOption.
getValue in interface Option<AbstractUnit>getValue in class AbstractOption<AbstractUnit>public void setValue(AbstractUnit value)
AbstractUnitOption.
setValue in interface Option<AbstractUnit>setValue in class AbstractOption<AbstractUnit>value - The value to be set.public final UnitTypeOption getUnitType()
UnitType value.
UnitTypeOption valuepublic final void setUnitType(UnitTypeOption newUnitType)
UnitType value.
newUnitType - The new UnitType value.public final StringOption getRole()
Role value.
StringOption valuepublic final void setRole(StringOption newRole)
Role value.
newRole - The new Role value.public final IntegerOption getNumber()
Number value.
IntegerOption valuepublic final void setNumber(IntegerOption newNumber)
Number value.
newNumber - The new Number value.public void generateChoices()
generateChoices in class AbstractOption<AbstractUnit>public boolean isNullValueOK()
null is an acceptable value for
this Option. This method always returns true.
isNullValueOK in class AbstractOption<AbstractUnit>
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.
public void readFromXML(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
FreeColObject
readFromXML in interface Option<AbstractUnit>readFromXML in class FreeColObjectin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if there are any problems writing
to the stream.public static java.lang.String getXMLElementTagName()
public java.lang.String toString()
Option
toString in interface Option<AbstractUnit>toString in class java.lang.ObjectOption.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||