net.sf.freecol.client
Class ClientOptions

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption<OptionGroup>
          extended by net.sf.freecol.common.option.OptionGroup
              extended by net.sf.freecol.client.ClientOptions
All Implemented Interfaces:
Option

public class ClientOptions
extends OptionGroup

Defines how available client options are displayed on the Setting dialog from File>Preferences Also contains several Comparators used for display purposes.

Most available client options and their default values are defined in the file base/client-options.xml in the FreeCol data directory. They are overridden by the player's personal settings in the file options.xml in the user directory. Options that can not be defined in this way because they are generated dynamically (such as a list of available mods) must be added to addDefaultOptions(). Each option should be given an unique identifier (defined as a constant in this class). In general, the options are called something like "model.option.UNIQUENAME". Since the options must also be represented by the GUI, they following two keys must be added to the file FreeColMessages.properties:


Field Summary
static java.lang.String ALWAYS_CENTER
          Selected tiles always gets centered if this option is enabled (even if the tile is GUI.onScreen(Tile)).
static java.lang.String AUDIO_MIXER
           
static java.lang.String AUDIO_VOLUME
           
static java.lang.String AUTO_END_TURN
          If enabled: Automatically ends the turn when no units can be made active.
static java.lang.String AUTO_SCROLL
          Option for activating autoscroll when dragging units on the mapboard.
static java.lang.String AUTOLOAD_EMIGRANTS
          Option for autoload emigrants on saling to america.
static java.lang.String AUTOSAVE_DELETE
          Option for deleting autosaves when a new game is started.
static java.lang.String AUTOSAVE_GENERATIONS
          Option for setting the number of autosaves to keep.
static java.lang.String AUTOSAVE_PERIOD
          Option for setting the period of autosaves.
static java.lang.String AUTOSAVE_VALIDITY
          Option for setting the number of days autosaves are keep (valid time).
static java.lang.String COLONY_COMPARATOR
          Used by GUI to sort colonies.
static int COLONY_COMPARATOR_AGE
           
static int COLONY_COMPARATOR_NAME
           
static int COLONY_COMPARATOR_POSITION
           
static int COLONY_COMPARATOR_SIZE
           
static int COLONY_COMPARATOR_SOL
           
static java.lang.String COLONY_LABELS
          Style of colony labels.
static int COLONY_LABELS_CLASSIC
           
static int COLONY_LABELS_MODERN
           
static int COLONY_LABELS_NONE
           
static java.lang.String COLONY_REPORT
          Option for selecting the compact colony report.
static int COLONY_REPORT_CLASSIC
           
static int COLONY_REPORT_COMPACT
           
private static java.util.Comparator<Colony> colonyAgeComparator
          Comparators for sorting colonies.
private static java.util.Comparator<Colony> colonyNameComparator
           
private static java.util.Comparator<Colony> colonyPositionComparator
           
private static java.util.Comparator<Colony> colonySizeComparator
           
private static java.util.Comparator<Colony> colonySoLComparator
           
static java.lang.String CUSTOM_STOCK
          The Stock the custom house should keep when selling goods.
static java.lang.String DEFAULT_MINIMAP_ZOOM
          Default zoom level of the minimap.
static java.lang.String DISPLAY_BORDERS
          Whether to display borders by default or not.
static java.lang.String DISPLAY_COMPASS_ROSE
          Whether to display a compass rose or not.
static java.lang.String DISPLAY_GRID
          Whether to display the grid by default or not.
static java.lang.String DISPLAY_MAP_CONTROLS
          Whether to display the map controls or not.
static java.lang.String DISPLAY_TILE_TEXT
          What text to display in the tiles.
static int DISPLAY_TILE_TEXT_EMPTY
           
static int DISPLAY_TILE_TEXT_NAMES
           
static int DISPLAY_TILE_TEXT_OWNERS
           
static int DISPLAY_TILE_TEXT_REGIONS
           
static java.lang.String ENEMY_MOVE_ANIMATION_SPEED
          Animation speed for enemy units.
static java.lang.String HIGH_LEVEL
          Generate warning of stock exceeds this percentage of capacity.
static java.lang.String INDIAN_DEMAND_RESPONSE
          The Indian demand action.
static int INDIAN_DEMAND_RESPONSE_ACCEPT
           
static int INDIAN_DEMAND_RESPONSE_ASK
           
static int INDIAN_DEMAND_RESPONSE_REJECT
           
