VASSAL.build.module
Class Map

java.lang.Object
  |
  +--VASSAL.build.AbstractBuildable
        |
        +--VASSAL.build.AbstractConfigurable
              |
              +--VASSAL.build.module.Map
All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, java.util.EventListener, java.awt.event.FocusListener, GameComponent, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
Direct Known Subclasses:
PrivateMap

public class Map
extends AbstractConfigurable
implements GameComponent, java.awt.event.FocusListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, Configurable

The Map is the main component for displaying and containing GamePieces during play. Pieces are displayed on a Map and moved by clicking and dragging. Keyboard events are forwarded to selected pieces. Multiple map windows are supported in a single game, with dragging between windows allowed. A Map may contain many different Buildable subcomponents. Components which are added directly to a Map are contained in the VASSAL.build.module.map package


Inner Class Summary
static class Map.View
          The component that represents the map itself
 
Inner classes inherited from class VASSAL.build.AutoConfigurable
AutoConfigurable.Util
 
Field Summary
static java.lang.String ALLOW_MULTIPLE
           
protected  java.util.Vector boards
           
static java.lang.String BUTTON_NAME
           
static java.lang.String EDGE_HEIGHT
           
static java.lang.String EDGE_WIDTH
           
protected  java.awt.Dimension edgeBuffer
           
static java.lang.String HIGHLIGHT_COLOR
           
static java.lang.String HIGHLIGHT_THICKNESS
           
protected  Highlighter highlighter
           
static java.lang.String HOTKEY
           
protected  LaunchButton launchButton
           
protected  ComponentSplitter.SplitPane mainWindowDock
           
static java.lang.String MARK_MOVED
           
protected  java.lang.String markMovedOption
           
protected  int maxStacks
           
protected  StackMetrics metrics
           
protected  int moreStacks
           
protected  java.util.Vector mouseListenerStack
           
protected  java.awt.event.MouseListener multicaster
           
static java.lang.String NAME
           
protected  int nstacks
           
protected  BoardPicker picker
           
protected  javax.swing.JScrollPane scroll
           
protected  GamePiece[] stack
           
protected  javax.swing.JPanel theMap
           
protected  javax.swing.JToolBar toolBar
           
protected  javax.swing.JDialog topWindow
           
static java.lang.String USE_LAUNCH_BUTTON
           
protected  boolean useLaunchButton
           
protected  Zoomer zoom
           
 
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, name
 
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents
 
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
 
Constructor Summary
Map()
           
 
Method Summary
 void addDrawComponent(Drawable theComponent)
          Add a Drawable component to this map
 void addLocalMouseListener(java.awt.event.MouseListener l)
          Because MouseEvents are received in component coordinates, it is inconvenient for MouseListeners on the map to have to translate to map coordinates.
 void addPiece(GamePiece p)
          Adds a GamePiece to this map.
 void addTo(Buildable b)
          Expects to be added to a GameModule.
 void appendToTitle(java.lang.String s)
           
 java.awt.Rectangle boundingBoxOf(GamePiece p)
          Returns the boundingBox of a GamePiece accounting for the offset of a piece within its parent stack
 void build(org.w3c.dom.Element e)
          Build the object
 void centerAt(java.awt.Point p)
          Center the map at given map coordinates within its JScrollPane container
 void centerAt(java.awt.Point p, int dx, int dy)
          Center the map at the given map coordinates, if the point is not already within (dx,dy) of the center
protected  void clearMapBorder(java.awt.Graphics g)
           
 java.awt.Point componentCoordinates(java.awt.Point p1)
          Translate a point from map coordinates to component coordinates
 java.awt.Rectangle componentRectangle(java.awt.Rectangle r)
           
