Class HandMetrics
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.map.StackMetrics
VASSAL.build.module.map.HandMetrics
- All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, PropertyNameSource, ValidityChecker, Translatable, Auditable, ImageSearchTarget, SearchTarget
Handles the drawing of cards in a
PlayerHand.
Lays out the cards horizontally with no overlap and even spacing.-
Nested Class Summary
Nested classes/interfaces inherited from interface AutoConfigurable
AutoConfigurable.Util -
Field Summary
Fields inherited from class StackMetrics
blankColor, BOTTOM_KEY, bottomKey, COLOR, DEFAULT_EXSEP_X, DEFAULT_EXSEP_Y, DEFAULT_UNEXSEP_X, DEFAULT_UNEXSEP_Y, 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, upKeyModifier and TypeFieldDescriptionprotected Colorstatic final Stringprotected KeyStrokestatic final Stringstatic final intstatic final intstatic final intstatic final intprotected booleanstatic final Stringstatic final Stringprotected KeyStrokestatic final Stringstatic final Stringprotected intprotected intprotected Mapprotected PieceFilterstatic final Stringprotected KeyStrokestatic final Stringstatic final Stringprotected intprotected intprotected PieceFilterstatic final Stringprotected KeyStrokeFields inherited from class AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameModifier and TypeFieldDescriptionprotected PropertyChangeSupportprotected Configurerprotected Stringprotected ComponentI18nDataprotected StringFields inherited from class AbstractBuildable
buildComponents, validatorFields inherited from interface Configurable
NAME_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDifferent instances of StackMetrics may render aStackin different ways.voidDraw only those pieces in the target stack whose boundingBoxes fall within the given visibleRect This method is considerably faster than the other draw method.Place a GamePiece on top of another GamePiece Create/remove stacks as necessary, even if stacking is disabled for this instanceprotected voidnextPosition(Point currentPos, Rectangle currentBounds, Point nextPos, Rectangle nextBounds, int dx, int dy) Methods inherited from class StackMetrics
addTo, createStack, createStack, drawUnexpanded, getAllowableConfigureComponents, getAttributeDescriptions, getAttributeNames, getAttributeTypes, getAttributeValueString, getAttributeVisibility, getBlankColor, getConfigureName, getConfigureTypeName, getContents, getHelpFile, getMoveBottomKey, getMoveDownKey, getMoveTopKey, getMoveUpKey, isMandatory, isStackingEnabled, isUnique, placeOrMerge, relativePosition, removeFrom, setAttributeModifier and TypeMethodDescriptionvoidAdds this component to its parent.createStack(GamePiece p, boolean force) protected voiddrawUnexpanded(GamePiece p, Graphics g, int x, int y, Component obs, double zoom) Class<?>[]String[]Return an array of Strings describing the attributes of this object.String[]Lists all the buildFile (XML) attribute names for this component.Class<?>[]Return the Class for the attributes of this object.Called by theBuildable.getBuildElement(Document)method to write the attributes into an XML elementgetAttributeVisibility(String name) By default, all attributes are visibleThe color used to draw boxes representing counters beneath the top one in a stack.ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.static StringintgetContents(Stack parent, Point[] positions, Shape[] shapes, Rectangle[] boundingBoxes, int x, int y) Fill the argument arrays with the positions, selection bounds and bounding boxes of the pieces in the argument stackbooleanIs this component a reqired component within its parent?booleanbooleanisUnique()Does this component need to be unique within it's parent?placeOrMerge(GamePiece fixed, GamePiece moving) Merge the two pieces if stacking is enabled.relativePosition(Stack parent, GamePiece c) voidremoveFrom(Buildable parent) Remove this component from its parentvoidsetAttribute(String name, Object value) Sets a buildFile (XML) attribute value for this component.Methods inherited from class AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigurer, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameModifier and TypeMethodDescriptionvoidSet the owning translatable of this componentvoidAdd a PropertyChangeListener.protected StringReturns the name of the configurable type for display purposes.voidRemove a Buildable object from this objectvoidprotected voidSets all attributes untranslatable.protected voidsetAttributeTranslatable(String attr, boolean b) Over-ride the default attribute translatability.voidSets the name and fires a PropertyChangeEventMethods inherited from class AbstractBuildable
addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validateModifier and TypeMethodDescriptionvoidAdds all images used by this component AND any subcomponents to the collectionvoidBuild this component by getting all XML attributes of the XML element and callingAbstractBuildable.setAttribute(String, Object)with the String value of the attribute<T> List<T> getAllDescendantComponentsOf(Class<T> target) Recursively descend the build tree and return aListof all components that are instances of the given classDeprecated, for removal: This API element is subject to removal in a future version.getBuildElement(Document doc) <T> Enumeration<T> getComponents(Class<T> target) Deprecated, for removal: This API element is subject to removal in a future version.UseAbstractBuildable.getComponentsOf(Class)instead.<T> List<T> getComponentsOf(Class<T> target) Override this method to provide a list of properties to be exposed for use by expressions in the module.voidsetAncestor(Buildable ancestor) voidvalidate(Buildable target, ValidationReport report) Methods inherited from class AbstractImageFinder
addLocalImageNames, getAllImageNames, getLocalImageNamesModifier and TypeMethodDescriptionvoidClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Auditable
getComponentName, getComponentTypeName
-
Constructor Details
-
HandMetrics
public HandMetrics()
-
-
Method Details
-
draw
Description copied from class:StackMetricsDifferent instances of StackMetrics may render aStackin different ways. The default algorithm is: If not expanded, all but the top visible GamePiece is drawn as a white square with size given byGamePiece.getShape(). The separation between GamePieces is given byStackMetrics.relativePosition(Stack, GamePiece)If expanded, all GamePieces are drawn with separation given byStackMetrics.relativePosition(Stack, GamePiece). GamePiece that are selected are drawn in front of other GamePieces, even those above them in the stack.- Overrides:
drawin classStackMetrics
-
draw
public void draw(Stack stack, Point location, Graphics g, Map map, double zoom, Rectangle visibleRect) Description copied from class:StackMetricsDraw 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:
drawin classStackMetrics- Parameters:
stack-location- the location of the stack in component coordinatesg-zoom-visibleRect- the visible rectangle in component coordinates
-
nextPosition
protected void nextPosition(Point currentPos, Rectangle currentBounds, Point nextPos, Rectangle nextBounds, int dx, int dy) - Overrides:
nextPositionin classStackMetrics
-
merge
Description copied from class:StackMetricsPlace a GamePiece on top of another GamePiece Create/remove stacks as necessary, even if stacking is disabled for this instance- Overrides:
mergein classStackMetrics- Parameters:
fixed- the GamePiece defining the location and contents of the existing stackmoving- the GamePiece that will be merged into the stack- Returns:
- a Command that accomplishes this task
-
AbstractBuildable.getBuildables()instead.