static java.lang.String JUMP_TO_ACTIVE_UNIT
          If this option is enabled, the display will recenter in order to display the active unit if it is not GUI.onScreen(Tile)).
static java.lang.String LABOUR_REPORT
          The type of labour report to display.
static int LABOUR_REPORT_CLASSIC
           
static int LABOUR_REPORT_COMPACT
           
static java.lang.String LANGUAGE
          Option for setting the language.
private static java.util.logging.Logger logger
           
static java.lang.String LOW_LEVEL
          Generate warning of stock drops below this percentage of capacity.
static java.lang.String MAP_SCROLL_ON_DRAG
          Option for activating autoscroll when dragging units on the mapboard.
static java.lang.String MAX_NUMBER_OF_GOODS_IMAGES
          Used by GUI, this is the most repetitions drawn of a goods image for a single goods grouping.
static java.lang.String MESSAGES_GROUP_BY
          Used by GUI, this defines the grouping of ModelMessages.
static int MESSAGES_GROUP_BY_NOTHING
           
static int MESSAGES_GROUP_BY_SOURCE
           
static int MESSAGES_GROUP_BY_TYPE
           
private  java.util.Comparator<ModelMessage> messageSourceComparator
           
private  java.util.Comparator<ModelMessage> messageTypeComparator
           
static java.lang.String MIN_NUMBER_FOR_DISPLAYING_GOODS
          Used by GUI, this is the minimum number of goods a colony must possess for the goods to show up at the bottom of the colony panel.
static java.lang.String MIN_NUMBER_FOR_DISPLAYING_GOODS_COUNT
          Used by GUI, the number will be displayed when a group of goods are higher than this number.
static java.lang.String MINIMAP_BACKGROUND_COLOR
          The color to fill in around the actual map on the minimap.
static java.lang.String MOVE_ANIMATION_SPEED
          Animation speed for friendly units.
static java.lang.String SHOW_COLONY_WARNINGS
          Used by GUI, this defines whether SoL messages will be displayed.
static java.lang.String SHOW_GOODS_MOVEMENT
           
static java.lang.String SHOW_NOT_BEST_TILE
           
static java.lang.String SHOW_PRECOMBAT
           
static java.lang.String SHOW_SAVEGAME_SETTINGS
          Use default values for savegames instead of displaying a dialog.
static int SHOW_SAVEGAME_SETTINGS_ALWAYS
          A possible value for the SelectOption: SHOW_SAVEGAME_SETTINGS.
static int SHOW_SAVEGAME_SETTINGS_MULTIPLAYER
          A possible value for the SelectOption: SHOW_SAVEGAME_SETTINGS.
static int SHOW_SAVEGAME_SETTINGS_NEVER
          A possible value for the SelectOption: SHOW_SAVEGAME_SETTINGS.
static java.lang.String SMOOTH_MINIMAP_RENDERING
          If selected: Enables smooth rendering of the minimap when zoomed out.
static java.lang.String UNIT_LAST_MOVE_DELAY
          Whether to delay on a unit's last move or not.
static java.lang.String UNLOAD_OVERFLOW_RESPONSE
          The warehouse overflow on unload action.
static int UNLOAD_OVERFLOW_RESPONSE_ALWAYS
           
static int UNLOAD_OVERFLOW_RESPONSE_ASK
           
static int UNLOAD_OVERFLOW_RESPONSE_NEVER
           
static java.lang.String USE_PIXMAPS
          Pixmap setting to work around Java 2D graphics bug.
static java.lang.String USER_MODS
           
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
isDefined, previewEnabled
 
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
ClientOptions()
          Creates a new ClientOptions.
 
Method Summary
private  void addBooleanOption(java.lang.String id, java.lang.String gr, boolean val)
           
private  void addDefaultOptions()
          Adds the options to this GameOptions.
private  void addIntegerOption(java.lang.String id, java.lang.String gr, int val)
           
 void fixClientOptions()
          Perform backward compatibility fixups on new client options as they are introduced.
 java.util.List<FreeColModFile> getActiveMods()
          Gets a list of active mods in this ClientOptions.
 BooleanOption getBooleanOption(ModelMessage message)
          Returns the boolean option associated with a ModelMessage.
 java.util.Comparator<Colony> getColonyComparator()
          Return the client's preferred comparator for colonies.
static java.util.Comparator<Colony> getColonyComparator(int type)
          Return the colony comparator identified by type.
 int getDisplayTileText()
          Return the client's preferred tile text type.
 java.util.Comparator<ModelMessage> getModelMessageComparator()
          Return the client's preferred comparator for ModelMessages.
 java.util.List<Colony> getSortedColonies(Player p)
          Gets a fresh list of sorted colonies for a player.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