protected  javax.swing.JDialog createParentFrame()
           
 void drawBoards(java.awt.Graphics g, int xoffset, int yoffset, double zoom, java.awt.Component obs)
          Draw the boards of the map at the given point and zoom factor onto the given Graphics object
 void drawBoardsInRegion(java.awt.Graphics g, java.awt.Rectangle visibleRect)
           
 void drawDrawable(java.awt.Graphics g)
           
 void drawPieces(java.awt.Graphics g, int xOffset, int yOffset)
           
 void drawPiecesInRegion(java.awt.Graphics g, java.awt.Rectangle visibleRect)
           
 void ensureVisible(java.awt.Rectangle r)
          Ensure that the given region (in map coordinates) is visible
 Board findBoard(java.awt.Point p)
           
 GamePiece findPiece(java.awt.Point pt, PieceFinder finder)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent fe)
          When focus is lost, deselect all selected counters on this map.
 java.util.Enumeration getAllBoards()
           
 java.lang.Class[] getAllowableConfigureComponents()
          Return a list of valid sub-component Classes.
 java.lang.String[] getAttributeDescriptions()
          Return an array of Strings describing the attributes of this object.
 java.lang.String[] getAttributeNames()
           
 java.lang.Class[] getAttributeTypes()
          Return the Class for the attributes of this object.
 java.lang.String getAttributeValueString(java.lang.String key)
          Called by the AbstractBuildable.getBuildElement(org.w3c.dom.Document) method to write the attributes into an XML element
 VisibilityCondition getAttributeVisibility(java.lang.String name)
          By default, all attributes are visible
 Board getBoardByName(java.lang.String name)
          Return the board with the given name
 BoardPicker getBoardPicker()
          Every map must include a BoardPicker as one of its build components
static java.lang.String getConfigureTypeName()
           
 java.awt.Dimension getEdgeBuffer()
          The buffer of empty space around the boards in the Map window, in component coordinates at 100% zoom
 HelpFile getHelpFile()
           
 Highlighter getHighlighter()
           
 java.lang.String getId()
          Each Map must have a unique String id
static Map getMapById(java.lang.String id)
           
 java.lang.String getMapName()
           
 GamePiece[] getPieces()
           
 java.awt.Dimension getPreferredSize()
           
 Command getRestoreCommand()
          When saving a game, each GameComponent should return a Command that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null
 StackMetrics getStackMetrics()
          Every map must include a StackMetrics as one of its build components, which governs the stacking behavior of GamePieces on the map
 javax.swing.JToolBar getToolBar()
           
 javax.swing.JComponent getView()
          Return the AWT component representing the map
 double getZoom()
           
 Zoomer getZoomer()
          A map may include a Zoomer as one of its build components
 int indexOf(GamePiece s)
          Returns the index of a piece.
 boolean isPiecesVisible()
           
 java.lang.String locationName(java.awt.Point p)
           
 java.awt.Point mapCoordinates(java.awt.Point p1)
          Translate a point from component coordinates (i.e.
 java.awt.Rectangle mapRectangle(java.awt.Rectangle r)
           
 java.awt.Dimension mapSize()
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Mouse events are first translated into map coordinates.
 void mouseDragged(java.awt.event.MouseEvent e)
          Mouse motion events are not forwarded to LocalMouseListeners or to listeners on the stack The map scrolls when dragging the mouse near the edge
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
          Mouse motion events are not forwarded to LocalMouseListeners or to listeners on the stack
 void mousePressed(java.awt.event.MouseEvent e)
          Mouse events are first translated into map coordinates.
 void mouseReleased(java.awt.event.MouseEvent e)
          Mouse events are first translated into map coordinates.
 void paint(java.awt.Graphics g)
          Painting the map is done in three steps: 1) draw each of the Boards on the map.
 void paint(java.awt.Graphics g, int xOffset, int yOffset)
          Paint the map at the given offset, i.e.
 void paintRegion(java.awt.Graphics g, java.awt.Rectangle visibleRect)
           
 Command placeAt(GamePiece piece, java.awt.Point pt)
          Place a piece at the destination point.
 Command placeOrMerge(GamePiece p, java.awt.Point pt)
          Move a piece to the destination point.
 void popMouseListener()
          MouseListeners on a map may be pushed and popped onto a stack.
 void pushMouseListener(java.awt.event.MouseListener l)
          MouseListeners on a map may be pushed and popped onto a stack.
 void removeDrawComponent(Drawable theComponent)
          Remove a Drawable component from this map
 void removeFrom(Buildable b)
          Remove this component from its parent
 void removeLocalMouseListener(java.awt.event.MouseListener l)
           
 void removePiece(GamePiece s)
          Removes a piece from the map
 void repaint()
           
 void repaint(boolean cf)
           
 void repaint(java.awt.Rectangle r)
          Repaint the given area, specified in map coordinates
 void reposition(GamePiece s, int pos)
          Reorder the argument GamePiece to the new index.
 void scroll(int dx, int dy)
          Scrolls the map in the containing JScrollPane
 java.awt.Rectangle selectionBoundsOf(GamePiece p)
          Returns the selection bounding box of a GamePiece accounting for the offset of a piece within a stack
 void setAttribute(java.lang.String key, java.lang.Object value)
          Called by the build(org.w3c.dom.Element) method, where value is the String value read by the XML attribute.
