|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--VASSAL.build.AbstractBuildable
|
+--VASSAL.build.AbstractConfigurable
|
+--VASSAL.build.GameModule
The GameModule class is the base class for a VASSAL module. It is
the root of the Buildable containment hierarchy.
Components which are added directly to the GameModule are contained
in the VASSAL.build.module package
It is a singleton, and contains access points for many other classes,
such as DataArchive, ServerConnection, Logger,
and Prefs
| Inner classes inherited from class VASSAL.build.AutoConfigurable |
AutoConfigurable.Util |
| Field Summary | |
protected DataArchive |
archive
|
protected Chatter |
chat
|
protected CommandEncoder[] |
commandEncoders
|
protected javax.swing.JPanel |
controlPanel
|
protected static java.lang.String |
DEFAULT_NAME
|
protected javax.swing.JFileChooser |
fileChooser
|
protected java.awt.FileDialog |
fileDialog
|
protected javax.swing.JFrame |
frame
|
protected java.lang.String |
gameName
|
protected Prefs |
globalPrefs
|
protected java.util.Vector |
keyStrokeListeners
|
protected java.util.Vector |
keyStrokeSources
|
protected java.lang.String |
lastSavedConfiguration
|
protected Logger |
logger
|
static java.lang.String |
MODULE_NAME
|
static java.lang.String |
MODULE_VERSION
|
protected java.lang.String |
moduleVersion
|
static java.lang.String |
PERSONAL_INFO
The Prefs key for the user's personal info |
protected Prefs |
preferences
|
static java.lang.String |
REAL_NAME
The Prefs key for the user's real name |
protected java.util.Random |
RNG
|
static java.lang.String |
SECRET_NAME
The Prefs key for the user's secret name |
protected GameState |
theState
|
static java.lang.String |
VASSAL_VERSION_CREATED
|
static java.lang.String |
VASSAL_VERSION_RUNNING
The System property of this name will return a version identifier for the version of VASSAL being run |
protected java.lang.String |
vassalVersionCreated
|
| Fields inherited from class VASSAL.build.AbstractConfigurable |
changeSupport, config, name |
| Fields inherited from class VASSAL.build.AbstractBuildable |
buildComponents, validator |
| Fields inherited from interface VASSAL.build.Configurable |
NAME_PROPERTY |
| Constructor Summary | |
protected |
GameModule(DataArchive archive)
|
| Method Summary | |
void |
addCommandEncoder(CommandEncoder ce)
This method adds a CommandEncoder to the list of objects
that will attempt to decode/encode a command |
void |
addKeyStrokeListener(KeyStrokeListener l)
The GameModule acts as the mediator for hotkey events. |
void |
addKeyStrokeSource(KeyStrokeSource src)
The GameModule acts as the mediator for hotkey events. |
void |
addTo(Buildable b)
Adds this component to its parent. |
void |
appendToTitle(java.lang.String s)
Append the string to the title of the controls window and all Map windows |
protected abstract void |
build()
Initialize the module |
protected java.lang.String |
buildString()
|
static int |
compareVersions(java.lang.String v1,
java.lang.String v2)
Deprecated. use Info.compareVersions(java.lang.String, java.lang.String) |
Command |
decode(java.lang.String command)
Uses the registered CommandEncoders
to decode a String into a Command. |
java.lang.String |
encode(Command c)
Uses the registered CommandEncoders to encode a Command into a String object |
java.lang.Class[] |
getAllowableConfigureComponents()
Return a list of valid sub-component Classes. |
ArchiveWriter |
getArchiveWriter()
If the module is being edited, return the writeable archive for the module |
java.lang.String[] |
getAttributeDescriptions()
Return an array of Strings describing the attributes of this object. |
java.lang.String[] |
getAttributeNames()
|
java.lang.Class[] |
getAttributeTypes()
Return the Class for the attributes of this object. |
java.lang.String |
getAttributeValueString(java.lang.String name)
Called by the AbstractBuildable.getBuildElement(org.w3c.dom.Document) method to write the
attributes into an XML element |
Chatter |
getChatter()
|
static java.lang.String |
getConfigureTypeName()
|
javax.swing.JComponent |
getControlPanel()
|
DataArchive |
getDataArchive()
|
javax.swing.JFileChooser |
getFileChooser()
|
java.awt.FileDialog |
getFileDialog()
|
javax.swing.JMenu |
getFileMenu()
|
javax.swing.JFrame |
getFrame()
|
static GameModule |
getGameModule()
|
java.lang.String |
getGameName()
|
GameState |
getGameState()
Return the object responsible for tracking the state of a game. |
java.lang.String |
getGameVersion()
|
Prefs |
getGlobalPrefs()
A set of preferences that applies to all modules |
HelpFile |
getHelpFile()
|
Logger |
getLogger()
|
Prefs |
getPrefs()
|
java.util.Random |
getRNG()
|
abstract ServerConnection |
getServer()
|
javax.swing.JToolBar |
getToolBar()
|
static java.lang.String |
getUserId()
|
static void |
init(GameModule module)
Set the singleton GameModule and invoke build() on it |
void |
quit()
Exit the application, prompting user to save if necessary |
void |
removeCommandEncoder(CommandEncoder ce)
This method removes a CommandEncoder from the list of objects
that will attempt to decode/encode a command |
void |
removeFrom(Buildable parent)
Remove this component from its parent |
void |
save()
If the module is being edited, write the module data |
protected void |
save(boolean saveAs)
|
void |
saveAs()
|
void |
sendAndLog(Command c)
Encode the Command, send it to the server and write it
to a logfile (if any is open) |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Called by the build() method, where value is the
String value read by the XML attribute. |
void |
setChatter(Chatter c)
set the object that displays chat text |
void |
setGlobalPrefs(Prefs p)
|
void |
setPrefs(Prefs p)
|
static void |
setUserId(java.lang.String newId)
Set the identifier for the user |
void |
warn(java.lang.String s)
Display the given text in the control window's status line |
| Methods inherited from class VASSAL.build.AbstractConfigurable |
addPropertyChangeListener, getAttributeVisibility, getConfigureComponents, getConfigureName, getConfigurer, remove, setConfigureName |
| Methods inherited from class VASSAL.build.AbstractBuildable |
add, build, getBuildComponents, getBuildElement, getComponents, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface VASSAL.build.Buildable |
add, build, getBuildElement |
| Field Detail |
protected static final java.lang.String DEFAULT_NAME
public static final java.lang.String MODULE_NAME
public static final java.lang.String MODULE_VERSION
public static final java.lang.String VASSAL_VERSION_CREATED
public static final java.lang.String VASSAL_VERSION_RUNNING
protected java.lang.String moduleVersion
protected java.lang.String vassalVersionCreated
protected java.lang.String gameName
protected java.lang.String lastSavedConfiguration
protected javax.swing.JFileChooser fileChooser
protected java.awt.FileDialog fileDialog
protected javax.swing.JPanel controlPanel
protected GameState theState
protected DataArchive archive
protected Prefs preferences
protected Prefs globalPrefs
protected Logger logger
protected Chatter chat
protected java.util.Random RNG
protected javax.swing.JFrame frame
protected java.util.Vector keyStrokeSources
protected java.util.Vector keyStrokeListeners
protected CommandEncoder[] commandEncoders
public static final java.lang.String REAL_NAME
Prefs key for the user's real namepublic static final java.lang.String SECRET_NAME
Prefs key for the user's secret namepublic static final java.lang.String PERSONAL_INFO
Prefs key for the user's personal info| Constructor Detail |
protected GameModule(DataArchive archive)
| Method Detail |
public javax.swing.JFrame getFrame()
protected abstract void build()
throws java.io.IOException
public void setAttribute(java.lang.String name,
java.lang.Object value)
AutoConfigurableBuildable.build(org.w3c.dom.Element) method, where value is the
String value read by the XML attribute.
Can also be called with Object value to set the attribute.setAttribute in class AbstractBuildableVASSAL.build.AbstractBuildablekey - the name of the attribute. Will be one of those
listed in AbstractBuildable.getAttributeNames()public java.lang.String getAttributeValueString(java.lang.String name)
AutoConfigurableBuildable.getBuildElement(org.w3c.dom.Document) method to write the
attributes into an XML elementgetAttributeValueString in class AbstractBuildableVASSAL.build.AbstractBuildablekey - the name of the attribute. Will be one of those
listed in AbstractBuildable.getAttributeNames()
public static int compareVersions(java.lang.String v1,
java.lang.String v2)
Info.compareVersions(java.lang.String, java.lang.String)
v2 is a later version
the v1, a positive number if an earlier version,
or zero if the versions are the same.public void addTo(Buildable b)
Buildablepublic static java.lang.String getConfigureTypeName()
public void removeFrom(Buildable parent)
Configurablepublic HelpFile getHelpFile()
VASSAL.build.Configurablepublic java.lang.String[] getAttributeNames()
getAttributeNames in class AbstractBuildableVASSAL.build.AutoConfigurablepublic java.lang.String[] getAttributeDescriptions()
AbstractConfigurableAbstractBuildable.getAttributeNames()getAttributeDescriptions in class AbstractConfigurablepublic java.lang.Class[] getAttributeTypes()
AbstractConfigurableAbstractBuildable.getAttributeNames()getAttributeTypes in class AbstractConfigurablepublic java.lang.Class[] getAllowableConfigureComponents()
Configurablepublic void addKeyStrokeSource(KeyStrokeSource src)
addKeyStrokeListener(VASSAL.tools.KeyStrokeListener)public void addKeyStrokeListener(KeyStrokeListener l)
addKeyStrokeSource(VASSAL.tools.KeyStrokeSource)
will forward hotkey events to listeners registered with this method.public java.lang.String getGameName()
public java.lang.String getGameVersion()
public Prefs getPrefs()
public Prefs getGlobalPrefs()
public void addCommandEncoder(CommandEncoder ce)
CommandEncoder to the list of objects
that will attempt to decode/encode a commanddecode(java.lang.String),
encode(VASSAL.command.Command)public void removeCommandEncoder(CommandEncoder ce)
CommandEncoder from the list of objects
that will attempt to decode/encode a commanddecode(java.lang.String),
encode(VASSAL.command.Command)public void warn(java.lang.String s)
public java.util.Random getRNG()
public Logger getLogger()
public void setChatter(Chatter c)
public javax.swing.JComponent getControlPanel()
public Chatter getChatter()
public void setPrefs(Prefs p)
public void setGlobalPrefs(Prefs p)
public Command decode(java.lang.String command)
CommandEncoders
to decode a String into a Command.decode in interface CommandEncoderpublic java.lang.String encode(Command c)
CommandEncoders to encode a Command into a String objectencode in interface CommandEncoderpublic javax.swing.JFileChooser getFileChooser()
public java.awt.FileDialog getFileDialog()
public javax.swing.JToolBar getToolBar()
public javax.swing.JMenu getFileMenu()
public void appendToTitle(java.lang.String s)
s - If null, set the title to the defaulpublic void quit()
public void sendAndLog(Command c)
Command, send it to the server and write it
to a logfile (if any is open)encode(VASSAL.command.Command)public static java.lang.String getUserId()
public static void setUserId(java.lang.String newId)
public abstract ServerConnection getServer()
public static void init(GameModule module)
throws java.io.IOException
build() on itpublic DataArchive getDataArchive()
public ArchiveWriter getArchiveWriter()
public static GameModule getGameModule()
public GameState getGameState()
public void saveAs()
public void save()
protected void save(boolean saveAs)
protected java.lang.String buildString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||