protected  boolean isCorrectTagName(java.lang.String tagName)
           
 void loadOptions(java.io.File optionsFile)
          Loads the options from the given file.
 void loadOptions(java.io.InputStream in)
          Loads the options from the given stream.
private  void updateFromXML(javax.xml.stream.XMLStreamReader in)
          Initialize this object from an XML-representation of this object.
 void updateOptions(java.io.File optionsFile)
          Updates the options from the given file.
 void updateOptions(java.io.InputStream in)
          Updates the options from the given stream.
 
Methods inherited from class net.sf.freecol.common.option.OptionGroup
add, getBoolean, getInteger, getName, getOption, getOptions, getShortDescription, getString, getValue, iterator, readFromXMLImpl, removeAll, setBoolean, setInteger, setString, setValue, toString, toXMLImpl
 
Methods inherited from class net.sf.freecol.common.option.AbstractOption
getGroup, isPreviewEnabled, readAttributes, setGroup, setPreviewEnabled, setValue
 
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, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeAttributes, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

logger

private static final java.util.logging.Logger logger

LANGUAGE

public static final java.lang.String LANGUAGE
Option for setting the language.

See Also:
Constant Field Values

JUMP_TO_ACTIVE_UNIT

public static final java.lang.String JUMP_TO_ACTIVE_UNIT
If this option is enabled, the display will recenter in order to display the active unit if it is not GUI.onScreen(Tile)).

See Also:
GUI, Constant Field Values

ALWAYS_CENTER

public static final java.lang.String ALWAYS_CENTER
Selected tiles always gets centered if this option is enabled (even if the tile is GUI.onScreen(Tile)).

See Also:
GUI, Constant Field Values

MIN_NUMBER_FOR_DISPLAYING_GOODS

public static final java.lang.String MIN_NUMBER_FOR_DISPLAYING_GOODS
Used by GUI, this is the minimum number of goods a colony must possess for the goods to show up at the bottom of the colony panel.

See Also:
GUI, Constant Field Values

MIN_NUMBER_FOR_DISPLAYING_GOODS_COUNT

public static final java.lang.String MIN_NUMBER_FOR_DISPLAYING_GOODS_COUNT
Used by GUI, the number will be displayed when a group of goods are higher than this number.

See Also:
GUI, Constant Field Values

MAX_NUMBER_OF_GOODS_IMAGES

public static final java.lang.String MAX_NUMBER_OF_GOODS_IMAGES
Used by GUI, this is the most repetitions drawn of a goods image for a single goods grouping.

See Also:
GUI, Constant Field Values

DISPLAY_COMPASS_ROSE

public static final java.lang.String DISPLAY_COMPASS_ROSE
Whether to display a compass rose or not.

See Also:
Constant Field Values

DISPLAY_MAP_CONTROLS

public static final java.lang.String DISPLAY_MAP_CONTROLS
Whether to display the map controls or not.

See Also:
Constant Field Values

DISPLAY_GRID

public static final java.lang.String DISPLAY_GRID
Whether to display the grid by default or not.

See Also:
Constant Field Values

UNIT_LAST_MOVE_DELAY

public static final java.lang.String UNIT_LAST_MOVE_DELAY
Whether to delay on a unit's last move or not. TODO: Add this option's name and short description to languages other than English.

See Also:
Constant Field Values

USE_PIXMAPS

public static final java.lang.String USE_PIXMAPS
Pixmap setting to work around Java 2D graphics bug.

See Also:
Constant Field Values

DISPLAY_BORDERS

public static final java.lang.String DISPLAY_BORDERS
Whether to display borders by default or not.

See Also:
Constant Field Values

DISPLAY_TILE_TEXT

public static final java.lang.String DISPLAY_TILE_TEXT
What text to display in the tiles.

See Also:
Constant Field Values

DISPLAY_TILE_TEXT_EMPTY

public static final int DISPLAY_TILE_TEXT_EMPTY
See Also:
Constant Field Values

DISPLAY_TILE_TEXT_NAMES

public static final int DISPLAY_TILE_TEXT_NAMES
See Also:
Constant Field Values

DISPLAY_TILE_TEXT_OWNERS

public static final int DISPLAY_TILE_TEXT_OWNERS
See Also:
Constant Field Values

DISPLAY_TILE_TEXT_REGIONS