protected  void setBoardBoundaries()
          Adjusts the bounds() rectangle to account for the Board's relative position to other boards.
 void setBoardPicker(BoardPicker picker)
          Every map must include a BoardPicker as one of its build components
 void setBoards(java.util.Enumeration boardList)
          Set the boards for this map.
 void setHighlighter(Highlighter h)
           
 void setID(java.lang.String id)
          Each Map must have a unique String id
 void setMapName(java.lang.String s)
           
 void setPiecesVisible(boolean show)
           
 void setStackMetrics(StackMetrics sm)
          Every map must include a StackMetrics as one of its build components, which governs the stacking behavior of GamePieces on the map
 void setup(boolean show)
          When a game is started, create a top-level window, if none exists.
 void setZoomer(Zoomer z)
          A map may include a Zoomer as one of its build components
 boolean shouldDockIntoMainWindow()
           
 java.awt.Point snapTo(java.awt.Point p)
           
 
Methods inherited from class VASSAL.build.AbstractConfigurable
addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, remove, setConfigureName
 
Methods inherited from class VASSAL.build.AbstractBuildable
add, getBuildComponents, getBuildElement, getComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface VASSAL.build.Configurable
addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, remove
 
Methods inherited from interface VASSAL.build.Buildable
add, getBuildElement
 

Field Detail

theMap

protected javax.swing.JPanel theMap

scroll

protected javax.swing.JScrollPane scroll

topWindow

protected javax.swing.JDialog topWindow

mainWindowDock

protected ComponentSplitter.SplitPane mainWindowDock

picker

protected BoardPicker picker

toolBar

protected javax.swing.JToolBar toolBar

zoom

protected Zoomer zoom

metrics

protected StackMetrics metrics

edgeBuffer

protected java.awt.Dimension edgeBuffer

launchButton

protected LaunchButton launchButton

useLaunchButton

protected boolean useLaunchButton

markMovedOption

protected java.lang.String markMovedOption

multicaster

protected java.awt.event.MouseListener multicaster

mouseListenerStack

protected java.util.Vector mouseListenerStack

boards

protected java.util.Vector boards

maxStacks

protected int maxStacks

moreStacks

protected int moreStacks

stack

protected GamePiece[] stack

nstacks

protected int nstacks

highlighter

protected Highlighter highlighter

NAME

public static final java.lang.String NAME

MARK_MOVED

public static final java.lang.String MARK_MOVED

EDGE_WIDTH

public static final java.lang.String EDGE_WIDTH

EDGE_HEIGHT

public static final java.lang.String EDGE_HEIGHT

HIGHLIGHT_COLOR

public static final java.lang.String HIGHLIGHT_COLOR

HIGHLIGHT_THICKNESS

public static final java.lang.String HIGHLIGHT_THICKNESS

ALLOW_MULTIPLE

public static final java.lang.String ALLOW_MULTIPLE

USE_LAUNCH_BUTTON

public static final java.lang.String USE_LAUNCH_BUTTON

BUTTON_NAME

public static final java.lang.String BUTTON_NAME

HOTKEY

public static final java.lang.String HOTKEY
Constructor Detail

Map

public Map()
Method Detail

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Description copied from interface: AutoConfigurable
Called by the Buildable.build(org.w3c.dom.Element) method, where value is the String value read by the XML attribute. Can also be called with Object value to set the attribute.
Overrides:
setAttribute in class AbstractBuildable
Following copied from class: VASSAL.build.AbstractBuildable
Parameters:
key - the name of the attribute. Will be one of those listed in AbstractBuildable.getAttributeNames()

getAttributeValueString

public java.lang.String getAttributeValueString(java.lang.String key)
Description copied from interface: AutoConfigurable
Called by the Buildable.getBuildElement(org.w3c.dom.Document) method to write the attributes into an XML element
Overrides:
getAttributeValueString in class AbstractBuildable
Following copied from class: VASSAL.build.AbstractBuildable
Parameters:
key - the name of the attribute. Will be one of those listed in AbstractBuildable.getAttributeNames()

build

public void build(org.w3c.dom.Element e)
Description copied from interface: Buildable
Build the object
Specified by:
build in interface Buildable
Overrides:
build in class AbstractBuildable
Following copied from interface: VASSAL.build.Buildable
Parameters:
e - the XML element containing the object data

setBoardPicker

public void setBoardPicker(BoardPicker picker)
Every map must include a BoardPicker as one of its build components

getBoardPicker

public BoardPicker getBoardPicker()
Every map must include a BoardPicker as one of its build components
Returns:
the BoardPicker for this map

setZoomer

public void setZoomer(Zoomer z)
A map may include a Zoomer as one of its build components

getZoomer

public Zoomer getZoomer()
A map may include a Zoomer as one of its build components
Returns:
the Zoomer for this map

setStackMetrics

public void setStackMetrics(StackMetrics sm)
Every map must include a StackMetrics as one of its build components, which governs the stacking behavior of GamePieces on the map

getStackMetrics

public StackMetrics getStackMetrics()
Every map must include a StackMetrics as one of its build components, which governs the stacking behavior of GamePieces on the map
Returns:
the StackMetrics for this map

getZoom

public double getZoom()
Returns:
the current zoom factor for the map

getToolBar

public javax.swing.JToolBar getToolBar()
Returns:
the toolbar for this map's window

addDrawComponent

public void addDrawComponent(Drawable theComponent)
Add a Drawable component to this map
See Also:
paint(java.awt.Graphics)

removeDrawComponent

public void removeDrawComponent(Drawable theComponent)
Remove a Drawable component from this map
See Also:
paint(java.awt.Graphics)

addTo

public void addTo(Buildable b)
Expects to be added to a GameModule. Determines a unique id for this map. Registers itself as KeyStrokeSource. Registers itself as a GameComponent. Registers itself as a drop target and drag source
Specified by:
addTo in interface Buildable
See Also:
getId(), DragBuffer

removeFrom

public void removeFrom(Buildable b)
Description copied from interface: Configurable
Remove this component from its parent
Specified by:
removeFrom in interface Configurable

setBoards

public void setBoards(java.util.Enumeration boardList)
Set the boards for this map. Each map may contain more than one Board

getRestoreCommand

public Command getRestoreCommand()
Description copied from interface: GameComponent
When saving a game, each GameComponent should return a Command 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 interface GameComponent

findBoard

public Board findBoard(java.awt.Point p)
Returns:
the Board on this map containing the argument point

getBoardByName

public Board getBoardByName(java.lang.String name)
Return the board with the given name
Parameters:
name -  
Returns:
null if no such board found

getPreferredSize

public java.awt.Dimension getPreferredSize()

mapSize

public java.awt.Dimension mapSize()
Returns:
the size of the map in pixels at 100% zoom, including the edge buffer

snapTo

public java.awt.Point snapTo(java.awt.Point p)
Returns:
the nearest allowable point according to the MapGrid on the Board at this point
See Also:
Board.snapTo(java.awt.Point), MapGrid.snapTo(java.awt.Point)

getEdgeBuffer

public java.awt.Dimension getEdgeBuffer()
The buffer of empty space around the boards in the Map window, in component coordinates at 100% zoom

mapCoordinates

public java.awt.Point mapCoordinates(java.awt.Point p1)
Translate a point from component coordinates (i.e. x,y position on the JPanel) to map coordinates, i.e. accounting for zoom factor
See Also:
componentCoordinates(java.awt.Point)

mapRectangle

public java.awt.Rectangle mapRectangle(java.awt.Rectangle r)

componentCoordinates

public java.awt.Point componentCoordinates(java.awt.Point p1)
Translate a point from map coordinates to component coordinates
See Also:
mapCoordinates(java.awt.Point)

componentRectangle

public java.awt.Rectangle componentRectangle(java.awt.Rectangle r)

locationName

public java.lang.String locationName(java.awt.Point p)
Returns:
a String name for the given location on the map
See Also:
Board.locationName(java.awt.Point)

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent fe)
When focus is lost, deselect all selected counters on this map.
Specified by:
focusLost in interface java.awt.event.FocusListener

addLocalMouseListener

public void addLocalMouseListener(java.awt.event.MouseListener l)
Because MouseEvents are received in component coordinates, it is inconvenient for MouseListeners on the map to have to translate to map coordinates. MouseListeners added with this method will receive mouse events with points already translated into map coordinates

removeLocalMouseListener

public void removeLocalMouseListener(java.awt.event.MouseListener l)

pushMouseListener

