VASSAL.build.module.map
Class HandMetrics

java.lang.Object
  |
  +--VASSAL.build.AbstractBuildable
        |
        +--VASSAL.build.AbstractConfigurable
              |
              +--VASSAL.build.module.map.StackMetrics
                    |
                    +--VASSAL.build.module.map.HandMetrics
All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, ValidityChecker

public class HandMetrics
extends StackMetrics

Handles the drawing of cards in a PlayerHand. Lays out the cards horizontally with no overlap and even spacing.


Inner classes inherited from class VASSAL.build.AutoConfigurable
AutoConfigurable.Util
 
Fields inherited from class VASSAL.build.module.map.StackMetrics
blankColor, BOTTOM_KEY, bottomKey, COLOR, disabled, DISABLED, DOWN_KEY, downKey, EXSEP_X, EXSEP_Y, exSepX, exSepY, map, selectedVisible, TOP_KEY, topKey, UNEXSEP_X, UNEXSEP_Y, unexSepX, unexSepY, unselectedVisible, UP_KEY, upKey
 
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, name
 
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
 
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
 
Constructor Summary
HandMetrics()
           
 
Method Summary
 void draw(Stack stack, java.awt.Graphics g, int x, int y, java.awt.Component obs, double zoom)
          Different instances of StackMetrics may render a Stack in different ways.
 void draw(Stack stack, java.awt.Point location, java.awt.Graphics g, Map map, double zoom, java.awt.Rectangle visibleRect)
          Draw only those pieces in the target stack whose boundingBoxes fall within the given visibleRect This method is considerably faster than the other draw method.
 Command merge(GamePiece fixed, GamePiece moving)
          Place a GamePiece on top of another GamePiece Create/remove stacks as necessary, even if stacking is disabled for this instance
protected  void nextPosition(java.awt.Point currentPos, java.awt.Rectangle currentBounds, java.awt.Point nextPos, java.awt.Rectangle nextBounds, int dx, int dy)
           
 
Methods inherited from class VASSAL.build.module.map.StackMetrics
addTo, createStack, drawUnexpanded, getAllowableConfigureComponents, getAttributeDescriptions, getAttributeNames, getAttributeTypes, getAttributeValueString, getAttributeVisibility, getBlankColor, getConfigureName, getConfigureTypeName, getContents, getHelpFile, getMoveBottomKey, getMoveDownKey, getMoveTopKey, getMoveUpKey, isStackingEnabled, placeOrMerge, relativePosition, removeFrom, setAttribute
 
Methods inherited from class VASSAL.build.AbstractConfigurable
addPropertyChangeListener, getConfigureComponents, getConfigurer, remove, setConfigureName
 
Methods inherited from class VASSAL.build.AbstractBuildable
add, build, getBuildComponents, getBuildElement, getComponents, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface VASSAL.build.Buildable
add, build, getBuildElement
 

Constructor Detail

HandMetrics

public HandMetrics()
Method Detail

draw

public void draw(Stack stack,
                 java.awt.Graphics g,
                 int x,
                 int y,
                 java.awt.Component obs,
                 double zoom)
Description copied from class: StackMetrics
Different instances of StackMetrics may render a Stack in different ways. The default algorithm is: If not expanded, all but the top visible GamePiece is drawn as a white square with size given by GamePiece.getShape(). The separation between GamePieces is given by StackMetrics.relativePosition(VASSAL.counters.Stack, VASSAL.counters.GamePiece) If expanded, all GamePieces are drawn with separation given by StackMetrics.relativePosition(VASSAL.counters.Stack, VASSAL.counters.GamePiece). GamePiece that are selected are drawn in front of other GamePieces, even those above them in the stack
Overrides:
draw in class StackMetrics

draw

public void draw(Stack stack,
                 java.awt.Point location,
                 java.awt.Graphics g,
                 Map map,
                 double zoom,
                 java.awt.Rectangle visibleRect)
Description copied from class: StackMetrics
Draw only those pieces in the target stack whose boundingBoxes fall within the given visibleRect This method is considerably faster than the other draw method.
Overrides:
draw in class StackMetrics
Following copied from class: VASSAL.build.module.map.StackMetrics
Parameters:
stack -  
g -  
location - the location of the stack in component coordinates
zoom -  
visibleRect - the visible rectangle in component coordinates

nextPosition

protected void nextPosition(java.awt.Point currentPos,
                            java.awt.Rectangle currentBounds,
                            java.awt.Point nextPos,
                            java.awt.Rectangle nextBounds,
                            int dx,
                            int dy)
Overrides:
nextPosition in class StackMetrics

merge

public Command merge(GamePiece fixed,
                     GamePiece moving)
Description copied from class: StackMetrics
Place a GamePiece on top of another GamePiece Create/remove stacks as necessary, even if stacking is disabled for this instance
Overrides:
merge in class StackMetrics
Following copied from class: VASSAL.build.module.map.StackMetrics
Parameters:
moving - the GamePiece that will be merged into the stack
fixed - the GamePiece defining the location and contents of the existing stack
Returns:
a Command that accomplishes this task