VASSAL.build.module
Class ModuleExtension

java.lang.Object
  |
  +--VASSAL.build.AbstractBuildable
        |
        +--VASSAL.build.module.ModuleExtension
All Implemented Interfaces:
Buildable, GameComponent

public class ModuleExtension
extends AbstractBuildable
implements GameComponent

An optional extension to a GameModule Like a GameModule, it is built from scratch from a 'buildFile' in a DataArchive The components described in the buildFile are appended to components in the base DataArchive


Nested Class Summary
static class ModuleExtension.RegCmd
          A command that verifies that a certain extension has been loaded
 
Field Summary
static java.lang.String BASE_MODULE_NAME
           
static java.lang.String BASE_MODULE_VERSION
           
static java.lang.String VERSION
           
 
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents
 
Constructor Summary
ModuleExtension(DataArchive archive)
           
 
Method Summary
 void addTo(Buildable parent)
          Adds this component to its parent.
 void build()
           
 java.lang.String buildString()
           
 boolean confirmExit()
           
 java.lang.Class[] getAllowableConfigureComponents()
           
 java.lang.String[] getAttributeNames()
           
 java.lang.String getAttributeValueString(java.lang.String key)
          Return a String representation of the attribute with the given name.
 DataArchive getDataArchive()
           
 javax.swing.Action getEditAction(java.awt.Frame f)
           
 HelpFile getHelpFile()
           
 java.lang.String getName()
           
 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
 java.lang.String getVersion()
           
 void remove(ExtensionElement el)
           
 void removeFrom(Buildable parent)
           
 void save()
           
 void saveAs()
           
 void setAttribute(java.lang.String key, java.lang.Object value)
          Sets an attribute value for this component.
 void setup(boolean gameStarting)
          Notify the GameComponent that a game has started/ended
 
Methods inherited from class VASSAL.build.AbstractBuildable
add, build, getBuildComponents, getBuildElement, getComponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_MODULE_NAME

public static final java.lang.String BASE_MODULE_NAME
See Also:
Constant Field Values

BASE_MODULE_VERSION

public static final java.lang.String BASE_MODULE_VERSION
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Constructor Detail

ModuleExtension

public ModuleExtension(DataArchive archive)
Method Detail

getVersion

public java.lang.String getVersion()

getDataArchive

public DataArchive getDataArchive()

build

public void build()

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
Parameters:
gameStarting - if true, a game is starting. If false, then a game is ending

getAttributeNames

public java.lang.String[] getAttributeNames()
Specified by:
getAttributeNames in class AbstractBuildable
Returns:
a list of all attribute names for this component

getAllowableConfigureComponents

public java.lang.Class[] getAllowableConfigureComponents()

getHelpFile

public HelpFile getHelpFile()

removeFrom

public void removeFrom(Buildable parent)

confirmExit

public boolean confirmExit()

getAttributeValueString

public java.lang.String getAttributeValueString(java.lang.String key)
Description copied from class: AbstractBuildable
Return a String representation of the attribute with the given name. When initializing a module, this String value will be passed to AbstractBuildable.setAttribute(java.lang.String, java.lang.Object).

Specified by:
getAttributeValueString in class AbstractBuildable
Parameters:
key - the name of the attribute. Will be one of those listed in AbstractBuildable.getAttributeNames()

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Description copied from class: AbstractBuildable
Sets an attribute value for this component. The key parameter will be one of those listed in AbstractBuildable.getAttributeNames(). If the value parameter is a String, it will be the value returned by AbstractBuildable.getAttributeValueString(java.lang.String) for the same key. If the implementing class extends AbstractConfigurable, then value will be an instance of the corresponding Class listed in AbstractConfigurable.getAttributeTypes()

Specified by:
setAttribute in class AbstractBuildable
Parameters:
key - the name of the attribute. Will be one of those listed in AbstractBuildable.getAttributeNames()

addTo

public void addTo(Buildable parent)
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

getName

public java.lang.String getName()

buildString

public java.lang.String buildString()

save

public void save()
          throws java.io.IOException
java.io.IOException

saveAs

public void saveAs()
            throws java.io.IOException
java.io.IOException

remove

public void remove(ExtensionElement el)

getEditAction

public javax.swing.Action getEditAction(java.awt.Frame f)