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_NAME
Fields 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 Rectangle
boundingBox()
The area which this GamePiece occupies when drawn at the point (0,0)protected void
checkPropertyLevel()
void
draw(Graphics g, int x, int y, Component obs, double zoom)
Draw this GamePieceprotected String
getCommonName(boolean localized, int i)
Get the name of this level (alone)protected Image
getCurrentImage()
Deprecated, for removal: This API element is subject to removal in a future version.Rectangle
getCurrentImageBounds()
String
getDescription()
A plain-English description of this type of piecePieceEditor
getEditor()
Get the configurer for this traitHelpFile
getHelpFile()
PieceI18nData
getI18nData()
Return I18n data for this piecestatic 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 Layerprotected String
getLocalizedCommonName(int i)
Get the localized name of this level (alone)String
getLocalizedName()
Return the translated name for this piece.Object
getLocalizedProperty(Object key)
String
getName()
The plain English name for this pieceString
getName(boolean localized)
Object
getProperty(Object key)
Shape
getShape()
Return the Shape of the counter by adding the shape of this layer to the shape of all inner traits.int
getValue()
boolean
isActive()
KeyCommand[]
myGetKeyCommands()
String
myGetState()
String
myGetType()
Command
myKeyEvent(KeyStroke stroke)
The response of this trait alone to the given KeyStrokevoid
mySetState(String s)
Set just the state of this traitvoid
mySetType(String s)
Set the type information for this piece.String
oldGetType()
Deprecated, for removal: This API element is subject to removal in a future version.No Replacementvoid
setActive(boolean val)
void
setValue(int val)
Set the current level - First level = 0 Does not change the active statusprotected String
strip(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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface VASSAL.counters.GamePiece
getId, getMap, getParent, getPosition, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setProperty, setState
Methods 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:EditablePiece
Set the type information for this piece. SeeDecorator.myGetType()
- Specified by:
mySetType
in interfaceEditablePiece
-
getLocalizedName
Description copied from class:Decorator
Return the translated name for this piece. Most pieces do not have translatable elements, so just return the standard name- Specified by:
getLocalizedName
in interfaceGamePiece
- Overrides:
getLocalizedName
in classDecorator
-
getName
Description copied from interface:GamePiece
The plain English name for this piece -
getName
-
mySetState
Description copied from class:Decorator
Set just the state of this trait- Specified by:
mySetState
in classDecorator
- See Also:
Decorator.myGetState()
-
myGetType
- Specified by:
myGetType
in 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:
myGetState
in classDecorator
- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
draw
Description copied from interface:GamePiece
Draw this GamePiece -
checkPropertyLevel
protected void checkPropertyLevel() -
myGetKeyCommands
- Specified by:
myGetKeyCommands
in classDecorator
- Returns:
- the commands for this trait alone
- See Also:
Decorator.getKeyCommands()
-
myKeyEvent
Description copied from class:Decorator
The response of this trait alone to the given KeyStroke- Specified by:
myKeyEvent
in 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:GamePiece
The area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBox
in 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:EditablePiece
A plain-English description of this type of piece- Specified by:
getDescription
in interfaceEditablePiece
-
getProperty
- Specified by:
getProperty
in interfaceGamePiece
- Specified by:
getProperty
in interfacePropertySource
- Overrides:
getProperty
in classDecorator
-
getLocalizedProperty
- Specified by:
getLocalizedProperty
in interfacePropertySource
- Overrides:
getLocalizedProperty
in classDecorator
-
strip
-
getCommonName
Get the name of this level (alone) -
getLocalizedCommonName
Get the localized name of this level (alone) -
getHelpFile
- Specified by:
getHelpFile
in interfaceEditablePiece
-
getEditor
Description copied from interface:EditablePiece
Get the configurer for this trait- Specified by:
getEditor
in interfaceEditablePiece
- Overrides:
getEditor
in 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:Decorator
Return I18n data for this piece- Specified by:
getI18nData
in interfaceTranslatablePiece
- Overrides:
getI18nData
in classDecorator
- Returns:
- I18n data
-
ImageOp.getImage()
instead.