Package VASSAL.counters
Class DynamicProperty
java.lang.Object
VASSAL.counters.Decorator
VASSAL.counters.DynamicProperty
- All Implemented Interfaces:
IncrementProperty.Constraints
,PropertyChangerConfigurer.Constraints
,PropertyNameSource
,PropertyPrompt.Constraints
,PropertyPrompt.DialogParent
,PropertySource
,EditablePiece
,GamePiece
,PropertyExporter
,StateMergeable
,TranslatablePiece
,PersistentPropertyContainer
- Direct Known Subclasses:
SetGlobalProperty
public class DynamicProperty extends Decorator implements TranslatablePiece, PropertyPrompt.DialogParent, PropertyChangerConfigurer.Constraints
Trait that contains a property accessible via getProperty() and updateable
dynamically via key commands
- Author:
- rkinney
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DynamicProperty.DynamicKeyCommand
DynamicKeyCommand A class that represents an action to be performed on a Dynamic propertyprotected static class
DynamicProperty.DynamicKeyCommandConfigurer
Configure a single Dynamic Key Command lineprotected static class
DynamicProperty.Ed
-
Field Summary
Fields Modifier and Type Field Description protected FormattedString
format
static String
ID
protected String
key
protected ListConfigurer
keyCommandListConfig
protected DynamicProperty.DynamicKeyCommand[]
keyCommands
protected int
maxValue
protected KeyCommand[]
menuCommands
protected int
minValue
protected boolean
numeric
protected String
value
protected boolean
wrap
Fields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAME
Fields inherited from interface VASSAL.i18n.TranslatablePiece
PREFIX
-
Constructor Summary
Constructors Constructor Description DynamicProperty()
DynamicProperty(String type, GamePiece p)
-
Method Summary
Modifier and Type Method Description Rectangle
boundingBox()
The area which this GamePiece occupies when drawn at the point (0,0)protected void
decodeConstraints(String s)
void
draw(Graphics g, int x, int y, Component obs, double zoom)
Draw this GamePieceprotected String
encodeConstraints()
Component
getComponent()
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 pieceString
getKey()
Object
getLocalizedProperty(Object key)
int
getMaximumValue()
int
getMinimumValue()
String
getName()
The plain English name for this pieceObject
getProperty(Object key)
List<String>
getPropertyNames()
Return Property names exposed by this traitPropertySource
getPropertySource()
Shape
getShape()
The shape of the piece from the user's viewpoint.String
getValue()
boolean
isNumeric()
boolean
isWrap()
protected KeyCommand[]
myGetKeyCommands()
String
myGetState()
String
myGetType()
Command
myKeyEvent(KeyStroke stroke)
The response of this trait alone to the given KeyStrokevoid
mySetState(String state)
Set just the state of this traitvoid
mySetType(String s)
Set the type information for this piece.void
setProperty(Object key, Object value)
Other properties, possibly game-specific, can be associated with a piece.void
setValue(String value)
Methods inherited from class VASSAL.counters.Decorator
getCommandDescription, getDecorator, getI18nData, getI18nData, getId, getInner, getInnermost, getKeyCommands, getLocalizedName, 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, 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, getLocalizedName, getMap, getParent, getPosition, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setState
Methods inherited from interface VASSAL.counters.PropertyExporter
getProperties
-
Field Details
-
ID
- See Also:
- Constant Field Values
-
value
-
key
-
numeric
protected boolean numeric -
minValue
protected int minValue -
maxValue
protected int maxValue -
wrap
protected boolean wrap -
format
-
keyCommands
-
keyCommandListConfig
-
-
Constructor Details
-
DynamicProperty
public DynamicProperty() -
DynamicProperty
-
-
Method Details
-
mySetType
Description copied from interface:EditablePiece
Set the type information for this piece. SeeDecorator.myGetType()
- Specified by:
mySetType
in interfaceEditablePiece
-
decodeConstraints
-
encodeConstraints
-
draw
Description copied from interface:GamePiece
Draw this GamePiece -
getName
Description copied from interface:GamePiece
The plain English name for this piece -
boundingBox
Description copied from interface:GamePiece
The area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBox
in interfaceGamePiece
-
getShape
Description copied from interface:GamePiece
The shape of the piece from the user's viewpoint. This defines the area in which the user must click to select or move the piece, for example. LikeGamePiece.boundingBox()
, it assumes the position is (0,0) and must be translated to the actual location where the piece is being drawn. -
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
-
setProperty
Description copied from interface:GamePiece
Other properties, possibly game-specific, can be associated with a piece. The properties may or may not need to be encoded in the piece'sGamePiece.getState()
method.- Specified by:
setProperty
in interfaceGamePiece
- Overrides:
setProperty
in classDecorator
-
myGetState
- Specified by:
myGetState
in classDecorator
- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
getComponent
- Specified by:
getComponent
in interfacePropertyPrompt.DialogParent
-
mySetState
Description copied from class:Decorator
Set just the state of this trait- Specified by:
mySetState
in classDecorator
- See Also:
Decorator.myGetState()
-
getKey
-
getValue
-
setValue
-
myGetType
- Specified by:
myGetType
in classDecorator
- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
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)
-
getDescription
Description copied from interface:EditablePiece
A plain-English description of this type of piece- Specified by:
getDescription
in interfaceEditablePiece
-
getHelpFile
- Specified by:
getHelpFile
in interfaceEditablePiece
-
getMaximumValue
public int getMaximumValue()- Specified by:
getMaximumValue
in interfaceIncrementProperty.Constraints
- Specified by:
getMaximumValue
in interfacePropertyPrompt.Constraints
-
getMinimumValue
public int getMinimumValue()- Specified by:
getMinimumValue
in interfaceIncrementProperty.Constraints
- Specified by:
getMinimumValue
in interfacePropertyPrompt.Constraints
-
isNumeric
public boolean isNumeric()- Specified by:
isNumeric
in interfacePropertyPrompt.Constraints
-
isWrap
public boolean isWrap()- Specified by:
isWrap
in interfaceIncrementProperty.Constraints
-
getPropertyNames
Return Property names exposed by this trait- Specified by:
getPropertyNames
in interfacePropertyNameSource
- Overrides:
getPropertyNames
in classDecorator
-
getPropertySource
- Specified by:
getPropertySource
in interfaceIncrementProperty.Constraints
- Specified by:
getPropertySource
in interfacePropertyPrompt.Constraints
-
getEditor
Description copied from interface:EditablePiece
Get the configurer for this trait- Specified by:
getEditor
in interfaceEditablePiece
- Overrides:
getEditor
in classDecorator
-
getI18nData
Description copied from class:Decorator
Return I18n data for this piece- Specified by:
getI18nData
in interfaceTranslatablePiece
- Overrides:
getI18nData
in classDecorator
- Returns:
- I18n data
-