VASSAL.build.module.map
Class FreePieceMover

java.lang.Object
  |
  +--VASSAL.build.AbstractBuildable
        |
        +--VASSAL.build.module.map.PieceMover
              |
              +--VASSAL.build.module.map.FreePieceMover
All Implemented Interfaces:
Buildable, Drawable, java.util.EventListener, GameComponent, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, PieceFinder, Sort.Comparator

public class FreePieceMover
extends PieceMover
implements java.awt.event.MouseMotionListener, Drawable

A class for moving and rotating pieces, as for mineatures-based games


Field Summary
protected  java.awt.Point anchor
           
protected  java.awt.Point arrow
           
protected  GamePiece dragging
           
protected  FreeRotator rotator
           
protected  Transparent trans
           
 
Fields inherited from class VASSAL.build.module.map.PieceMover
AUTO_REPORT, dragBegin, map
 
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents
 
Fields inherited from interface VASSAL.counters.PieceFinder
MOVABLE, PIECE_IN_STACK, STACK_ONLY
 
Constructor Summary
FreePieceMover()
           
 
Method Summary
 void addTo(Buildable b)
          Adds this component to its parent.
protected  void clear()
           
 void draw(java.awt.Graphics g, Map map)
           
protected  java.awt.Point getDragDestination(java.awt.Point src, java.awt.Point dest)
          A Mouse release event will be translated to this location (in map coordinates).
protected  int getMaxDragDistance(GamePiece piece)
          The maximum distance that a piece may be dragged, in map-coordinate pixels
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 
Methods inherited from class VASSAL.build.module.map.PieceMover
compare, getAttributeNames, getAttributeValueString, getRestoreCommand, isClick, isMultipleSelectionEvent, markMoved, mouseClicked, mouseEntered, mouseExited, movedPiece, movePieces, select, setAttribute, setup, shouldMarkMoved
 
Methods inherited from class VASSAL.build.AbstractBuildable
add, build, getBuildComponents, getBuildElement, getComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dragging

protected GamePiece dragging

trans

protected Transparent trans

rotator

protected FreeRotator rotator

anchor

protected java.awt.Point anchor

arrow

protected java.awt.Point arrow
Constructor Detail

FreePieceMover

public FreePieceMover()
Method Detail

addTo

public void addTo(Buildable b)
Description copied from interface: Buildable
Adds this component to its parent. In order to make Buildable objects extensible, the child is reponsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.
Overrides:
addTo in class PieceMover

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Overrides:
mousePressed in class PieceMover

clear

protected void clear()

draw

public void draw(java.awt.Graphics g,
                 Map map)
Specified by:
draw in interface Drawable

getDragDestination

protected java.awt.Point getDragDestination(java.awt.Point src,
                                            java.awt.Point dest)
A Mouse release event will be translated to this location (in map coordinates). This allows restrictions, such as distance limitations, to be put on where a piece may move.
Returns:
null if the move is invalid

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Overrides:
mouseReleased in class PieceMover

getMaxDragDistance

protected int getMaxDragDistance(GamePiece piece)
The maximum distance that a piece may be dragged, in map-coordinate pixels
Parameters:
piece -  
Returns:
 

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener