Package VASSAL.build.module.map
Class GlobalMap
java.lang.Object
VASSAL.build.module.map.GlobalMap
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,GameComponent
,Drawable
,Translatable
public class GlobalMap extends Object implements AutoConfigurable, GameComponent, Drawable
This is scaled version of a
Map
that gives an overview.
Users can navigate around the Map by clicking on the GlobalMap, which
draws a rectangular region of interest (ROI) indicating the current
viewable area in the map window.-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
GlobalMap.CounterViewer
protected class
GlobalMap.GlobalMapScrollPane
The scroll pane in which the mapGlobalMap.View
is displayed.static class
GlobalMap.IconConfig
protected class
GlobalMap.View
The Map view that appears inside the ScrollPaneNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Fields Modifier and Type Field Description protected static String
BUTTON_TEXT
protected static String
COLOR
protected static String
DEFAULT_ICON
protected static String
HOTKEY
protected static String
ICON_NAME
protected LaunchButton
launch
protected Map
map
protected CounterDetailViewer
mouseOverViewer
protected ComponentI18nData
myI18nData
protected Color
rectColor
protected double
scale
protected static String
SCALE
protected ScrollPane
scroll
protected static String
TOOLTIP
protected GlobalMap.View
view
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
Constructors Constructor Description GlobalMap()
-
Method Summary
Modifier and Type Method Description void
add(Buildable b)
Adds a child component.void
addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeListener.void
addTo(Buildable b)
Expects to be added to aMap
.void
build(Element e)
Build the objectPoint
componentCoordinates(Point p)
Deprecated, for removal: This API element is subject to removal in a future version.Point
componentToMap(Point p)
void
draw(Graphics g, Map m)
boolean
drawAboveCounters()
Class<?>[]
getAllowableConfigureComponents()
Return a list of valid sub-component Classes.String[]
getAttributeDescriptions()
Return an array of Strings describing the attributes of this object.String[]
getAttributeNames()
Class<?>[]
getAttributeTypes()
Return the Class for the attributes of this object.String
getAttributeValueString(String key)
Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML elementVisibilityCondition
getAttributeVisibility(String name)
Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.Element
getBuildElement(Document doc)
Configurable[]
getConfigureComponents()
String
getConfigureName()
The name of this Configurable ObjectConfigurer
getConfigurer()
Return aConfigurer
object which can be used to set the attributes of this objectstatic String
getConfigureTypeName()
HelpFile
getHelpFile()
ComponentI18nData
getI18nData()
Command
getRestoreCommand()
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullString
getToolTipText(MouseEvent e)
Point
mapCoordinates(Point p)
Deprecated, for removal: This API element is subject to removal in a future version.Point
mapToComponent(Point p)
Point
mapToDrawing(Point p, double os_scale)
Rectangle
mapToDrawing(Rectangle r, double os_scale)
void
remove(Buildable b)
Remove a child componentvoid
removeFrom(Buildable b)
Remove this component from its parentvoid
setAttribute(String key, Object value)
Called by theBuildable.build(org.w3c.dom.Element)
method, wherevalue
is the String value read by the XML attribute.void
setup(boolean show)
Notify the GameComponent that a game has started/ended
-
Field Details
-
map
-
scale
protected double scale -
rectColor
-
launch
-
mouseOverViewer
-
scroll
-
view
-
myI18nData
-
SCALE
- See Also:
- Constant Field Values
-
COLOR
- See Also:
- Constant Field Values
-
HOTKEY
- See Also:
- Constant Field Values
-
ICON_NAME
- See Also:
- Constant Field Values
-
TOOLTIP
- See Also:
- Constant Field Values
-
BUTTON_TEXT
- See Also:
- Constant Field Values
-
DEFAULT_ICON
- See Also:
- Constant Field Values
-
-
Constructor Details
-
GlobalMap
public GlobalMap()
-
-
Method Details
-
addTo
-
add
Description copied from interface:Buildable
Adds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)
are invoked when adding a child to a parent -
remove
Description copied from interface:Configurable
Remove a child component- Specified by:
remove
in interfaceConfigurable
-
removeFrom
Description copied from interface:Configurable
Remove this component from its parent- Specified by:
removeFrom
in interfaceConfigurable
-
build
Description copied from interface:Buildable
Build the object -
getAttributeNames
- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Returns:
- an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element
-
getAttributeVisibility
Description copied from interface:AutoConfigurable
Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.- Specified by:
getAttributeVisibility
in interfaceAutoConfigurable
- Returns:
- null if the attribute controls should always be visible;
-
setAttribute
Description copied from interface:AutoConfigurable
Called by theBuildable.build(org.w3c.dom.Element)
method, wherevalue
is the String value read by the XML attribute. Can also be called with Object value to set the attribute.- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Parameters:
key
- the name of the attribute. If the implementing class extendsAbstractConfigurable
, will be one of those listed inAbstractBuildable.getAttributeNames()
.value
- If thevalue
parameter is a String, it will be the value returned byTranslatable.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
can also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAttributeValueString
Description copied from interface:AutoConfigurable
Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML element- Specified by:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Parameters:
key
- the name of the attribute. If the implementing class extendsAbstractConfigurable
, will be one of those listed inAbstractBuildable.getAttributeNames()
.- Returns:
- a String representation of the attribute with the given name. When initializing a module, this String value will be passed to
Translatable.setAttribute(java.lang.String, java.lang.Object)
.
-
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
-
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
-
draw
-
drawAboveCounters
public boolean drawAboveCounters()- Specified by:
drawAboveCounters
in interfaceDrawable
-
componentCoordinates
Deprecated, for removal: This API element is subject to removal in a future version.Transform a point from Map coordinates to coordinates in the overview window- Parameters:
p
- Point- Returns:
- Transformed Point
-
mapCoordinates
Deprecated, for removal: This API element is subject to removal in a future version.Transform a point from coordinates in the overview window to Map coordinates- Parameters:
p
- Point- Returns:
- Transformed Point
-
componentToMap
-
mapToComponent
-
mapToDrawing
-
mapToDrawing
-
getToolTipText
-
getRestoreCommand
Description copied from interface:GameComponent
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommand
in interfaceGameComponent
-
setup
public void setup(boolean show)Description copied from interface:GameComponent
Notify the GameComponent that a game has started/ended- Specified by:
setup
in interfaceGameComponent
- Parameters:
show
- if true, a game is starting. If false, then a game is ending
-
getConfigureTypeName
-
getConfigureName
Description copied from interface:Configurable
The name of this Configurable Object- Specified by:
getConfigureName
in interfaceConfigurable
-
getConfigurer
Description copied from interface:Configurable
Return aConfigurer
object which can be used to set the attributes of this object- Specified by:
getConfigurer
in interfaceConfigurable
-
getConfigureComponents
- Specified by:
getConfigureComponents
in interfaceConfigurable
- Returns:
- an array of Configurer objects representing the Configurable children of this Configurable object
-
getAllowableConfigureComponents
Description copied from interface:Configurable
Return a list of valid sub-component Classes. If a Class appears in this list, then instances of that class may be added to this component from the Configuration Window.- Specified by:
getAllowableConfigureComponents
in interfaceConfigurable
-
addPropertyChangeListener
Description copied from interface:Configurable
Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTY
when the value returned fromConfigurable.getConfigureName()
has changed- Specified by:
addPropertyChangeListener
in interfaceConfigurable
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFilte describing how to use and configure this component
-
getBuildElement
- Specified by:
getBuildElement
in interfaceBuildable
- Returns:
- an XML element from which this component can be built
-
getI18nData
- Specified by:
getI18nData
in interfaceTranslatable
-
mapToComponent(Point)