Package VASSAL.build.module.turn
Class TurnTracker
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.turn.TurnComponent
VASSAL.build.module.turn.TurnTracker
- All Implemented Interfaces:
ActionListener,EventListener,AutoConfigurable,Buildable,Configurable,GameComponent,PropertyNameSource,CommandEncoder,ValidityChecker,Translatable,ImageSearchTarget,SearchTarget,RecursionLimiter.Loopable,UniqueIdManager.Identifyable
public class TurnTracker
extends TurnComponent
implements CommandEncoder, GameComponent, ActionListener, UniqueIdManager.Identifyable, RecursionLimiter.Loopable
Generic Turn Counter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classprotected classstatic classstatic classprotected classprotected classNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringprotected static Stringprotected intprotected static Stringprotected static Stringprotected static Stringprotected static Stringstatic Stringstatic Stringprotected Stringprotected static UniqueIdManagerprotected MutableProperty.Implprotected MutableProperty.Implprotected LaunchButtonprotected JPanelstatic Stringprotected static Stringprotected static Stringstatic Stringprotected static Stringprotected Stringprotected static Stringstatic Stringprotected static Stringprotected static Stringstatic Stringprotected NamedKeyStrokeListenerprotected static StringVariable name for reporting formatprotected JPopupMenuprotected static Stringstatic Stringprotected NamedKeyStrokeListenerprotected static Stringprotected static Stringstatic Stringprotected FormattedStringprotected Stringprotected Stringprotected Stringprotected static Stringprotected static Stringprotected TurnTracker.SetDialogstatic Stringprotected static Stringstatic Stringprotected FormattedStringprotected TurnTracker.TurnWidgetprotected TurnTracker.TurnWindowprotected static Stringprotected intFields inherited from class VASSAL.build.module.turn.TurnComponent
levelsFields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameFields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validatorFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidvoidClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.voidAdds this component to its parent.protected voidprotected voidprotected voidprotected voidTranslate a String into aCommandprotected voidTranslate aCommandinto a StringA list of all active TurnLevels within the TurnTrackerClass<?>[]String[]Return an array of Strings describing the attributes of this object.String[]Lists all the buildFile (XML) attribute names for this component.Class<?>[]Return the Class for the attributes of this object.Called by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML elementgetAttributeVisibility(String name)By default, all attributes are visiblestatic Stringprotected Fontprotected intprotected intgetId()protected intprotected StringCalculate the maximum sized turn string that can be generated by any turn combination.protected intCalculate the maximum width for the turnWidget to display any item.When saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullgetState()protected StringBuild the turn string to be displayed from the currently active Child TurnLevel'sprotected booleanisDocked()protected voidnext()protected voidprev()voidremoveFrom(Buildable b)Remove this component from its parentvoidreplace(StringBuffer s, String from, String to)Deprecated, for removal: This API element is subject to removal in a future version.voidreplace(StringBuilder s, String from, String to)protected voidreset()protected voidsave()protected voidsaveSet()protected voidset()voidsetAttribute(String key, Object value)Sets a buildFile (XML) attribute value for this component.protected voidprotected voidsetDocked(boolean dock)protected voidvoidprotected voidvoidvoidsetup(boolean gameStarting)Notify the GameComponent that a game has started/endedprotected voidupdateString(String str, String[] from, String[] to)protected voidupdateTurnDisplay(String command)Methods inherited from class VASSAL.build.module.turn.TurnComponent
addLevel, getTurnLevel, getTurnLevelCount, getTurnLevels, removeLevelMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, getExpressionList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getPropertyList, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, validateMethods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface VASSAL.build.Buildable
build, getBuildElementMethods inherited from interface VASSAL.tools.UniqueIdManager.Identifyable
getConfigureName
-
Field Details
-
idMgr
-
COMMAND_PREFIX
- See Also:
- Constant Field Values
-
NAME
- See Also:
- Constant Field Values
-
HOT_KEY
- See Also:
- Constant Field Values
-
NEXT_HOT_KEY
- See Also:
- Constant Field Values
-
PREV_HOT_KEY
- See Also:
- Constant Field Values
-
ICON
- See Also:
- Constant Field Values
-
BUTTON_TEXT
- See Also:
- Constant Field Values
-
BUTTON_TOOLTIP
- See Also:
- Constant Field Values
-
TURN_FORMAT
- See Also:
- Constant Field Values
-
REPORT_FORMAT
- See Also:
- Constant Field Values
-
TOOLTIP
- See Also:
- Constant Field Values
-
LENGTH
- See Also:
- Constant Field Values
-
LENGTH_STYLE
- See Also:
- Constant Field Values
-
FONT_SIZE
- See Also:
- Constant Field Values
-
FONT_BOLD
- See Also:
- Constant Field Values
-
DOCKED
- See Also:
- Constant Field Values
-
OLD_TURN
Variable name for reporting format- See Also:
- Constant Field Values
-
NEW_TURN
- See Also:
- Constant Field Values
-
LEVEL
- See Also:
- Constant Field Values
-
TURN_FONT
- See Also:
- Constant Field Values
-
SET_COMMAND
-
DOCK_COMMAND
-
UNDOCK_COMMAND
-
NEXT
- See Also:
- Constant Field Values
-
PREV
- See Also:
- Constant Field Values
-
SET
- See Also:
- Constant Field Values
-
PROP_VALUE
- See Also:
- Constant Field Values
-
PROP_COMMAND
- See Also:
- Constant Field Values
-
LENGTH_VARIABLE
- See Also:
- Constant Field Values
-
LENGTH_MAXIMUM
- See Also:
- Constant Field Values
-
LENGTH_FIXED
- See Also:
- Constant Field Values
-
turnFormat
-
reportFormat
-
turnWindow
-
turnWidget
-
launchWidget
-
setDialog
-
launch
-
nextListener
-
prevListener
-
savedState
-
savedSetState
-
savedTurn
-
popup
-
currentLevel
protected int currentLevel -
id
-
width
protected int width -
lengthStyle
-
lastCommand
-
lastTurn
-
-
Constructor Details
-
TurnTracker
public TurnTracker()
-
-
Method Details
-
getState
-
setState
-
setLaunchToolTip
protected void setLaunchToolTip() -
getAttributeNames
Description copied from class:AbstractBuildableLists all the buildFile (XML) attribute names for this component. If this component is ALSO anAbstractConfigurable, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()andAbstractConfigurable.getAttributeTypes().- Specified by:
getAttributeNamesin interfaceAutoConfigurable- Overrides:
getAttributeNamesin classTurnComponent- Returns:
- a list of all buildFile (XML) attribute names for this component
-
setAttribute
Description copied from class:AbstractBuildableSets a buildFile (XML) attribute value for this component. Thekeyparameter will be one of those listed inAbstractBuildable.getAttributeNames(). If thevalueparameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluewill be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()- Specified by:
setAttributein interfaceAutoConfigurable- Specified by:
setAttributein interfaceTranslatable- Overrides:
setAttributein classTurnComponent- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()value- If thevalueparameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
setWidgetWidth
protected void setWidgetWidth() -
getMaximumWidth
protected int getMaximumWidth()Calculate the maximum width for the turnWidget to display any item. First calculate the maximum string that can be displayed, then convert this to a width based on the display font.- Returns:
- Maximum Width
-
setDisplayFont
protected void setDisplayFont() -
getDisplayFont
-
setFontSize
protected void setFontSize() -
getFontSize
protected int getFontSize() -
getFontStyle
protected int getFontStyle() -
isDocked
protected boolean isDocked() -
setDocked
protected void setDocked(boolean dock) -
getAttributeValueString
Description copied from interface:AutoConfigurableCalled by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML element- Specified by:
getAttributeValueStringin interfaceAutoConfigurable- Specified by:
getAttributeValueStringin interfaceTranslatable- Overrides:
getAttributeValueStringin classTurnComponent- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()- Returns:
- a String representation of the XML buildFile attribute with the given name. When initializing a module,
this String value will loaded from the XML and passed to
AbstractBuildable.setAttribute(java.lang.String, java.lang.Object). It is also frequently used for checking the current value of an attribute.
-
getAttributeDescriptions
Description copied from interface:AutoConfigurableReturn an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object.- Specified by:
getAttributeDescriptionsin interfaceAutoConfigurable- Overrides:
getAttributeDescriptionsin classTurnComponent- Returns:
- an array of Strings describing the buildFile (XML) attributes of this component. These strings are used as prompts in the
Properties window for this object, when the component is configured in the Editor. The order of descriptions should
be the same as the order of names in
AbstractBuildable.getAttributeNames()
-
getAttributeTypes
Description copied from interface:AutoConfigurableReturn the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, File, Color, and KeyStroke- Specified by:
getAttributeTypesin interfaceAutoConfigurable- Overrides:
getAttributeTypesin classTurnComponent- Returns:
- the Class for the buildFile (XML) attributes of this component. Valid classes include: String, Integer, Double, Boolean, Image,
Color, and KeyStroke, along with any class for which a Configurer exists in VASSAL.configure. The class determines, among other things,
which type of
AutoConfigurerwill be used to configure the attribute when the object is configured in the Editor. The order of classes should be the same as the order of names inAbstractBuildable.getAttributeNames()
-
getAttributeVisibility
Description copied from class:AbstractConfigurableBy default, all attributes are visible- Specified by:
getAttributeVisibilityin interfaceAutoConfigurable- Overrides:
getAttributeVisibilityin classAbstractConfigurable- Parameters:
name- Name (key) of one of this component's attributes- Returns:
- a
VisibilityConditionfor this attribute, or null if attribute should always be visible.
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable- Overrides:
getAllowableConfigureComponentsin classTurnComponent- Returns:
- a list of valid sub-component Classes. If a Class
appears in this list, then instances of that class may be added
to this component from the Editor's
ConfigureTreewindow by right-clicking on the component and selecting the appropriate "Add" option.
-
getConfigureTypeName
-
addTo
Description copied from interface:BuildableAdds this component to its parent. In order to make Buildable objects extensible, the child is responsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.- Specified by:
addToin interfaceBuildable- Overrides:
addToin classTurnComponent- Parameters:
b- parent Buildable to add this component to as a subcomponent.
-
removeFrom
Description copied from interface:ConfigurableRemove this component from its parent- Specified by:
removeFromin interfaceConfigurable- Overrides:
removeFromin classTurnComponent
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Overrides:
getHelpFilein classTurnComponent- Returns:
- a HelpFile describing how to use and configure * this component
-
setId
- Specified by:
setIdin interfaceUniqueIdManager.Identifyable
-
getId
- Specified by:
getIdin interfaceUniqueIdManager.Identifyable
-
captureState
protected void captureState() -
save
protected void save() -
getMaximumTurnString
Calculate the maximum sized turn string that can be generated by any turn combination.- Returns:
- maximum turn string
-
getTurnString
Build the turn string to be displayed from the currently active Child TurnLevel's- Returns:
- Turn String
-
getActiveChildLevels
A list of all active TurnLevels within the TurnTracker- Returns:
- List of Turn levels
-
getLevelCount
protected int getLevelCount() -
next
protected void next() -
prev
protected void prev() -
doGlobalkeys
protected void doGlobalkeys() -
getComponentTypeName
- Specified by:
getComponentTypeNamein interfaceRecursionLimiter.Loopable
-
getComponentName
- Specified by:
getComponentNamein interfaceRecursionLimiter.Loopable
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
set
protected void set() -
updateTurnDisplay
-
clearGlobalProperties
protected void clearGlobalProperties() -
decode
Description copied from interface:CommandEncoderTranslate a String into aCommand- Specified by:
decodein interfaceCommandEncoder
-
encode
Description copied from interface:CommandEncoderTranslate aCommandinto a String- Specified by:
encodein interfaceCommandEncoder
-
setup
public void setup(boolean gameStarting)Description copied from interface:GameComponentNotify the GameComponent that a game has started/ended- Specified by:
setupin interfaceGameComponent- Parameters:
gameStarting- if true, a game is starting. If false, then a game is ending
-
reset
protected void reset() -
updateString
-
replace
-
replace
@Deprecated(since="2020-08-06", forRemoval=true) public void replace(StringBuffer s, String from, String to)Deprecated, for removal: This API element is subject to removal in a future version.Usereplace(StringBuilder,String,String)instead. -
getRestoreCommand
Description copied from interface:GameComponentWhen saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommandin interfaceGameComponent
-
buildPopup
protected void buildPopup() -
addItem
-
cancelSet
protected void cancelSet() -
saveSet
protected void saveSet() -
getFormattedStringList
- Specified by:
getFormattedStringListin interfaceSearchTarget- Overrides:
getFormattedStringListin classAbstractConfigurable- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
getMenuTextList
- Specified by:
getMenuTextListin interfaceSearchTarget- Overrides:
getMenuTextListin classAbstractConfigurable- Returns:
- a list of any Menu/Button/Tooltip Text strings referenced in the Configurable, if any (for search)
-
getNamedKeyStrokeList
- Specified by:
getNamedKeyStrokeListin interfaceSearchTarget- Overrides:
getNamedKeyStrokeListin classAbstractConfigurable- Returns:
- a list of any Named KeyStrokes referenced in the Configurable, if any (for search)
-
addLocalImageNames
Description copied from class:AbstractImageFinderClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.- Specified by:
addLocalImageNamesin interfaceImageSearchTarget- Overrides:
addLocalImageNamesin classAbstractImageFinder- Parameters:
s- Collection to add image names to
-
replace(StringBuilder,String,String)instead.