net.sf.freecol.common.option
Class AbstractOption

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption
All Implemented Interfaces:
Option
Direct Known Subclasses:
AudioMixerOption, BooleanOption, FileOption, IntegerOption, LanguageOption, ListOption, OptionGroup, SelectOption, StringOption

public abstract class AbstractOption
extends FreeColObject
implements Option

The super class of all options. GUI components making use of this class can refer to its name and shortDescription properties. The complete keys of these properties consist of the id of the option group (if any), followed by a "." unless the option group is null, followed by the id of the option object, followed by a ".", followed by "name" or "shortDescription".


Field Summary
static java.lang.String NO_ID
           
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ID_ATTRIBUTE_TAG
 
Constructor Summary
AbstractOption(java.lang.String id)
          Creates a new AbstractOption.
AbstractOption(java.lang.String id, OptionGroup optionGroup)
          Deprecated.  
 
Method Summary
 java.lang.String getGroup()
          Returns the string prefix that identifies the group of this Option.
 java.lang.String getName()
          Returns the name of this Option.
 java.lang.String getShortDescription()
          Gives a short description of this Option.
 boolean isPreviewEnabled()
          Should this option be updated directly so that changes may be previewes?
 void setGroup(java.lang.String group)
          Set the option group
 void setPreviewEnabled(boolean previewEnabled)
          Sets if this option should be updated directly.
 java.lang.String toString()
          Returns a textual representation of this object.
 
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, getXMLElementTagName, 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
 
Methods inherited from interface net.sf.freecol.common.option.Option
addPropertyChangeListener, getId, readFromXML, readFromXMLElement, removePropertyChangeListener, toXML, toXMLElement
 

Field Detail

NO_ID

public static final java.lang.String NO_ID
See Also:
Constant Field Values
Constructor Detail

AbstractOption

public AbstractOption(java.lang.String id)
Creates a new AbstractOption.

Parameters:
id - The identifier for this option. This is used when the object should be found in an OptionGroup.

AbstractOption

public AbstractOption(java.lang.String id,
                      OptionGroup optionGroup)
Deprecated. 

Creates a new AbstractOption.

Parameters:
id - The identifier for this option. This is used when the object should be found in an OptionGroup.
optionGroup - The OptionGroup this Option belongs to.
Method Detail

isPreviewEnabled

public boolean isPreviewEnabled()
Should this option be updated directly so that changes may be previewes?

Specified by:
isPreviewEnabled in interface Option
Returns:
true if changes to this option should be made directly (and reset back later if the changes are not stored).

setPreviewEnabled

public void setPreviewEnabled(boolean previewEnabled)
Sets if this option should be updated directly.

Parameters:
previewEnabled - true if changes to this option should be made directly (and reset back later if the changes are not stored).

toString

public java.lang.String toString()
Returns a textual representation of this object.

Specified by:
toString in interface Option
Overrides:
toString in class java.lang.Object
Returns:
The name of this Option.
See Also:
#getLocalizedName

getGroup

public java.lang.String getGroup()
Returns the string prefix that identifies the group of this Option.

Returns:
The string prefix provided by the OptionGroup.

setGroup

public void setGroup(java.lang.String group)
Set the option group

Parameters:
group - OptionGroup to set

getName

public java.lang.String getName()
Returns the name of this Option.

Specified by:
getName in interface Option
Returns:
The name as provided in the constructor.

getShortDescription

public java.lang.String getShortDescription()
Gives a short description of this Option. Can for instance be used as a tooltip text.

Specified by:
getShortDescription in interface Option
Returns:
A short description of this Option.