VASSAL.build.module
Class PlayerRoster

java.lang.Object
  |
  +--VASSAL.build.module.PlayerRoster
All Implemented Interfaces:
Buildable, CommandEncoder, Configurable, GameComponent

public class PlayerRoster
extends java.lang.Object
implements Configurable, CommandEncoder, GameComponent

Maintains a list of players involved in the current game


Inner Class Summary
static class PlayerRoster.Add
           
static class PlayerRoster.Entry
           
 
Field Summary
static java.lang.String COMMAND_PREFIX
           
 
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
 
Constructor Summary
PlayerRoster()
           
 
Method Summary
 void add(Buildable child)
          Adds a child component.
 void add(java.lang.String playerId, java.lang.String playerName, java.lang.String side)
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a PropertyChangeListener.
 void addTo(Buildable b)
          Adds this component to its parent.
 void build(org.w3c.dom.Element e)
          Build the object
 Command decode(java.lang.String command)
          Translate a String into a Command
 java.lang.String encode(Command c)
          Translate a Command into a String
 java.lang.Class[] getAllowableConfigureComponents()
          Return a list of valid sub-component Classes.
 org.w3c.dom.Element getBuildElement(org.w3c.dom.Document doc)
           
 Configurable[] getConfigureComponents()
           
 java.lang.String getConfigureName()
          The name of this Configurable Object
 Configurer getConfigurer()
          Return a Configurer object which can be used to set the attributes of this object
static java.lang.String getConfigureTypeName()
           
 HelpFile getHelpFile()
           
static java.lang.String getMySide()
           
 PlayerRoster.Entry[] getPlayers()
           
 Command getRestoreCommand()
          When saving a game, each GameComponent should return a Command that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null
static boolean isActive()
           
 void remove(Buildable child)
          Remove a child component
 void remove(java.lang.String playerId)
           
 void removeFrom(Buildable parent)
          Remove this component from its parent
 void setup(boolean gameStarting)
          Notify the GameComponent that a game has started/ended
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_PREFIX

public static final java.lang.String COMMAND_PREFIX
Constructor Detail

PlayerRoster

public PlayerRoster()
Method Detail

removeFrom

public void removeFrom(Buildable parent)
Description copied from interface: Configurable
Remove this component from its parent
Specified by:
removeFrom in interface Configurable

remove

public void remove(Buildable child)
Description copied from interface: Configurable
Remove a child component
Specified by:
remove in interface Configurable

build

public void build(org.w3c.dom.Element e)
Description copied from interface: Buildable
Build the object
Specified by:
build in interface Buildable
Following copied from interface: VASSAL.build.Buildable
Parameters:
e - the XML element containing the object data

getConfigureName

public java.lang.String getConfigureName()
Description copied from interface: Configurable
The name of this Configurable Object
Specified by:
getConfigureName in interface Configurable

getConfigureTypeName

public static java.lang.String getConfigureTypeName()

add

public void add(Buildable child)
Description copied from interface: Buildable
Adds a child component. Both this method and Buildable.addTo(VASSAL.build.Buildable) are invoked when adding a child to a parent
Specified by:
add in interface Buildable

getConfigureComponents

public Configurable[] getConfigureComponents()
Specified by:
getConfigureComponents in interface Configurable
Following copied from interface: VASSAL.build.Configurable
Returns:
an array of Configurer objects representing the Configurable children of this Configurable object

getBuildElement

public org.w3c.dom.Element getBuildElement(org.w3c.dom.Document doc)
Specified by:
getBuildElement in interface Buildable
Following copied from interface: VASSAL.build.Buildable
Returns:
an XML element from which this component can be built

getConfigurer

public Configurer getConfigurer()
Description copied from interface: Configurable
Return a Configurer object which can be used to set the attributes of this object
Specified by:
getConfigurer in interface Configurable

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: Configurable
Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property name Configurable.NAME_PROPERTY when the value returned from Configurable.getConfigureName() has changed
Specified by:
addPropertyChangeListener in interface Configurable

getHelpFile

public HelpFile getHelpFile()
Specified by:
getHelpFile in interface Configurable
Following copied from interface: VASSAL.build.Configurable
Returns:
a HelpFilte describing how to use and configure this component

getAllowableConfigureComponents

public java.lang.Class[] getAllowableConfigureComponents()
Description copied from interface: Configurable
Return 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 Configuration Window.
Specified by:
getAllowableConfigureComponents in interface Configurable

addTo

public void addTo(Buildable b)
Description copied from interface: Buildable
Adds this component to its parent. In order to make Buildable objects extensible, the child is reponsible 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:
addTo in interface Buildable

isActive

public static boolean isActive()

getMySide

public static java.lang.String getMySide()

getPlayers

public PlayerRoster.Entry[] getPlayers()

add

public void add(java.lang.String playerId,
                java.lang.String playerName,
                java.lang.String side)

remove

public void remove(java.lang.String playerId)

decode

public Command decode(java.lang.String command)
Description copied from interface: CommandEncoder
Translate a String into a Command
Specified by:
decode in interface CommandEncoder

encode

public java.lang.String encode(Command c)
Description copied from interface: CommandEncoder
Translate a Command into a String
Specified by:
encode in interface CommandEncoder

getRestoreCommand

public Command getRestoreCommand()
Description copied from interface: GameComponent
When saving a game, each GameComponent should return a Command 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 interface GameComponent

setup

public void setup(boolean gameStarting)
Description copied from interface: GameComponent
Notify the GameComponent that a game has started/ended
Specified by:
setup in interface GameComponent
Following copied from interface: VASSAL.build.module.GameComponent
Parameters:
gameStarting - if true, a game is starting. If false, then a game is ending