|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--VASSAL.build.AbstractBuildable
|
+--VASSAL.build.AbstractConfigurable
|
+--VASSAL.build.module.map.StackMetrics
Encapsulates information on how to draw expanded and unexpanded views of a stack
| Inner classes inherited from class VASSAL.build.AutoConfigurable |
AutoConfigurable.Util |
| Field Summary | |
protected java.awt.Color |
blankColor
|
static java.lang.String |
BOTTOM_KEY
|
protected javax.swing.KeyStroke |
bottomKey
|
static java.lang.String |
COLOR
|
protected boolean |
disabled
|
static java.lang.String |
DISABLED
|
static java.lang.String |
DOWN_KEY
|
protected javax.swing.KeyStroke |
downKey
|
static java.lang.String |
EXSEP_X
|
static java.lang.String |
EXSEP_Y
|
protected int |
exSepX
|
protected int |
exSepY
|
protected Map |
map
|
protected PieceFilter |
selectedVisible
|
static java.lang.String |
TOP_KEY
|
protected javax.swing.KeyStroke |
topKey
|
static java.lang.String |
UNEXSEP_X
|
static java.lang.String |
UNEXSEP_Y
|
protected int |
unexSepX
|
protected int |
unexSepY
|
protected PieceFilter |
unselectedVisible
|
static java.lang.String |
UP_KEY
|
protected javax.swing.KeyStroke |
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 | |
StackMetrics()
|
|
StackMetrics(boolean dis,
int exSx,
int exSy,
int unexSx,
int unexSy)
|
|
| Method Summary | |
void |
addTo(Buildable b)
Adds this component to its parent. |
Stack |
createStack(GamePiece p)
|
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. |
protected void |
drawUnexpanded(GamePiece p,
java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
Draw a GamePiece that is not the top piece in an unexpanded Stack
Default implementation is a white square with a black border |
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 name)
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 |
java.awt.Color |
getBlankColor()
The color used to draw boxes representing counters beneath the top one in a stack. |
java.lang.String |
getConfigureName()
The name of this Configurable Object |
static java.lang.String |
getConfigureTypeName()
|
int |
getContents(Stack parent,
java.awt.Point[] positions,
java.awt.Shape[] shapes,
java.awt.Rectangle[] boundingBoxes,
int x,
int y)
Fill the argument arrays with the positions, selection bounds and bounding boxes of the pieces in the argument stack |
HelpFile |
getHelpFile()
|
javax.swing.KeyStroke |
getMoveBottomKey()
|
javax.swing.KeyStroke |
getMoveDownKey()
|
javax.swing.KeyStroke |
getMoveTopKey()
|
javax.swing.KeyStroke |
getMoveUpKey()
|
boolean |
isStackingEnabled()
|
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)
|
Command |
placeOrMerge(GamePiece fixed,
GamePiece moving)
Merge the two pieces if stacking is enabled. |
java.awt.Point |
relativePosition(Stack parent,
GamePiece c)
|
void |
removeFrom(Buildable parent)
Remove this component from its parent |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Called by the AbstractBuildable.build(org.w3c.dom.Element) method, where value is the
String value read by the XML attribute. |
| 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 |
| Field Detail |
protected int exSepX
protected int exSepY
protected int unexSepX
protected int unexSepY
protected boolean disabled
protected javax.swing.KeyStroke topKey
protected javax.swing.KeyStroke bottomKey
protected javax.swing.KeyStroke upKey
protected javax.swing.KeyStroke downKey
protected PieceFilter unselectedVisible
protected PieceFilter selectedVisible
protected java.awt.Color blankColor
public static final java.lang.String EXSEP_X
public static final java.lang.String EXSEP_Y
public static final java.lang.String UNEXSEP_X
public static final java.lang.String UNEXSEP_Y
public static final java.lang.String DISABLED
public static final java.lang.String TOP_KEY
public static final java.lang.String BOTTOM_KEY
public static final java.lang.String UP_KEY
public static final java.lang.String DOWN_KEY
public static final java.lang.String COLOR
protected Map map
| Constructor Detail |
public StackMetrics()
public StackMetrics(boolean dis,
int exSx,
int exSy,
int unexSx,
int unexSy)
| Method Detail |
public void setAttribute(java.lang.String name,
java.lang.Object value)
AutoConfigurableBuildable.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.setAttribute in class AbstractBuildableVASSAL.build.AbstractBuildablekey - the name of the attribute. Will be one of those
listed in AbstractBuildable.getAttributeNames()public java.lang.String getAttributeValueString(java.lang.String name)
AutoConfigurableBuildable.getBuildElement(org.w3c.dom.Document) method to write the
attributes into an XML elementgetAttributeValueString in class AbstractBuildableVASSAL.build.AbstractBuildablekey - the name of the attribute. Will be one of those
listed in AbstractBuildable.getAttributeNames()public void addTo(Buildable b)
Buildable
public void draw(Stack stack,
java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
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 relativePosition(VASSAL.counters.Stack, VASSAL.counters.GamePiece)
If expanded, all GamePieces are drawn with separation given by
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
public void draw(Stack stack,
java.awt.Point location,
java.awt.Graphics g,
Map map,
double zoom,
java.awt.Rectangle visibleRect)
stack - g - location - the location of the stack in component coordinateszoom - visibleRect - the visible rectangle in component coordinates
protected void drawUnexpanded(GamePiece p,
java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
GamePiece that is not the top piece in an unexpanded Stack
Default implementation is a white square with a black borderpublic java.awt.Color getBlankColor()
public int getContents(Stack parent,
java.awt.Point[] positions,
java.awt.Shape[] shapes,
java.awt.Rectangle[] boundingBoxes,
int x,
int y)
parent - The parent Stackpositions - If non-null will contain a Point giving the position of each piece in parentshapes - If non-null will contain a Shape giving the shape of for each piece in parentboundingBoxes - If non-null will contain a Rectangle giving the bounding box for each piece in parentx - the x-location of the parenty - the y-location of the parent
protected void nextPosition(java.awt.Point currentPos,
java.awt.Rectangle currentBounds,
java.awt.Point nextPos,
java.awt.Rectangle nextBounds,
int dx,
int dy)
public java.awt.Point relativePosition(Stack parent,
GamePiece c)
public boolean isStackingEnabled()
public void removeFrom(Buildable parent)
Configurablepublic java.lang.String getConfigureName()
ConfigurablegetConfigureName in class AbstractConfigurablepublic static java.lang.String getConfigureTypeName()
public HelpFile getHelpFile()
VASSAL.build.Configurablepublic java.lang.Class[] getAllowableConfigureComponents()
Configurablepublic java.lang.String[] getAttributeNames()
getAttributeNames in class AbstractBuildableVASSAL.build.AutoConfigurablepublic java.lang.String[] getAttributeDescriptions()
AbstractConfigurableAbstractBuildable.getAttributeNames()getAttributeDescriptions in class AbstractConfigurablepublic java.lang.Class[] getAttributeTypes()
AbstractConfigurableAbstractBuildable.getAttributeNames()getAttributeTypes in class AbstractConfigurablepublic VisibilityCondition getAttributeVisibility(java.lang.String name)
AbstractConfigurablegetAttributeVisibility in class AbstractConfigurableVASSAL.build.AbstractConfigurablename - public Stack createStack(GamePiece p)
public javax.swing.KeyStroke getMoveUpKey()
public javax.swing.KeyStroke getMoveDownKey()
public javax.swing.KeyStroke getMoveTopKey()
public javax.swing.KeyStroke getMoveBottomKey()
public Command placeOrMerge(GamePiece fixed,
GamePiece moving)
fixed - moving - merge(VASSAL.counters.GamePiece, VASSAL.counters.GamePiece)
public Command merge(GamePiece fixed,
GamePiece moving)
moving - the GamePiece that will be merged into the stackfixed - the GamePiece defining the location and contents of the existing stack
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||