public static final int DISPLAY_TILE_TEXT_REGIONS
See Also:
Constant Field Values

MOVE_ANIMATION_SPEED

public static final java.lang.String MOVE_ANIMATION_SPEED
Animation speed for friendly units.

See Also:
Constant Field Values

ENEMY_MOVE_ANIMATION_SPEED

public static final java.lang.String ENEMY_MOVE_ANIMATION_SPEED
Animation speed for enemy units.

See Also:
Constant Field Values

MESSAGES_GROUP_BY

public static final java.lang.String MESSAGES_GROUP_BY
Used by GUI, this defines the grouping of ModelMessages. Possible values include nothing, type and source.

See Also:
GUI, ModelMessage, Constant Field Values

MESSAGES_GROUP_BY_NOTHING

public static final int MESSAGES_GROUP_BY_NOTHING
See Also:
Constant Field Values

MESSAGES_GROUP_BY_TYPE

public static final int MESSAGES_GROUP_BY_TYPE
See Also:
Constant Field Values

MESSAGES_GROUP_BY_SOURCE

public static final int MESSAGES_GROUP_BY_SOURCE
See Also:
Constant Field Values

AUDIO_MIXER

public static final java.lang.String AUDIO_MIXER
See Also:
Constant Field Values

AUDIO_VOLUME

public static final java.lang.String AUDIO_VOLUME
See Also:
Constant Field Values

SHOW_COLONY_WARNINGS

public static final java.lang.String SHOW_COLONY_WARNINGS
Used by GUI, this defines whether SoL messages will be displayed.

See Also:
GUI, Constant Field Values

SHOW_PRECOMBAT

public static final java.lang.String SHOW_PRECOMBAT
See Also:
Constant Field Values

SHOW_NOT_BEST_TILE

public static final java.lang.String SHOW_NOT_BEST_TILE
See Also:
Constant Field Values

SHOW_GOODS_MOVEMENT

public static final java.lang.String SHOW_GOODS_MOVEMENT
See Also:
Constant Field Values

SHOW_SAVEGAME_SETTINGS

public static final java.lang.String SHOW_SAVEGAME_SETTINGS
Use default values for savegames instead of displaying a dialog.

Possible values for this option are:
  1. SHOW_SAVEGAME_SETTINGS_NEVER
  2. SHOW_SAVEGAME_SETTINGS_MULTIPLAYER
  3. SHOW_SAVEGAME_SETTINGS_ALWAYS

See Also:
Constant Field Values

SHOW_SAVEGAME_SETTINGS_NEVER

public static final int SHOW_SAVEGAME_SETTINGS_NEVER
A possible value for the SelectOption: SHOW_SAVEGAME_SETTINGS. Specifies that the dialog should never be enabled.

See Also:
Constant Field Values

SHOW_SAVEGAME_SETTINGS_MULTIPLAYER

public static final int SHOW_SAVEGAME_SETTINGS_MULTIPLAYER
A possible value for the SelectOption: SHOW_SAVEGAME_SETTINGS. Specifies that the dialog should only be enabled when loading savegames being marked as multiplayer..

See Also:
Constant Field Values

SHOW_SAVEGAME_SETTINGS_ALWAYS

public static final int SHOW_SAVEGAME_SETTINGS_ALWAYS
A possible value for the SelectOption: SHOW_SAVEGAME_SETTINGS. Specifies that the dialog should always be enabled.

See Also:
Constant Field Values

AUTOSAVE_PERIOD

public static final java.lang.String AUTOSAVE_PERIOD
Option for setting the period of autosaves. The value 0 signals that autosaving is disabled.

See Also:
Constant Field Values

AUTOSAVE_GENERATIONS

public static final java.lang.String AUTOSAVE_GENERATIONS
Option for setting the number of autosaves to keep. If set to 0, all autosaves are kept.

See Also:
Constant Field Values

AUTOSAVE_VALIDITY

public static final java.lang.String AUTOSAVE_VALIDITY
Option for setting the number of days autosaves are keep (valid time). If set to 0, valid time is not checked.

See Also:
Constant Field Values

AUTOSAVE_DELETE

public static final java.lang.String AUTOSAVE_DELETE
Option for deleting autosaves when a new game is started. If set to true, old autosaves will be deleted if a new game is started.

See Also:
Constant Field Values

MAP_SCROLL_ON_DRAG

public static final java.lang.String MAP_SCROLL_ON_DRAG
Option for activating autoscroll when dragging units on the mapboard.

See Also:
Constant Field Values

AUTO_SCROLL

public static final java.lang.String AUTO_SCROLL
Option for activating autoscroll when dragging units on the mapboard.

See Also:
Constant Field Values

AUTOLOAD_EMIGRANTS

public static final java.lang.String AUTOLOAD_EMIGRANTS
Option for autoload emigrants on saling to america.

See Also:
Constant Field Values

SMOOTH_MINIMAP_RENDERING

public static final java.lang.String SMOOTH_MINIMAP_RENDERING
If selected: Enables smooth rendering of the minimap when zoomed out.

See Also:
Constant Field Values

DEFAULT_MINIMAP_ZOOM

public static final java.lang.String DEFAULT_MINIMAP_ZOOM
Default zoom level of the minimap.

See Also:
Constant Field Values

MINIMAP_BACKGROUND_COLOR

public static final java.lang.String MINIMAP_BACKGROUND_COLOR
The color to fill in around the actual map on the minimap. Typically only visible when the minimap is at full zoom-out, but at the default 'black' you can't differentiate between the background and the (unexplored) map. Actually: clientOptions.minimap.color.background

See Also:
Constant Field Values

USER_MODS

public static final java.lang.String USER_MODS
See Also:
Constant Field Values

CUSTOM_STOCK

public static final java.lang.String CUSTOM_STOCK
The Stock the custom house should keep when selling goods.

See Also:
Constant Field Values

LOW_LEVEL

public static final java.lang.String LOW_LEVEL
Generate warning of stock drops below this percentage of capacity.

See Also:
Constant Field Values

HIGH_LEVEL

public static final java.lang.String HIGH_LEVEL
Generate warning of stock exceeds this percentage of capacity.

See Also:
Constant Field Values

COLONY_COMPARATOR

public static final java.lang.String COLONY_COMPARATOR
Used by GUI to sort colonies.

See Also:
Constant Field Values

COLONY_COMPARATOR_NAME

public static final int COLONY_COMPARATOR_NAME
See Also:
Constant Field Values

COLONY_COMPARATOR_AGE

public static final int COLONY_COMPARATOR_AGE
See Also:
Constant Field Values

COLONY_COMPARATOR_POSITION

public static final int COLONY_COMPARATOR_POSITION
See Also:
Constant Field Values

COLONY_COMPARATOR_SIZE

public static final int COLONY_COMPARATOR_SIZE
See Also:
Constant Field Values

COLONY_COMPARATOR_SOL

public static final int COLONY_COMPARATOR_SOL
See Also:
Constant Field Values

AUTO_END_TURN

public static final java.lang.String AUTO_END_TURN
If enabled: Automatically ends the turn when no units can be made active.

See Also:
Constant Field Values

LABOUR_REPORT

public static final java.lang.String LABOUR_REPORT
The type of labour report to display.

See Also:
Constant Field Values

LABOUR_REPORT_CLASSIC

public static final int LABOUR_REPORT_CLASSIC
See Also:
Constant Field Values

LABOUR_REPORT_COMPACT

public static final int LABOUR_REPORT_COMPACT
See Also:
Constant Field Values

COLONY_REPORT

public static final java.lang.String COLONY_REPORT
Option for selecting the compact colony report.

See Also:
Constant Field Values

COLONY_REPORT_CLASSIC

public static final int COLONY_REPORT_CLASSIC
See Also:
Constant Field Values

COLONY_REPORT_COMPACT

public static final int COLONY_REPORT_COMPACT
See Also:
Constant Field Values

INDIAN_DEMAND_RESPONSE

public static final java.lang.String INDIAN_DEMAND_RESPONSE
The Indian demand action.

See Also:
Constant Field Values

INDIAN_DEMAND_RESPONSE_ASK

public static final int INDIAN_DEMAND_RESPONSE_ASK
See Also:
Constant Field Values

INDIAN_DEMAND_RESPONSE_ACCEPT

public static final int INDIAN_DEMAND_RESPONSE_ACCEPT
See Also:
Constant Field Values

INDIAN_DEMAND_RESPONSE_REJECT

public static final int INDIAN_DEMAND_RESPONSE_REJECT
See Also:
Constant Field Values

UNLOAD_OVERFLOW_RESPONSE

public static final java.lang.String UNLOAD_OVERFLOW_RESPONSE
The warehouse overflow on unload action.

See Also:
Constant Field Values

UNLOAD_OVERFLOW_RESPONSE_ASK

