|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--VASSAL.counters.Decorator
|
+--VASSAL.counters.UsePrototype
This trait is a placeholder for a pre-defined series of traits specified
in a PrototypeDefinition object. When a piece
that uses a prototype is defined in a module, it is simply assigned the name
of a particular prototype definition. When that piece is during a game,
the UsePrototype trait is substituted for the list of traits in the prototype
definition. From that point on, the piece has no record that those traits
were defined in a prototype instead of assigned to piece directly. This is
necessary so that subsequent changes to a prototype definition don't invalidate
games that were saved using previous versions of the module.
| Inner Class Summary | |
static class |
UsePrototype.Editor
|
| Field Summary | |
static java.lang.String |
ID
|
| Fields inherited from class VASSAL.counters.Decorator |
piece |
| Constructor Summary | |
UsePrototype()
|
|
UsePrototype(java.lang.String type,
GamePiece inner)
|
|
| Method Summary | |
java.awt.Rectangle |
boundingBox()
The area which this GamePiece occupies when drawn at the point (0,0) |
protected void |
buildPrototype()
|
void |
draw(java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
Draw this GamePiece |
java.lang.String |
getDescription()
A plain-English description of this type of piece |
PieceEditor |
getEditor()
Get the configurer for this trait |
GamePiece |
getExpandedInner()
Build a new GamePiece instance based on the traits in the referenced PrototypeDefinition. |
HelpFile |
getHelpFile()
|
protected KeyCommand[] |
getKeyCommands()
The set of key commands that will populate the piece's right-click menu. |
java.lang.String |
getName()
The plain English name for this piece |
java.lang.String |
getPrototypeName()
|
java.awt.Shape |
getShape()
The shape of the piece from the user's viewpoint. |
Command |
keyEvent(javax.swing.KeyStroke stroke)
Keyboard events are forward to this method when a piece is selected The GamePiece can respond in any way it likes |
protected KeyCommand[] |
myGetKeyCommands()
|
java.lang.String |
myGetState()
|
java.lang.String |
myGetType()
|
Command |
myKeyEvent(javax.swing.KeyStroke stroke)
The response of this trait alone to the given KeyStroke |
void |
mySetState(java.lang.String newState)
Set just the state of this trait |
void |
mySetType(java.lang.String type)
Set the type information for this piece. |
void |
setInner(GamePiece p)
Set the inner GamePiece |
| Methods inherited from class VASSAL.counters.Decorator |
getDecorator, getId, getInner, getInnermost, getMap, getOutermost, getParent, getPosition, getProperty, getState, getType, mergeState, setId, setMap, setParent, setPosition, setProperty, setState |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface VASSAL.counters.GamePiece |
getId, getMap, getParent, getPosition, getProperty, getState, getType, setId, setMap, setParent, setPosition, setProperty, setState |
| Field Detail |
public static final java.lang.String ID
| Constructor Detail |
public UsePrototype()
public UsePrototype(java.lang.String type,
GamePiece inner)
| Method Detail |
public java.lang.String getDescription()
EditablePiecegetDescription in interface EditablePiecepublic HelpFile getHelpFile()
getHelpFile in interface EditablePiecepublic void mySetType(java.lang.String type)
EditablePieceDecorator.myGetType()mySetType in interface EditablePieceprotected KeyCommand[] myGetKeyCommands()
myGetKeyCommands in class DecoratorVASSAL.counters.DecoratorDecorator.getKeyCommands()protected KeyCommand[] getKeyCommands()
DecoratorProperties.KEY_COMMANDS property.
The commands for a Decorator are a composite of Decorator.myGetKeyCommands() and the
commands of its inner piece.getKeyCommands in class DecoratorVASSAL.counters.Decoratorpublic void setInner(GamePiece p)
DecoratorsetInner in class Decoratorprotected void buildPrototype()
public GamePiece getExpandedInner()
PrototypeDefinition.
Substitute the new instance for Decorator.getInner() and return it.
If the referenced definition does not exist, return the default inner piece.public java.lang.String myGetState()
myGetState in class DecoratorVASSAL.counters.DecoratorDecorator.getState()public java.lang.String myGetType()
myGetType in class DecoratorVASSAL.counters.DecoratorDecorator.getType()public Command keyEvent(javax.swing.KeyStroke stroke)
GamePiecekeyEvent in interface GamePiecekeyEvent in class DecoratorVASSAL.counters.GamePieceCommand that, when executed, will invoke
the same response. Usually a ChangePiece command.ForwardToKeyBufferpublic Command myKeyEvent(javax.swing.KeyStroke stroke)
DecoratormyKeyEvent in class DecoratorVASSAL.counters.Decoratorstroke - Decorator.keyEvent(javax.swing.KeyStroke)public void mySetState(java.lang.String newState)
DecoratormySetState in class DecoratorVASSAL.counters.DecoratorDecorator.myGetState()public java.awt.Rectangle boundingBox()
GamePieceboundingBox in interface GamePiece
public void draw(java.awt.Graphics g,
int x,
int y,
java.awt.Component obs,
double zoom)
GamePiecedraw in interface GamePieceVASSAL.counters.GamePieceg - x - x-location of the center of the piecey - y-location of the center of the pieceobs - the Component on which this piece is being drawnzoom - the scaling factor.public java.lang.String getName()
GamePiecegetName in interface GamePiecepublic java.awt.Shape getShape()
GamePieceGamePiece.boundingBox(), it assumes the position is (0,0) and must be translated
to the actual location where the piece is being drawn.getShape in interface GamePiecepublic java.lang.String getPrototypeName()
public PieceEditor getEditor()
EditablePiecegetEditor in interface EditablePiecegetEditor in class Decorator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||