Package VASSAL.build.module
Class GlobalOptions
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.GlobalOptions
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,PropertyNameSource
,ComponentDescription
,ValidityChecker
,Translatable
,Auditable
,ImageSearchTarget
,SearchTarget
GlobalOptions is a junction point for several flavors of "preferences"-related categories. It also configures the
toolbar buttons basic VASSAL functions: Undo, Step Forward, and show/hide Servers. Global Options is a Singleton.
(1) Its attributes, set in the Editor, control the module-designer-set "hybrid preference" categories (Allowing non-owners to unmask pieces, Enabling HTML chat, format of player ID in reports), determining whether the preference in question is forced on or off, or whether a player preference is used.
(2) Its sub-components allow the module designer to "create custom preferences" which appear in their own tab.
(3) Many of its fields, configured mostly in the
(1) Its attributes, set in the Editor, control the module-designer-set "hybrid preference" categories (Allowing non-owners to unmask pieces, Enabling HTML chat, format of player ID in reports), determining whether the preference in question is forced on or off, or whether a player preference is used.
(2) Its sub-components allow the module designer to "create custom preferences" which appear in their own tab.
(3) Many of its fields, configured mostly in the
addTo(VASSAL.build.Buildable)
method, supply the majority of the
preferences shown on the "General" tab, though some of that tab's preferences are also set elsewhere -- see:
Prefs
- reading/writing the preference file, maintaining lists of configurers for tabs
Prefs.initSharedGlobalPrefs()
- disable d3d pipeline, wizard support
BasicLogger
- configurers for Undo and Step Forward. Adds logging-related preferences to pane
AdjustableSpeedScrollPane
- scroll increment-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Configurer for the Player's IDstatic class
The Prompt class allows certain attribute settings to be configured by the module designer: ALWAYS = the "preference" is forced on NEVER = the "preference" is forced off PROMPT = the player actually receives a preference on the General tab to control this behaviorstatic class
The PromptOnOff class allows certain attribute settings to be configured by the module designer: ALWAYS = the "preference" is forced on NEVER = the "preference" is forced offNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
protected String
static final String
static final String
static final String
static final boolean
static final String
static final String
Deprecated, for removal: This API element is subject to removal in a future version.static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, name
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Our Option Configurers (undo button, server button, step-forward button) potentially have icons to add the references forvoid
addOption
(Configurer option) Components may use GlobalOptions to store generic global attributes.void
GlobalOptions are added to theGameModule
.boolean
void
Builds our component from the buildFile.boolean
double
boolean
Class<?>[]
String[]
Return an array of Strings describing the attributes of this object.String[]
Lists all the buildFile (XML) attribute names for this component.Class<?>[]
Return the Class for the attributes of this object.Returns current setting of an attribute in String formgetBuildElement
(Document doc) Packages any "custom preferences" back up into XML for the buildFilestatic String
int
static GlobalOptions
boolean
Implement PropertyNameSource - Expose our preference namesboolean
boolean
boolean
boolean
boolean
Is this component a reqired component within its parent?boolean
boolean
boolean
boolean
boolean
boolean
boolean
isUnique()
Does this component need to be unique within it's parent?boolean
boolean
boolean
void
removeFrom
(Buildable parent) Removes us from our parent componentvoid
setAttribute
(String key, Object value) Sets a new value for one of our attributes.void
setPrefMacLegacy
(boolean b) void
void
void
setUseClassicMoveFixedDistance
(boolean b) void
setWarnOldContinuation
(boolean b) Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getAttributeVisibility, getConfigureComponents, getConfigureName, getExpressionList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getComponents, getComponentsOf, getNonFolderAncestor, setAncestor, validate
Methods inherited from class VASSAL.search.AbstractImageFinder
addLocalImageNames, getAllImageNames, getLocalImageNames
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface VASSAL.script.expression.Auditable
getComponentName, getComponentTypeName
-
Field Details
-
DESCRIPTION
- See Also:
-
NON_OWNER_UNMASKABLE
- See Also:
-
PROMPT_STRING
- See Also:
-
MARK_MOVED
- See Also:
-
AUTO_REPORT
- See Also:
-
CHATTER_HTML_SUPPORT
- See Also:
-
HOTKEYS_ON_CLOSED_WINDOWS
- See Also:
-
TRANSLATABLE_SUPPORT
- See Also:
-
INVENTORY_VISIBLE_TO_ALL
- See Also:
-
SEND_TO_LOCATION_MOVE_TRAILS
- See Also:
-
STORE_LEADING_ZERO_INTEGERS_AS_STRINGS
- See Also:
-
PURGE_BLANK_PROPERTY_PROMPTS
- See Also:
-
DISABLE_PIECE_INDEXING
- See Also:
-
ALWAYS
- See Also:
-
NEVER
- See Also:
-
PROMPT
- See Also:
-
CENTER_ON_MOVE
- See Also:
-
CENTER_ON_MOVE_SENSITIVITY
- See Also:
-
SINGLE_WINDOW
- See Also:
-
MAXIMUM_HEAP
- See Also:
-
DRAG_THRESHOLD
- See Also:
-
STACK_VIEWER_ORDER
- See Also:
-
SHOW_MARK_MOVED
- See Also:
-
BUG_10295
- See Also:
-
CLASSIC_MFD
- See Also:
-
MAC_LEGACY
- See Also:
-
OLD_CONTINUATION
- See Also:
-
SEND_TO_LOCATION_MOVEMENT_TRAILS
- See Also:
-
SOUND_GLOBAL_MUTE
- See Also:
-
SOUND_WAKEUP_MUTE
- See Also:
-
PLAYER_NAME
- See Also:
-
PLAYER_NAME_ALT
- See Also:
-
PLAYER_SIDE
- See Also:
-
PLAYER_SIDE_ALT
- See Also:
-
PLAYER_ID
- See Also:
-
PLAYER_ID_ALT
- See Also:
-
PLAYER_ID_FORMAT
- See Also:
-
FORCE_MAC_LEGACY
public static final boolean FORCE_MAC_LEGACY- See Also:
-
INITIAL_HEAP
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
description
-
-
Constructor Details
-
GlobalOptions
public GlobalOptions()
-
-
Method Details
-
getInstance
- Returns:
- our singleton instance
-
getDescription
- Specified by:
getDescription
in interfaceComponentDescription
- Returns:
- Description to be displayed next to component type/name in the main Editor window. Or null or "" to not display anything.
-
addTo
GlobalOptions are added to theGameModule
. This method creates the configurers for the "General" tab of the preference dialog, and some for the "Compatibility" tab. -
isForceNonNativeDrag
public boolean isForceNonNativeDrag()- Returns:
- true if we're forcing use of non-native drag and drop cursor
-
isUseSingleWindow
public boolean isUseSingleWindow()- Returns:
- true if preference to dock first map window to main module window with Chatter is selected
-
isUseClassicMoveFixedDistance
public boolean isUseClassicMoveFixedDistance()- Returns:
- true if compatibility version of Move Fixed Distance is selected
-
setUseClassicMoveFixedDistance
public void setUseClassicMoveFixedDistance(boolean b) - Parameters:
b
- sets the compatibility Move Fixed Distance preference
-
setPrefMacLegacy
public void setPrefMacLegacy(boolean b) - Parameters:
b
- sets the Mac Legacy compatibility preference
-
getPrefMacLegacy
public boolean getPrefMacLegacy()- Returns:
- the Mac Legacy compatibility preference
-
setWarnOldContinuation
public void setWarnOldContinuation(boolean b) - Parameters:
b
- sets the warnOldContinuation compatibility preference
-
isWarnOldContinuation
public boolean isWarnOldContinuation()- Returns:
- the warnOldContinuation compatibility preference
-
setSoundGlobalMute
- Parameters:
b
- sets the global sound mute preference
-
isSoundGlobalMute
- Returns:
- true if sounds should be muted globally
-
setSoundWakeupMute
- Parameters:
b
- sets the mute for the wake-up sound
-
isSoundWakeupMute
- Returns:
- true if the wake-up sound should be muted
-
getConfigureTypeName
- Returns:
- component name to be displayed in the editor, e.g. [Global Options]
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponents
in interfaceConfigurable
- Returns:
- classes allowed to be added as subcomponents (in this case, custom preferences)
-
getAttributeDescriptions
Description copied from interface:AutoConfigurable
Return an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object.- Specified by:
getAttributeDescriptions
in interfaceAutoConfigurable
- Specified by:
getAttributeDescriptions
in classAbstractConfigurable
- Returns:
- Display strings describing attributes available for configuration
-
getAttributeNames
Description copied from class:AbstractBuildable
Lists all the buildFile (XML) attribute names for this component. If this component is ALSO anAbstractConfigurable
, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()
andAbstractConfigurable.getAttributeTypes()
.- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Specified by:
getAttributeNames
in classAbstractBuildable
- Returns:
- Attribute keys for XML buildFile
-
getAttributeTypes
Description copied from interface:AutoConfigurable
Return the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, File, Color, and KeyStroke- Specified by:
getAttributeTypes
in interfaceAutoConfigurable
- Specified by:
getAttributeTypes
in classAbstractConfigurable
- Returns:
- configurer classes for our attributes
-
addOption
Components may use GlobalOptions to store generic global attributes. This method registers the given key as an attribute of the GlobalOptions with the given type.- Parameters:
option
- - configurer to add
-
build
Builds our component from the buildFile. In our case it mainly involves checkout for subcomponents which represent "custom preferences" and appropriately creating configurers and a preferences tab for them.- Specified by:
build
in interfaceBuildable
- Overrides:
build
in classAbstractBuildable
- Parameters:
e
- our XML element from the buildFile
-
getBuildElement
Packages any "custom preferences" back up into XML for the buildFile- Specified by:
getBuildElement
in interfaceBuildable
- Overrides:
getBuildElement
in classAbstractBuildable
- Parameters:
doc
- the XML document we are writing to- Returns:
- XML Element
-
getConfigurer
Description copied from class:AbstractConfigurable
- Specified by:
getConfigurer
in interfaceConfigurable
- Overrides:
getConfigurer
in classAbstractConfigurable
- Returns:
- a configurer including all custom preferences
-
getAttributeValueString
Returns current setting of an attribute in String form- Specified by:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Specified by:
getAttributeValueString
in classAbstractBuildable
- Parameters:
key
- the name of the attribute. Will be one of those listed ingetAttributeNames()
- Returns:
- String value of attribute
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- Help file to be used on this component's configuration dialog
-
removeFrom
Removes us from our parent component- Specified by:
removeFrom
in interfaceConfigurable
- Parameters:
parent
- our parent (GameModule)
-
setAttribute
Sets a new value for one of our attributes. Some special attention is needed when one of the designer-controlled attributes changes, as it may necessitate the showing/hiding of a new user preference checkbox configurer- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Specified by:
setAttribute
in classAbstractBuildable
- Parameters:
key
- the name of the attribute. Will be one of those listed ingetAttributeNames()
value
- If thevalue
parameter is a String, it will be the value returned bygetAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
can also be an instance of
-
autoReportEnabled
public boolean autoReportEnabled()- Returns:
- true if auto-reporting moves is enabled (designer-setting or user-pref, depending)
-
centerOnOpponentsMove
public boolean centerOnOpponentsMove()- Returns:
- true if center-on-opponents-move user pref is selected (no longer a designer setting)
-
isReverseStackViewerOrder
public boolean isReverseStackViewerOrder()- Returns:
- true if stack viewer should reverse left-to-right order
-
isShowMarkMoved
public boolean isShowMarkMoved() -
centerOnOpponentsMoveSensitivity
public double centerOnOpponentsMoveSensitivity()- Returns:
- percent-distance-from-center sensitivity for centering on opponent's move
-
chatterHTMLSetting
- Returns:
- designer's setting for enabling HTML chat
-
chatterHTMLSupport
public boolean chatterHTMLSupport()- Returns:
- true if chat is enabled in HTML (uses designer setting only)
-
isHotKeysOnClosedWindows
public boolean isHotKeysOnClosedWindows()- Returns:
- designer's setting for allowing hotkeys on closed windows
-
isSendToLocationMoveTrails
public boolean isSendToLocationMoveTrails()- Returns:
- designer's setting for whether send-to-location generates movement trails
-
isInventoryVisibleToAll
public boolean isInventoryVisibleToAll()- Returns:
- designer's setting for whether inventory can see units on private windows that current player doesn't have access to
-
isMarkMoveEnabled
public boolean isMarkMoveEnabled()- Returns:
- - NO LONGER USED
-
getDragThreshold
public int getDragThreshold()- Returns:
- drag threshold - pixels of movement required to distinguish drag from click
-
getPlayerId
- Returns:
- player ID for current player using the designer-configured format
-
isStoreLeadingZeroIntegersAsStrings
public boolean isStoreLeadingZeroIntegersAsStrings() -
isPurgeBlankPropertyPrompts
public boolean isPurgeBlankPropertyPrompts() -
isDisableUsePieceIndexes
public boolean isDisableUsePieceIndexes() -
getPropertyNames
Implement PropertyNameSource - Expose our preference names- Specified by:
getPropertyNames
in interfacePropertyNameSource
- Overrides:
getPropertyNames
in classAbstractBuildable
- Returns:
- property names for custom preferences
-
getPropertyList
- Specified by:
getPropertyList
in interfaceSearchTarget
- Overrides:
getPropertyList
in classAbstractConfigurable
- Returns:
- a list of any properties referenced in the configurer (for search)
-
getFormattedStringList
- Specified by:
getFormattedStringList
in interfaceSearchTarget
- Overrides:
getFormattedStringList
in classAbstractConfigurable
- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
getNamedKeyStrokeList
- Specified by:
getNamedKeyStrokeList
in interfaceSearchTarget
- Overrides:
getNamedKeyStrokeList
in classAbstractConfigurable
- Returns:
- a list of any Named KeyStrokes referenced in the Configurable, if any (for search)
-
addImageNamesRecursively
Our Option Configurers (undo button, server button, step-forward button) potentially have icons to add the references for- Specified by:
addImageNamesRecursively
in interfaceImageSearchTarget
- Overrides:
addImageNamesRecursively
in classAbstractBuildable
- Parameters:
s
- Collection to add image names to
-
isMandatory
public boolean isMandatory()Description copied from interface:Buildable
Is this component a reqired component within its parent?- Specified by:
isMandatory
in interfaceBuildable
- Returns:
- true if component is mandatory
-
isUnique
-