Package VASSAL.counters
Class Embellishment0
java.lang.Object
VASSAL.counters.Decorator
VASSAL.counters.Embellishment0
- All Implemented Interfaces:
PropertyNameSource,PropertySource,EditablePiece,GamePiece,PropertyExporter,StateMergeable,TranslatablePiece,PersistentPropertyContainer
public class Embellishment0 extends Decorator implements TranslatablePiece
Embellishment has been extensively re-written for Vassal 3.2 changing
both the behavior and the visual look of the configurer. A version
number has been added to distinguish between the two versions.
Note, there is also a much older Embellishment trait with a type of emb
When editing a module, the old versions will be automatically converted to
the new version. One feature (multiple keystrokes for a command) cannot
be converted.
This class contains the complete code of the original version 0
emb2 Embellishment to support editing of unconverted version 0 Embellishments
and run-time support for modules containing unconverted traits.
This is essentially the latest 3.1 version of Embellishment
-
Field Summary
Fields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAMEFields inherited from interface VASSAL.i18n.TranslatablePiece
PREFIX -
Constructor Summary
Constructors Constructor Description Embellishment0()Embellishment0(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)protected voidcheckPropertyLevel()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 piecestatic 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 Layerprotected 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)ShapegetShape()Return the Shape of the counter by adding the shape of this layer to the shape of all inner traits.intgetValue()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 val)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, getPropertyNames, 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
-
firstLevelValue
protected int firstLevelValue -
rndKey
-
value
protected int value -
activationStatus
-
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
-
-
Constructor Details
-
Embellishment0
public Embellishment0() -
Embellishment0
-
-
Method Details
-
isActive
public boolean isActive() -
setActive
public void setActive(boolean val) -
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
-
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
-
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)
-
getCurrentImage
@Deprecated(since="2020-08-06", forRemoval=true) protected Image getCurrentImage() throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.UseImageOp.getImage()instead.- Throws:
IOException
-
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
-
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 -
getI18nData
Description copied from class:DecoratorReturn I18n data for this piece- Specified by:
getI18nDatain interfaceTranslatablePiece- Overrides:
getI18nDatain classDecorator- Returns:
- I18n data
-
ImageOp.getImage()instead.