Class Decorator

java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.counters.Decorator
All Implemented Interfaces:
PropertyNameSource, PropertySource, EditablePiece, GamePiece, PropertyExporter, StateMergeable, PersistentPropertyContainer, Auditable, ImageSearchTarget, SearchTarget
Direct Known Subclasses:
ActionButton, AreaOfEffect, Attachment, BasicName, BorderOutline, CalculatedProperty, Clone, Comment, CounterGlobalKeyCommand, Delete, Deselect, DynamicProperty, Embellishment, Embellishment0, FreeRotator, GlobalHotKey, Hideable, Immobilized, Labeler, Marker, Mat, MatCargo, MenuSeparator, MovementMarkable, MultiLocationCommand, NonRectangular, Obscurable, Pivot, PlaceMarker, PlaySound, PropertySheet, ReportState, RestrictCommands, Restricted, ReturnToDeck, SendToLocation, SubMenu, TableInfo, TranslatableMessage, Translate, TriggerAction, UsePrototype

The abstract class describing a generic 'Trait' of a full GamePiece. Follows the Decorator design pattern of wrapping around another instance of GamePiece (the 'inner' piece) and delegating some of the GamePiece methods to it. The "innermost" piece of a Trait/Decorator stack will be a BasicPiece -- but note that although BasicPiece does implement GamePiece, it is NOT a Decorator like traits are, and must be handled differently. Since Traits (Decorators) implement the GamePiece interface, they are "given a look at" any method call to GamePiece, and may act on it and/or pass it "inward" toward the next Decorator in the stack, eventually arriving at the BasicPiece. This is the reason for the VASSAL situation wherein only traits lower (more outward) in the list of traits are able to affect/control/hide/restrict/etc traits that are higher (more inward, nearer the BasicPiece) in the list -- because the outer traits receive the GamePiece method calls first, and thus have the opportunity to intercept or modify them if appropriate before passing them inward. So a full logical GamePiece (the thing you see on the board), may consist of many Decorator instances (one for each trait) wrapped around the BasicPiece.