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 classDynamicProperty.DynamicKeyCommandDynamicKeyCommand A class that represents an action to be performed on a Dynamic propertyprotected static classDynamicProperty.DynamicKeyCommandConfigurerConfigure a single Dynamic Key Command lineprotected static classDynamicProperty.Ed -
Field Summary
Fields Modifier and Type Field Description protected FormattedStringformatstatic StringIDprotected Stringkeyprotected ListConfigurerkeyCommandListConfigprotected DynamicProperty.DynamicKeyCommand[]keyCommandsprotected intmaxValueprotected KeyCommand[]menuCommandsprotected intminValueprotected booleannumericprotected Stringvalueprotected booleanwrapFields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAMEFields 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 RectangleboundingBox()The area which this GamePiece occupies when drawn at the point (0,0)protected voiddecodeConstraints(String s)voiddraw(Graphics g, int x, int y, Component obs, double zoom)Draw this GamePieceprotected StringencodeConstraints()ComponentgetComponent()StringgetDescription()A plain-English description of this type of piecePieceEditorgetEditor()Get the configurer for this traitHelpFilegetHelpFile()PieceI18nDatagetI18nData()Return I18n data for this pieceStringgetKey()ObjectgetLocalizedProperty(Object key)intgetMaximumValue()intgetMinimumValue()StringgetName()The plain English name for this pieceObjectgetProperty(Object key)List<String>getPropertyNames()Return Property names exposed by this traitPropertySourcegetPropertySource()ShapegetShape()The shape of the piece from the user's viewpoint.StringgetValue()booleanisNumeric()booleanisWrap()protected KeyCommand[]myGetKeyCommands()StringmyGetState()StringmyGetType()CommandmyKeyEvent(KeyStroke stroke)The response of this trait alone to the given KeyStrokevoidmySetState(String state)Set just the state of this traitvoidmySetType(String s)Set the type information for this piece.voidsetProperty(Object key, Object value)Other properties, possibly game-specific, can be associated with a piece.voidsetValue(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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface VASSAL.counters.GamePiece
getId, getLocalizedName, getMap, getParent, getPosition, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setStateMethods 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:EditablePieceSet the type information for this piece. SeeDecorator.myGetType()- Specified by:
mySetTypein interfaceEditablePiece
-
decodeConstraints
-
encodeConstraints
-
draw
Description copied from interface:GamePieceDraw this GamePiece -
getName
Description copied from interface:GamePieceThe plain English name for this piece -
boundingBox
Description copied from interface:GamePieceThe area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBoxin interfaceGamePiece
-
getShape
Description copied from interface:GamePieceThe 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:
getPropertyin interfaceGamePiece- Specified by:
getPropertyin interfacePropertySource- Overrides:
getPropertyin classDecorator
-
getLocalizedProperty
- Specified by:
getLocalizedPropertyin interfacePropertySource- Overrides:
getLocalizedPropertyin classDecorator
-
setProperty
Description copied from interface:GamePieceOther 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:
setPropertyin interfaceGamePiece- Overrides:
setPropertyin classDecorator
-
myGetState
- Specified by:
myGetStatein classDecorator- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
getComponent
- Specified by:
getComponentin interfacePropertyPrompt.DialogParent
-
mySetState
Description copied from class:DecoratorSet just the state of this trait- Specified by:
mySetStatein classDecorator- See Also:
Decorator.myGetState()
-
getKey
-
getValue
-
setValue
-
myGetType
- Specified by:
myGetTypein classDecorator- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
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)
-
getDescription
Description copied from interface:EditablePieceA plain-English description of this type of piece- Specified by:
getDescriptionin interfaceEditablePiece
-
getHelpFile
- Specified by:
getHelpFilein interfaceEditablePiece
-
getMaximumValue
public int getMaximumValue()- Specified by:
getMaximumValuein interfaceIncrementProperty.Constraints- Specified by:
getMaximumValuein interfacePropertyPrompt.Constraints
-
getMinimumValue
public int getMinimumValue()- Specified by:
getMinimumValuein interfaceIncrementProperty.Constraints- Specified by:
getMinimumValuein interfacePropertyPrompt.Constraints
-
isNumeric
public boolean isNumeric()- Specified by:
isNumericin interfacePropertyPrompt.Constraints
-
isWrap
public boolean isWrap()- Specified by:
isWrapin interfaceIncrementProperty.Constraints
-
getPropertyNames
Return Property names exposed by this trait- Specified by:
getPropertyNamesin interfacePropertyNameSource- Overrides:
getPropertyNamesin classDecorator
-
getPropertySource
- Specified by:
getPropertySourcein interfaceIncrementProperty.Constraints- Specified by:
getPropertySourcein interfacePropertyPrompt.Constraints
-
getEditor
Description copied from interface:EditablePieceGet the configurer for this trait- Specified by:
getEditorin interfaceEditablePiece- Overrides:
getEditorin classDecorator
-
getI18nData
Description copied from class:DecoratorReturn I18n data for this piece- Specified by:
getI18nDatain interfaceTranslatablePiece- Overrides:
getI18nDatain classDecorator- Returns:
- I18n data
-