Class PlayerRoster
- All Implemented Interfaces:
PropertyChangeListener,EventListener,AutoConfigurable,Buildable,Configurable,GameComponent,GameSetupStep,PropertyNameSource,CommandEncoder,ComponentDescription,ValidityChecker,Translatable,Auditable,ImageSearchTarget,SearchTarget
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic interfaceCall-back interface for when a player changes sides during a gameNested classes/interfaces inherited from class VASSAL.build.AbstractToolbarItem
AbstractToolbarItem.FormattedStringConfig, AbstractToolbarItem.IconConfigNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Stringstatic final Stringstatic final Stringstatic final Stringprotected List<PlayerRoster.PlayerInfo>static final Stringstatic final Stringprotected LaunchButtonDeprecated, for removal: This API element is subject to removal in a future version.use launch from the superclassprotected List<PlayerRoster.SideChangeListener>protected StringEnumConfigurerstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Stringprotected String[]Fields inherited from class VASSAL.build.AbstractToolbarItem
CAN_DISABLE, canDisable, DISABLED_ICON, disabledIconConfig, HIDE_WHEN_DISABLED, hideWhenDisabled, HOTKEY, ICON, launch, NAME, property, PROPERTY_GATE, propertyGate, showDisabledOptions, TOOLTIPFields 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 TypeMethodDescriptionvoidAdds a player to the list of active players occupying sidesvoidSet the owning translatable of this componentvoidAdd a PropertyChangeListener.voidvoidDefault behavior adds the button to the parent componentprotected booleanvoidBuild this component by getting all XML attributes of the XML element and callingAbstractBuildable.setAttribute(java.lang.String, java.lang.Object)with the String value of the attributeprotected voidClaims the appropriate occupied side, if any, for the current player.protected voidclaimSlot(int index) Claims an existing slot for the current player, and sets our temporary user id appropriatelyTranslate a String into aCommandTranslate aCommandinto a Stringvoidfinish()finish() step for Wizardprotected voidfireSideChange(String oldSide, String newSide) Class<?>[]String[]This getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.String[]This getAttributeNames() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.Class<?>[]This getAttributeTypes() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.getBuildElement(Document doc) ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.static StringA GUI component that prompts the player for the needed information.protected static PlayerRosterDeprecated, for removal: This API element is subject to removal in a future version.static StringReturn my Translated Sidestatic StringReturn my Untranslatted sideprotected static StringgetMySide(boolean localized) 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 nullgetSides()protected StringA human-understandable description of this stepString[]static booleanisActive()booleanImplement GameSetupStep for WizardbooleanIs this component a reqired component within its parent?booleanstatic booleanisSoloSide(String side) static booleanisTranslatedSoloSide(String side) booleanisUnique()Does this component need to be unique within it's parent?protected voidlaunch()Called when the Launch Button for the player roster is clicked (i.e.protected Stringprotected StringpromptForSide(String newSide) voidRemove a player from the list of active players occupying sidesvoidRemove a Buildable object from this objectvoidremoveFrom(Buildable parent) Remove from our parentvoidvoidsetAttribute(String key, Object value) Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.voidsetController(org.netbeans.spi.wizard.WizardController wc) Tells the step who its wizard controller isvoidsetForcePwd(boolean forcePwd) protected voidsetSidesFromString(String newSides) Set a new set of side names from a translation DO NOT apply if the number of sides does not match the number of currently defined sides as there is no way to tell which translation applies to which existing sidevoidsetup(boolean gameStarting) Notify the GameComponent that a game has started/endedtranslateSide(String side) untranslateSide(String side) voidMethods inherited from class VASSAL.build.AbstractToolbarItem
addLocalImageNames, addPropertyGateListener, addPropertyGateListener, checkDisabled, disableIfTrue, getAttributeVisibility, getComponent, getLaunchButton, getMenuTextList, getNamedKeyStrokeList, getNameKey, isShowDisabledOptions, makeLaunchButton, propertyChange, removePropertyGateListener, setButtonTextKey, setHotKeyKey, setIconKey, setLaunchButton, setNameKey, setNamePrompt, setShowDisabledOptions, setTooltipKeyMethods inherited from class VASSAL.build.AbstractConfigurable
getConfigurer, getExpressionList, getFormattedStringList, getI18nPrefix, getLocalizedConfigureName, getTypeName, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, 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.script.expression.Auditable
getComponentName, getComponentTypeName
-
Field Details
-
DESCRIPTION
- See Also:
-
BUTTON_ICON
- See Also:
-
BUTTON_TEXT
- See Also:
-
TOOL_TIP
- See Also:
-
BUTTON_KEYSTROKE
- See Also:
-
SIDES
- See Also:
-
COMMAND_PREFIX
- See Also:
-
REMOVE_PREFIX
- See Also:
-
OBSERVER
- See Also:
-
SOLITAIRE
- See Also:
-
REFEREE
- See Also:
-
SOLO
- See Also:
-
MODERATOR
- See Also:
-
players
-
sides
-
untranslatedSides
-
retireButton
Deprecated, for removal: This API element is subject to removal in a future version.use launch from the superclass -
sideChangeListeners
-
translatedObserver
-
description
-
sideConfig
-
-
Constructor Details
-
PlayerRoster
public PlayerRoster()
-
-
Method Details
-
removeFrom
Description copied from class:AbstractToolbarItemRemove from our parent- Specified by:
removeFromin interfaceConfigurable- Overrides:
removeFromin classAbstractToolbarItem- Parameters:
parent- parent
-
remove
Description copied from class:AbstractConfigurableRemove a Buildable object from this object- Specified by:
removein interfaceConfigurable- Overrides:
removein classAbstractConfigurable
-
build
Description copied from class:AbstractBuildableBuild this component by getting all XML attributes of the XML element and callingAbstractBuildable.setAttribute(java.lang.String, java.lang.Object)with the String value of the attribute- Specified by:
buildin interfaceBuildable- Overrides:
buildin classAbstractBuildable- Parameters:
e- the XML element containing the object data
-
getConfigureName
Description copied from class:AbstractConfigurableConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.- Specified by:
getConfigureNamein interfaceConfigurable- Overrides:
getConfigureNamein classAbstractConfigurable- Returns:
- The language-independent name of this component used for programmatic identification (including within Modules by e.g. Traits and module components)
-
getConfigureTypeName
-
add
Description copied from class:AbstractConfigurableSet the owning translatable of this component- Specified by:
addin interfaceBuildable- Overrides:
addin classAbstractConfigurable- Parameters:
child- Child to attach to this buildable as a subcomponent
-
getConfigureComponents
- Specified by:
getConfigureComponentsin interfaceConfigurable- Overrides:
getConfigureComponentsin classAbstractConfigurable- Returns:
- A list of all child components (i.e. subcomponents) of this component that are configurable.
-
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Overrides:
getBuildElementin classAbstractBuildable- Parameters:
doc- XML file- Returns:
- an XML element from which this component can be built
-
addPropertyChangeListener
Description copied from interface:ConfigurableAdd a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTYwhen the value returned fromConfigurable.getConfigureName()has changed- Specified by:
addPropertyChangeListenerin interfaceConfigurable- Overrides:
addPropertyChangeListenerin classAbstractConfigurable
-
addSideChangeListenerToInstance
-
removeSideChangeListenerFromInstance
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- a HelpFile describing how to use and configure * this component
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable- 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.
-
addTo
Description copied from class:AbstractToolbarItemDefault behavior adds the button to the parent component- Specified by:
addToin interfaceBuildable- Overrides:
addToin classAbstractToolbarItem- Parameters:
b- parent Buildable to add this component to as a subcomponent.
-
launch
protected void launch()Called when the Launch Button for the player roster is clicked (i.e. the "Retire" or "Change Sides" button) -
fireSideChange
-
isActive
public static boolean isActive() -
getInstance
Deprecated, for removal: This API element is subject to removal in a future version. -
getMySide
Return my Untranslatted side -
getMyLocalizedSide
Return my Translated Side -
getCurrentPasswords
- Returns:
- List of currently matchable passwords, including "defaults" of various types.
-
getMySide
-
getPlayers
-
getSides
-
getUntranslatedSideList
-
getUntranslatedSides
-
add
Adds a player to the list of active players occupying sides- Parameters:
playerId- player unique id (password)playerName- player nameside- player side
-
remove
Remove a player from the list of active players occupying sides- Parameters:
playerId- player unique id (password)
-
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
-
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- Overrides:
getRestoreCommandin classAbstractToolbarItem
-
setup
public void setup(boolean gameStarting) Description copied from interface:GameComponentNotify the GameComponent that a game has started/ended- Specified by:
setupin interfaceGameComponent- Overrides:
setupin classAbstractToolbarItem- Parameters:
gameStarting- if true, a game is starting. If false, then a game is ending
-
finish
public void finish()finish() step for Wizard- Specified by:
finishin interfaceGameSetupStep
-
getControls
Description copied from interface:GameSetupStepA GUI component that prompts the player for the needed information. If null, then no further information is needed- Specified by:
getControlsin interfaceGameSetupStep
-
getStepTitle
Description copied from interface:GameSetupStepA human-understandable description of this step- Specified by:
getStepTitlein interfaceGameSetupStep- Returns:
- step title for Wizard's GameSetupStep
-
validatePassword
public void validatePassword() -
setController
public void setController(org.netbeans.spi.wizard.WizardController wc) Description copied from interface:GameSetupStepTells the step who its wizard controller is- Specified by:
setControllerin interfaceGameSetupStep
-
setForcePwd
public void setForcePwd(boolean forcePwd) -
isFinished
public boolean isFinished()Implement GameSetupStep for Wizard- Specified by:
isFinishedin interfaceGameSetupStep- Returns:
- true if Wizard GameSetupStep is finished
-
allSidesAllocated
protected boolean allSidesAllocated()- Returns:
- true if all sides have been claimed by a player
-
isTranslatedSoloSide
- Parameters:
side- Name of a side to see if it's a "solo side"- Returns:
- True if the side is "Solitaire", "Solo", "Moderator", or "Referee"
-
isSoloSide
-
isMultiPlayer
public boolean isMultiPlayer()- Returns:
- True if this is currently a multiPlayer game (either connected to a server, or more than one player side allocated)
-
claimSlot
protected void claimSlot(int index) Claims an existing slot for the current player, and sets our temporary user id appropriately- Parameters:
index- The index of the slot to be claimed in the roster
-
claimOccupiedSide
protected void claimOccupiedSide()Claims the appropriate occupied side, if any, for the current player. If more than one is available, prompts. -
getAvailableSides
-
promptForSide
-
promptForSide
-
getAttributeNames
Description copied from class:AbstractToolbarItemThis getAttributeNames() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeNames(), key1, ..., keyN), or supply their own order from scratch.Lists all the buildFile (XML) attribute names for this component. If this component is ALSO an
AbstractConfigurable, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()andAbstractConfigurable.getAttributeTypes().- Specified by:
getAttributeNamesin interfaceAutoConfigurable- Overrides:
getAttributeNamesin classAbstractToolbarItem- Returns:
- an array of all buildFile (XML) attribute names for this component
-
getAttributeTypes
Description copied from class:AbstractToolbarItemThis getAttributeTypes() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeTypes(), key1, ..., keyN), or supply their own order from scratch.- Specified by:
getAttributeTypesin interfaceAutoConfigurable- Overrides:
getAttributeTypesin classAbstractToolbarItem- 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 in
AbstractBuildable.getAttributeNames()
-
getAttributeValueString
Description copied from class:AbstractToolbarItemClasses extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.- Specified by:
getAttributeValueStringin interfaceAutoConfigurable- Specified by:
getAttributeValueStringin interfaceTranslatable- Overrides:
getAttributeValueStringin classAbstractToolbarItem- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractToolbarItem.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
AbstractToolbarItem.setAttribute(java.lang.String, java.lang.Object). It is also frequently used for checking the current value of an attribute.
-
setAttribute
Description copied from class:AbstractToolbarItemClasses extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.Sets a buildFile (XML) attribute value for this component. The
keyparameter will be one of those listed inAbstractToolbarItem.getAttributeNames(). If thevalueparameter is a String, it will be the value returned byAbstractToolbarItem.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 classAbstractToolbarItem- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractToolbarItem.getAttributeNames()value- If thevalueparameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getSidesAsString
-
setSidesFromString
Set a new set of side names from a translation DO NOT apply if the number of sides does not match the number of currently defined sides as there is no way to tell which translation applies to which existing side- Parameters:
newSides- Comma delimited string of translated sides
-
untranslateSide
-
translateSide
-
getAttributeDescriptions
Description copied from class:AbstractToolbarItemThis getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeDescriptions(), key1, ..., keyN), or supply their own order from scratch.- Specified by:
getAttributeDescriptionsin interfaceAutoConfigurable- Overrides:
getAttributeDescriptionsin classAbstractToolbarItem- 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()
-
getDescription
- Specified by:
getDescriptionin interfaceComponentDescription- Returns:
- Description to be displayed next to component type/name in the main Editor window. Or null or "" to not display anything.
-
getPropertyList
- Specified by:
getPropertyListin interfaceSearchTarget- Overrides:
getPropertyListin classAbstractToolbarItem- Returns:
- a list of any Property Names referenced in the Configurable, if any (for search)
-
getI18nData
- Specified by:
getI18nDatain interfaceTranslatable- Overrides:
getI18nDatain classAbstractConfigurable- Returns:
- the i18n data for this component
-
isMandatory
public boolean isMandatory()Description copied from interface:BuildableIs this component a reqired component within its parent?- Specified by:
isMandatoryin interfaceBuildable- Returns:
- true if component is mandatory
-
isUnique
public boolean isUnique()Description copied from interface:BuildableDoes this component need to be unique within it's parent?
-