Package VASSAL.counters
Class Embellishment
java.lang.Object
VASSAL.counters.Decorator
VASSAL.counters.Embellishment
- All Implemented Interfaces:
PropertyNameSource,PropertySource,EditablePiece,GamePiece,PropertyExporter,StateMergeable,TranslatablePiece,PersistentPropertyContainer
public class Embellishment extends Decorator implements TranslatablePiece
The "Layer" trait. Contains a list of images that the user may cycle through.
The current image is superimposed over the inner piece. The entire layer may
be activated or deactivated.
Changes to support NamedKeyStrokes:
- Random and reset command changed directly to Name Key Strokes.
- Disentangle alwaysActive flag from length of activateKey field. Make a
separate field and save in type
- Add a Version field to type to enable conversion of Activate/Increase/Decrease
commands. Note commands with more than 1 target keycode cannot be converted
- Simplify code. Removed Version 0 (3.1) code to a separate class Embellishment0. The BasicCommandEncoder
replaces this class with an Embellishment0 if Embellishment(type, inner) returns
a version 0 Embellishment trait.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classEmbellishment.EdReturn Property names exposed by this trait -
Field Summary
Fields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAMEFields inherited from interface VASSAL.i18n.TranslatablePiece
PREFIX -
Constructor Summary
Constructors Constructor Description Embellishment()Embellishment(String type, GamePiece d) -
Method Summary
Modifier and Type Method Description RectangleboundingBox()The area which this GamePiece occupies when drawn at the point (0,0)booleancanBeActivated()Can this Layer be Activated? Old-style depended on checking if any activation keys where specified.protected voidcheckPropertyLevel()protected voiddoDecrease()protected voiddoIncrease()voiddraw(Graphics g, int x, int y, Component obs, double zoom)Draw this GamePieceprotected StringgetCommonName(boolean localized, int i)Get the name of this level (alone)protected ImagegetCurrentImage()Deprecated, for removal: This API element is subject to removal in a future version.RectanglegetCurrentImageBounds()StringgetDescription()A plain-English description of this type of piecePieceEditorgetEditor()Get the configurer for this traitHelpFilegetHelpFile()PieceI18nDatagetI18nData()Return I18n data for this pieceStringgetLayerName()Return raw Embellishment namestatic EmbellishmentgetLayerWithMatchingActivateCommand(GamePiece piece, KeyStroke stroke, boolean active)If the argument GamePiece contains a Layer whose "activate" command matches the given keystroke, and whose active status matches the boolean argument, return that Layerstatic EmbellishmentgetLayerWithMatchingActivateCommand(GamePiece piece, NamedKeyStroke stroke, boolean active)protected StringgetLocalizedCommonName(int i)Get the localized name of this level (alone)StringgetLocalizedName()Return the translated name for this piece.ObjectgetLocalizedProperty(Object key)StringgetName()The plain English name for this pieceStringgetName(boolean localized)ObjectgetProperty(Object key)List<String>getPropertyNames()Default Property Name SourceShapegetShape()Return the Shape of the counter by adding the shape of this layer to the shape of all inner traits.intgetValue()intgetVersion()booleanisActive()KeyCommand[]myGetKeyCommands()StringmyGetState()StringmyGetType()CommandmyKeyEvent(KeyStroke stroke)The response of this trait alone to the given KeyStrokevoidmySetState(String s)Set just the state of this traitvoidmySetType(String s)Set the type information for this piece.StringoldGetType()Deprecated, for removal: This API element is subject to removal in a future version.No ReplacementvoidsetActive(boolean act)voidsetValue(int val)Set the current level - First level = 0 Does not change the active statusprotected Stringstrip(String s)Methods inherited from class VASSAL.counters.Decorator
getCommandDescription, getDecorator, getI18nData, getI18nData, getId, getInner, getInnermost, getKeyCommands, getMap, getOuter, getOutermost, getParent, getPersistentProperty, getPosition, getProperties, getState, getTranslation, getType, isSelected, keyEvent, mergeState, putOldProperties, repack, reportDataError, reportDataError, reportDataError, setId, setInner, setMap, setOldProperties, setOldProperties, setParent, setPersistentProperty, setPosition, setProperty, setSelected, setState, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface VASSAL.counters.GamePiece
getId, getMap, getParent, getPosition, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setProperty, setStateMethods inherited from interface VASSAL.counters.PropertyExporter
getProperties
-
Field Details
-
OLD_ID
- See Also:
- Constant Field Values
-
ID
- See Also:
- Constant Field Values
-
IMAGE
- See Also:
- Constant Field Values
-
NAME
- See Also:
- Constant Field Values
-
LEVEL
- See Also:
- Constant Field Values
-
ACTIVE
- See Also:
- Constant Field Values
-
activateKey
-
upKey
-
downKey
-
activateModifiers
protected int activateModifiers -
upModifiers
protected int upModifiers -
downModifiers
protected int downModifiers -
upCommand
-
downCommand
-
activateCommand
-
resetCommand
-
resetLevel
-
loopLevels
protected boolean loopLevels -
resetKey
-
followProperty
protected boolean followProperty -
propertyName
-
followPropertyExpression
-
firstLevelValue
protected int firstLevelValue -
rndKey
-
value
protected int value -
nValues
protected int nValues -
xOff
protected int xOff -
yOff
protected int yOff -
imageName
-
commonName
-
size
-
imagePainter
-
drawUnderneathWhenSelected
protected boolean drawUnderneathWhenSelected -
name
-
commands
-
up
-
down
-
lastBounds
-
lastShape
-
BASE_VERSION
public static final int BASE_VERSION- See Also:
- Constant Field Values
-
CURRENT_VERSION
public static final int CURRENT_VERSION- See Also:
- Constant Field Values
-
version
protected int version -
alwaysActive
protected boolean alwaysActive -
activateKeyStroke
-
increaseKeyStroke
-
decreaseKeyStroke
-
-
Constructor Details
-
Embellishment
public Embellishment() -
Embellishment
-
-
Method Details
-
isActive
public boolean isActive() -
setActive
public void setActive(boolean act) -
getValue
public int getValue() -
setValue
public void setValue(int val)Set the current level - First level = 0 Does not change the active status- Parameters:
val- Value to set
-
mySetType
Description copied from interface:EditablePieceSet the type information for this piece. SeeDecorator.myGetType()- Specified by:
mySetTypein interfaceEditablePiece
-
canBeActivated
public boolean canBeActivated()Can this Layer be Activated? Old-style depended on checking if any activation keys where specified. New-stule maintains a separate alwaysActive variable- Returns:
- true if this layer trait has an activate command
-
getLocalizedName
Description copied from class:DecoratorReturn the translated name for this piece. Most pieces do not have translatable elements, so just return the standard name- Specified by:
getLocalizedNamein interfaceGamePiece- Overrides:
getLocalizedNamein classDecorator
-
getName
Description copied from interface:GamePieceThe plain English name for this piece -
getName
-
getLayerName
Return raw Embellishment name- Returns:
- Embellishment name
-
mySetState
Description copied from class:DecoratorSet just the state of this trait- Specified by:
mySetStatein classDecorator- See Also:
Decorator.myGetState()
-
myGetType
- Specified by:
myGetTypein classDecorator- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
oldGetType
Deprecated, for removal: This API element is subject to removal in a future version.No Replacement -
myGetState
- Specified by:
myGetStatein classDecorator- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
draw
Description copied from interface:GamePieceDraw this GamePiece -
checkPropertyLevel
protected void checkPropertyLevel() -
myGetKeyCommands
- Specified by:
myGetKeyCommandsin classDecorator- Returns:
- the commands for this trait alone
- See Also:
Decorator.getKeyCommands()
-
myKeyEvent
Description copied from class:DecoratorThe response of this trait alone to the given KeyStroke- Specified by:
myKeyEventin classDecorator- Parameters:
stroke- Stroke to apply- Returns:
- Generated Command or null if no effect
- See Also:
Decorator.keyEvent(javax.swing.KeyStroke)
-
doIncrease
protected void doIncrease() -
doDecrease
protected void doDecrease() -
getCurrentImage
Deprecated, for removal: This API element is subject to removal in a future version.UseImageOp.getImage()instead. -
boundingBox
Description copied from interface:GamePieceThe area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBoxin interfaceGamePiece
-
getCurrentImageBounds
-
getShape
Return the Shape of the counter by adding the shape of this layer to the shape of all inner traits. Minimize generation of new Area objects. -
getDescription
Description copied from interface:EditablePieceA plain-English description of this type of piece- Specified by:
getDescriptionin interfaceEditablePiece
-
getProperty
- Specified by:
getPropertyin interfaceGamePiece- Specified by:
getPropertyin interfacePropertySource- Overrides:
getPropertyin classDecorator
-
getLocalizedProperty
- Specified by:
getLocalizedPropertyin interfacePropertySource- Overrides:
getLocalizedPropertyin classDecorator
-
strip
-
getCommonName
Get the name of this level (alone) -
getLocalizedCommonName
Get the localized name of this level (alone) -
getHelpFile
- Specified by:
getHelpFilein interfaceEditablePiece
-
getEditor
Description copied from interface:EditablePieceGet the configurer for this trait- Specified by:
getEditorin interfaceEditablePiece- Overrides:
getEditorin classDecorator
-
getVersion
public int getVersion() -
getLayerWithMatchingActivateCommand
public static Embellishment getLayerWithMatchingActivateCommand(GamePiece piece, KeyStroke stroke, boolean active)If the argument GamePiece contains a Layer whose "activate" command matches the given keystroke, and whose active status matches the boolean argument, return that Layer -
getLayerWithMatchingActivateCommand
public static Embellishment getLayerWithMatchingActivateCommand(GamePiece piece, NamedKeyStroke stroke, boolean active) -
getPropertyNames
Description copied from class:DecoratorDefault Property Name Source- Specified by:
getPropertyNamesin interfacePropertyNameSource- Overrides:
getPropertyNamesin classDecorator
-
getI18nData
Description copied from class:DecoratorReturn I18n data for this piece- Specified by:
getI18nDatain interfaceTranslatablePiece- Overrides:
getI18nDatain classDecorator- Returns:
- I18n data
-
ImageOp.getImage()instead.