Class PlayerRoster
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,AutoConfigurable
,Buildable
,Configurable
,GameComponent
,GameSetupStep
,PropertyNameSource
,CommandEncoder
,ComponentDescription
,ValidityChecker
,Translatable
,Auditable
,ImageSearchTarget
,SearchTarget
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static interface
Call-back interface for when a player changes sides during a gameNested classes/interfaces inherited from class VASSAL.build.AbstractToolbarItem
AbstractToolbarItem.FormattedStringConfig, AbstractToolbarItem.IconConfig
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
protected String
static final String
protected boolean
Controls how the pick side drop-down interacts with the Startup Wizard.static final String
static final String
protected List
<PlayerRoster.PlayerInfo> static final String
static final String
protected LaunchButton
Deprecated, for removal: This API element is subject to removal in a future version.use launch from the superclassprotected List
<PlayerRoster.SideChangeListener> protected StringEnumConfigurer
static final String
static final String
static final String
static final String
protected String
protected 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, TOOLTIP
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, name
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a player to the list of active players occupying sidesvoid
Set the owning translatable of this componentvoid
Add a PropertyChangeListener.void
void
Default behavior adds the button to the parent componentprotected boolean
void
Build 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 void
Claims the appropriate occupied side, if any, for the current player.protected void
claimSlot
(int index) Claims an existing slot for the current player, and sets our temporary user id appropriatelyTranslate a String into aCommand
Translate aCommand
into a Stringvoid
finish()
finish() step for Wizardprotected void
fireSideChange
(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 String
A GUI component that prompts the player for the needed information.protected static PlayerRoster
Deprecated, for removal: This API element is subject to removal in a future version.static String
Return my Translated Sidestatic String
Return my Untranslated sideprotected static String
getMySide
(boolean localized) When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullgetSides()
protected String
A human-understandable description of this stepString[]
static boolean
isActive()
boolean
Implement GameSetupStep for Wizardboolean
Is this component a reqired component within its parent?boolean
static boolean
isSoloSide
(String side) static boolean
isTranslatedSoloSide
(String side) boolean
isUnique()
Does this component need to be unique within it's parent?protected void
launch()
Called when the Launch Button for the player roster is clicked (i.e. the "Retire" or "Change Sides" button)protected String
protected String
promptForSide
(String newSide) void
Remove a player from the list of active players occupying sidesvoid
Remove a Buildable object from this objectvoid
removeFrom
(Buildable parent) Remove from our parentvoid
void
reset()
Called when a Game Start wizard has been cancelled.void
setAttribute
(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.void
setController
(org.netbeans.spi.wizard.WizardController wc) Tells the step who its wizard controller isvoid
setForcePwd
(boolean forcePwd) protected void
setSidesFromString
(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 sidevoid
setup
(boolean gameStarting) Notify the GameComponent that a game has started/endedtranslateSide
(String side) untranslateSide
(String side) void
Methods 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, setTooltipKey
Methods inherited from class VASSAL.build.AbstractConfigurable
getConfigurer, getExpressionList, getFormattedStringList, getI18nPrefix, getLocalizedConfigureName, getTypeName, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validate
Methods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNames
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
-
freshStart
protected boolean freshStartControls how the pick side drop-down interacts with the Startup Wizard. See below for full details -
sideConfig
-
-
Constructor Details
-
PlayerRoster
public PlayerRoster()
-
-
Method Details
-
removeFrom
Description copied from class:AbstractToolbarItem
Remove from our parent- Specified by:
removeFrom
in interfaceConfigurable
- Overrides:
removeFrom
in classAbstractToolbarItem
- Parameters:
parent
- parent
-
remove
Description copied from class:AbstractConfigurable
Remove a Buildable object from this object- Specified by:
remove
in interfaceConfigurable
- Overrides:
remove
in classAbstractConfigurable
-
build
Description copied from class:AbstractBuildable
Build 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:
build
in interfaceBuildable
- Overrides:
build
in classAbstractBuildable
- Parameters:
e
- the XML element containing the object data
-
getConfigureName
Description copied from class:AbstractConfigurable
ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager
.- Specified by:
getConfigureName
in interfaceConfigurable
- Overrides:
getConfigureName
in 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:AbstractConfigurable
Set the owning translatable of this component- Specified by:
add
in interfaceBuildable
- Overrides:
add
in classAbstractConfigurable
- Parameters:
child
- Child to attach to this buildable as a subcomponent
-
getConfigureComponents
- Specified by:
getConfigureComponents
in interfaceConfigurable
- Overrides:
getConfigureComponents
in classAbstractConfigurable
- Returns:
- A list of all child components (i.e. subcomponents) of this component that are configurable.
-
getBuildElement
- Specified by:
getBuildElement
in interfaceBuildable
- Overrides:
getBuildElement
in classAbstractBuildable
- Parameters:
doc
- XML file- Returns:
- an XML element from which this component can be built
-
addPropertyChangeListener
Description copied from interface:Configurable
Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTY
when the value returned fromConfigurable.getConfigureName()
has changed- Specified by:
addPropertyChangeListener
in interfaceConfigurable
- Overrides:
addPropertyChangeListener
in classAbstractConfigurable
-
addSideChangeListenerToInstance
-
removeSideChangeListenerFromInstance
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFile describing how to use and configure * this component
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponents
in 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
ConfigureTree
window by right-clicking on the component and selecting the appropriate "Add" option.
-
addTo
Description copied from class:AbstractToolbarItem
Default behavior adds the button to the parent component- Specified by:
addTo
in interfaceBuildable
- Overrides:
addTo
in 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 Untranslated side -
getMyLocalizedSide
Return my Translated Side -
getCurrentPasswords
-
getMySide
-
getPlayers
-
getSides
-
getUntranslatedSideList
-
getUntranslatedSides
-
add
-
remove
Remove a player from the list of active players occupying sides- Parameters:
playerId
- player unique id (password)
-
decode
Description copied from interface:CommandEncoder
Translate a String into aCommand
- Specified by:
decode
in interfaceCommandEncoder
-
encode
Description copied from interface:CommandEncoder
Translate aCommand
into a String- Specified by:
encode
in interfaceCommandEncoder
-
getRestoreCommand
Description copied from interface:GameComponent
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommand
in interfaceGameComponent
- Overrides:
getRestoreCommand
in classAbstractToolbarItem
-
setup
public void setup(boolean gameStarting) Description copied from interface:GameComponent
Notify the GameComponent that a game has started/ended- Specified by:
setup
in interfaceGameComponent
- Overrides:
setup
in classAbstractToolbarItem
- Parameters:
gameStarting
- if true, a game is starting. If false, then a game is ending
-
finish
-
reset
public void reset()Called when a Game Start wizard has been cancelled. Record that the next call from the Wizard will be from a completelty new Wizard -
getControls
Description copied from interface:GameSetupStep
A GUI component that prompts the player for the needed information. If null, then no further information is needed- Specified by:
getControls
in interfaceGameSetupStep
-
getStepTitle
Description copied from interface:GameSetupStep
A human-understandable description of this step- Specified by:
getStepTitle
in 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:GameSetupStep
Tells the step who its wizard controller is- Specified by:
setController
in interfaceGameSetupStep
-
setForcePwd
public void setForcePwd(boolean forcePwd) -
isFinished
public boolean isFinished()Implement GameSetupStep for Wizard- Specified by:
isFinished
in 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:AbstractToolbarItem
This 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:
getAttributeNames
in interfaceAutoConfigurable
- Overrides:
getAttributeNames
in classAbstractToolbarItem
- Returns:
- an array of all buildFile (XML) attribute names for this component
-
getAttributeTypes
Description copied from class:AbstractToolbarItem
This 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:
getAttributeTypes
in interfaceAutoConfigurable
- Overrides:
getAttributeTypes
in 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
AutoConfigurer
will 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:AbstractToolbarItem
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.- Specified by:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Overrides:
getAttributeValueString
in 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:AbstractToolbarItem
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.Sets a buildFile (XML) attribute value for this component. The
key
parameter will be one of those listed inAbstractToolbarItem.getAttributeNames()
. If thevalue
parameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
will be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Overrides:
setAttribute
in classAbstractToolbarItem
- Parameters:
key
- the name of the attribute. Will be one of those listed inAbstractToolbarItem.getAttributeNames()
value
- If thevalue
parameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
can 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:AbstractToolbarItem
This 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:
getAttributeDescriptions
in interfaceAutoConfigurable
- Overrides:
getAttributeDescriptions
in 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:
getDescription
in 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:
getPropertyList
in interfaceSearchTarget
- Overrides:
getPropertyList
in classAbstractToolbarItem
- Returns:
- a list of any Property Names referenced in the Configurable, if any (for search)
-
getI18nData
- Specified by:
getI18nData
in interfaceTranslatable
- Overrides:
getI18nData
in classAbstractConfigurable
- Returns:
- the i18n data for this component
-
isMandatory
public boolean isMandatory()Description copied from interface:Buildable
Is this component a reqired component within its parent?- Specified by:
isMandatory
in interfaceBuildable
- Returns:
- true if component is mandatory
-
isUnique
-