public void pushMouseListener(java.awt.event.MouseListener l)
MouseListeners on a map may be pushed and popped onto a stack. Only the top listener on the stack receives mouse events

popMouseListener

public void popMouseListener()
MouseListeners on a map may be pushed and popped onto a stack. Only the top listener on the stack receives mouse events

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Mouse events are first translated into map coordinates. Then the event is forwarded to the top MouseListener in the stack, if any, otherwise forwarded to all LocalMouseListeners
Specified by:
mouseClicked in interface java.awt.event.MouseListener
See Also:
pushMouseListener(java.awt.event.MouseListener), popMouseListener(), addLocalMouseListener(java.awt.event.MouseListener)

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Mouse events are first translated into map coordinates. Then the event is forwarded to the top MouseListener in the stack, if any, otherwise forwarded to all LocalMouseListeners
Specified by:
mousePressed in interface java.awt.event.MouseListener
See Also:
pushMouseListener(java.awt.event.MouseListener), popMouseListener(), addLocalMouseListener(java.awt.event.MouseListener)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Mouse events are first translated into map coordinates. Then the event is forwarded to the top MouseListener in the stack, if any, otherwise forwarded to all LocalMouseListeners
Specified by:
mouseReleased in interface java.awt.event.MouseListener
See Also:
pushMouseListener(java.awt.event.MouseListener), popMouseListener(), addLocalMouseListener(java.awt.event.MouseListener)

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Mouse motion events are not forwarded to LocalMouseListeners or to listeners on the stack
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Mouse motion events are not forwarded to LocalMouseListeners or to listeners on the stack The map scrolls when dragging the mouse near the edge
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

repaint

public void repaint(boolean cf)

paint

public void paint(java.awt.Graphics g)
Painting the map is done in three steps: 1) draw each of the Boards on the map. 2) draw all of the counters on the map. 3) draw all of the Drawable components on the map
See Also:
addDrawComponent(VASSAL.build.module.map.Drawable), setBoards(java.util.Enumeration), addPiece(VASSAL.counters.GamePiece)

paintRegion

public void paintRegion(java.awt.Graphics g,
                        java.awt.Rectangle visibleRect)

drawBoardsInRegion

public void drawBoardsInRegion(java.awt.Graphics g,
                               java.awt.Rectangle visibleRect)

repaint

public void repaint()

drawPiecesInRegion

public void drawPiecesInRegion(java.awt.Graphics g,
                               java.awt.Rectangle visibleRect)

drawPieces

public void drawPieces(java.awt.Graphics g,
                       int xOffset,
                       int yOffset)

drawDrawable

public void drawDrawable(java.awt.Graphics g)

paint

public void paint(java.awt.Graphics g,
                  int xOffset,
                  int yOffset)
Paint the map at the given offset, i.e. such that (xOffset, yOffset) is in the upper left corner

getHighlighter

public Highlighter getHighlighter()

setHighlighter

public void setHighlighter(Highlighter h)

getAllBoards

public java.util.Enumeration getAllBoards()
Returns:
an Enumeration of all Boards on the map

boundingBoxOf

public java.awt.Rectangle boundingBoxOf(GamePiece p)
Returns the boundingBox of a GamePiece accounting for the offset of a piece within its parent stack
See Also:
GamePiece.boundingBox()

selectionBoundsOf

public java.awt.Rectangle selectionBoundsOf(GamePiece p)
Returns the selection bounding box of a GamePiece accounting for the offset of a piece within a stack
See Also:
GamePiece.selectionBounds()

getPieces

public GamePiece[] getPieces()
Returns:
an array of all GamePieces on the map. This is a read-only copy. Altering the array does not alter the pieces on the map.

clearMapBorder

protected void clearMapBorder(java.awt.Graphics g)

setBoardBoundaries

protected void setBoardBoundaries()
Adjusts the bounds() rectangle to account for the Board's relative position to other boards. In other words, if Board A is N pixels wide and Board B is to the right of Board A, then the origin of Board B will be adjusted N pixels to the right.

drawBoards

public void drawBoards(java.awt.Graphics g,
                       int xoffset,
                       int yoffset,
                       double zoom,
                       java.awt.Component obs)
Draw the boards of the map at the given point and zoom factor onto the given Graphics object

repaint

public void repaint(java.awt.Rectangle r)
Repaint the given area, specified in map coordinates

setPiecesVisible