public static final int UNLOAD_OVERFLOW_RESPONSE_ASK
See Also:
Constant Field Values

UNLOAD_OVERFLOW_RESPONSE_NEVER

public static final int UNLOAD_OVERFLOW_RESPONSE_NEVER
See Also:
Constant Field Values

UNLOAD_OVERFLOW_RESPONSE_ALWAYS

public static final int UNLOAD_OVERFLOW_RESPONSE_ALWAYS
See Also:
Constant Field Values

COLONY_LABELS

public static final java.lang.String COLONY_LABELS
Style of colony labels.

See Also:
Constant Field Values

COLONY_LABELS_NONE

public static final int COLONY_LABELS_NONE
See Also:
Constant Field Values

COLONY_LABELS_CLASSIC

public static final int COLONY_LABELS_CLASSIC
See Also:
Constant Field Values

COLONY_LABELS_MODERN

public static final int COLONY_LABELS_MODERN
See Also:
Constant Field Values

colonyAgeComparator

private static java.util.Comparator<Colony> colonyAgeComparator
Comparators for sorting colonies.


colonyNameComparator

private static java.util.Comparator<Colony> colonyNameComparator

colonySizeComparator

private static java.util.Comparator<Colony> colonySizeComparator

colonySoLComparator

private static java.util.Comparator<Colony> colonySoLComparator

colonyPositionComparator

private static java.util.Comparator<Colony> colonyPositionComparator

messageSourceComparator

private java.util.Comparator<ModelMessage> messageSourceComparator

messageTypeComparator

private java.util.Comparator<ModelMessage> messageTypeComparator
Constructor Detail

ClientOptions

public ClientOptions()
Creates a new ClientOptions. Unlike other OptionGroup classes, ClientOptions can not supply a specification as it is needed before the specification is available.

Method Detail

addDefaultOptions

private void addDefaultOptions()
Adds the options to this GameOptions.


getActiveMods

public java.util.List<FreeColModFile> getActiveMods()
Gets a list of active mods in this ClientOptions.

Returns:
A list of active mods.

loadOptions

public void loadOptions(java.io.File optionsFile)
Loads the options from the given file.

Parameters:
optionsFile - The File to read the options from.

loadOptions

public void loadOptions(java.io.InputStream in)
Loads the options from the given stream.

Parameters:
in - The InputStream to read the options from.

updateOptions

public void updateOptions(java.io.File optionsFile)
Updates the options from the given file.

Parameters:
optionsFile - The File to read the options from.

updateOptions

public void updateOptions(java.io.InputStream in)
Updates the options from the given stream.

Parameters:
in - The InputStream to read the options from.

updateFromXML

private void updateFromXML(javax.xml.stream.XMLStreamReader in)
                    throws javax.xml.stream.XMLStreamException
Initialize this object from an XML-representation of this object.

Parameters:
in - The input stream with the XML.
Throws:
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.

getDisplayTileText

public int getDisplayTileText()
Return the client's preferred tile text type.

Returns:
A DISPLAY_TILE_TEXT_ value

getSortedColonies

public java.util.List<Colony> getSortedColonies(Player p)
Gets a fresh list of sorted colonies for a player. Helper function for a common idiom.

Parameters:
p - The Player to get the colony list for.
Returns:
A fresh list of colonies sorted according to the current comparator.

getColonyComparator

public java.util.Comparator<Colony> getColonyComparator()
Return the client's preferred comparator for colonies.

Returns:
a Comparator value

getColonyComparator

public static java.util.Comparator<Colony> getColonyComparator(int type)
Return the colony comparator identified by type.

Parameters:
type - an int value
Returns:
a Comparator value

getModelMessageComparator

public java.util.Comparator<ModelMessage> getModelMessageComparator()
Return the client's preferred comparator for ModelMessages.

Returns:
a Comparator value

getBooleanOption

public BooleanOption getBooleanOption(ModelMessage message)
Returns the boolean option associated with a ModelMessage.

Parameters:
message - a ModelMessage value
Returns:
a BooleanOption value

fixClientOptions

public void fixClientOptions()
Perform backward compatibility fixups on new client options as they are introduced. Annotate with introduction version so we can clean these up as they become standard.


addBooleanOption

private void addBooleanOption(java.lang.String id,
                              java.lang.String gr,
                              boolean val)

addIntegerOption

private void addIntegerOption(java.lang.String id,
                              java.lang.String gr,
                              int val)

isCorrectTagName

protected boolean isCorrectTagName(java.lang.String tagName)

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"clientOptions".