public void setPiecesVisible(boolean show)
Parameters:
show - if true, enable drawing of GamePiece. If false, don't draw GamePiece when painting the map

isPiecesVisible

public boolean isPiecesVisible()

createParentFrame

protected javax.swing.JDialog createParentFrame()
Returns:
the top-level window containing this map

shouldDockIntoMainWindow

public boolean shouldDockIntoMainWindow()

setup

public void setup(boolean show)
When a game is started, create a top-level window, if none exists. When a game is ended, remove all boards from the map
Specified by:
setup in interface GameComponent
See Also:
GameComponent

appendToTitle

public void appendToTitle(java.lang.String s)

findPiece

public GamePiece findPiece(java.awt.Point pt,
                           PieceFinder finder)

placeAt

public Command placeAt(GamePiece piece,
                       java.awt.Point pt)
Place a piece at the destination point. If necessary, remove the piece from its parent Stack or Map
Returns:
a Command that reproduces this action

placeOrMerge

public Command placeOrMerge(GamePiece p,
                            java.awt.Point pt)
Move a piece to the destination point. If a piece is at the point (i.e. has a location exactly equal to it), merge with the piece by forwarding to StackMetrics.merge(VASSAL.counters.GamePiece, VASSAL.counters.GamePiece). Otherwise, place by forwarding to placeAt()
See Also:
StackMetrics.merge(VASSAL.counters.GamePiece, VASSAL.counters.GamePiece)

addPiece

public void addPiece(GamePiece p)
Adds a GamePiece to this map. Removes the piece from its parent Stack and from its current map, if different from this map

reposition

public void reposition(GamePiece s,
                       int pos)
Reorder the argument GamePiece to the new index. When painting the map, pieces are drawn in order of index

indexOf

public int indexOf(GamePiece s)
Returns the index of a piece. When painting the map, pieces are drawn in order of index

removePiece

public void removePiece(GamePiece s)
Removes a piece from the map

centerAt

public void centerAt(java.awt.Point p)
Center the map at given map coordinates within its JScrollPane container

centerAt

public void centerAt(java.awt.Point p,
                     int dx,
                     int dy)
Center the map at the given map coordinates, if the point is not already within (dx,dy) of the center

ensureVisible

public void ensureVisible(java.awt.Rectangle r)
Ensure that the given region (in map coordinates) is visible

scroll

public void scroll(int dx,
                   int dy)
Scrolls the map in the containing JScrollPane
Parameters:
dx - number of pixels to scroll horizontally
dy - number of pixels to scroll vertically

getConfigureTypeName

public static java.lang.String getConfigureTypeName()

getMapName

public java.lang.String getMapName()

setMapName

public void setMapName(java.lang.String s)

getHelpFile

public HelpFile getHelpFile()
Specified by:
getHelpFile in interface Configurable
Following copied from interface: VASSAL.build.Configurable
Returns:
a HelpFilte describing how to use and configure this component

getAttributeDescriptions

public java.lang.String[] getAttributeDescriptions()
Description copied from class: AbstractConfigurable
Return an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object. The order of descriptions should be the same as the order of names in AbstractBuildable.getAttributeNames()
Overrides:
getAttributeDescriptions in class AbstractConfigurable

getAttributeNames

public java.lang.String[] getAttributeNames()
Overrides:
getAttributeNames in class AbstractBuildable
Following copied from interface: VASSAL.build.AutoConfigurable
Returns:
an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element

getAttributeTypes

public java.lang.Class[] getAttributeTypes()
Description copied from class: AbstractConfigurable
Return the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, Color, and KeyStroke The order of classes should be the same as the order of names in AbstractBuildable.getAttributeNames()
Overrides:
getAttributeTypes in class AbstractConfigurable

getAllowableConfigureComponents

public java.lang.Class[] 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 interface Configurable

getAttributeVisibility

public VisibilityCondition getAttributeVisibility(java.lang.String name)
Description copied from class: AbstractConfigurable
By default, all attributes are visible
Overrides:
getAttributeVisibility in class AbstractConfigurable
Following copied from class: VASSAL.build.AbstractConfigurable
Parameters:
name -  
Returns:
 

setID

public void setID(java.lang.String id)
Each Map must have a unique String id

getMapById

public static Map getMapById(java.lang.String id)

getId

public java.lang.String getId()
Each Map must have a unique String id
Returns:
the id for this map

getView

public javax.swing.JComponent getView()
Return the AWT component representing the map