Package VASSAL.build.module
Class ModuleExtension
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.module.ModuleExtension
- All Implemented Interfaces:
Buildable
,GpIdSupport
,GameComponent
,PluginsLoader.PluginElement
,PropertyNameSource
,ValidityChecker
- Direct Known Subclasses:
ModulePlugin
public class ModuleExtension extends AbstractBuildable implements GameComponent, PluginsLoader.PluginElement, GpIdSupport
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
Nested Classes Modifier and Type Class Description static class
ModuleExtension.RegCmd
A command that verifies that a certain extension has been loaded -
Field Summary
Fields Modifier and Type Field Description static String
BASE_MODULE_NAME
static String
BASE_MODULE_VERSION
protected String
description
static String
DESCRIPTION
static String
EXTENSION_ID
protected String
extensionId
protected JTextField
idDisplay
static String
NEXT_PIECESLOT_ID
protected int
nextGpId
protected boolean
universal
static String
UNIVERSAL
static String
VASSAL_VERSION_CREATED
static String
VERSION
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
-
Constructor Summary
Constructors Constructor Description ModuleExtension(DataArchive archive)
-
Method Summary
Modifier and Type Method Description void
addTo(Buildable parent)
Adds this component to its parent.void
build()
String
buildString()
protected void
checkGpIds(Buildable b, GpIdChecker checker)
boolean
confirmExit()
String
generateGpId()
Generate a new Unique GamePiece IdClass<?>[]
getAllowableConfigureComponents()
String[]
getAttributeNames()
Lists all the buildFile (XML) attribute names for this component.String
getAttributeValueString(String key)
DataArchive
getDataArchive()
String
getDescription()
Action
getEditAction(JDialog d)
String
getExtensionId()
HelpFile
getHelpFile()
String
getName()
int
getNextGpId()
Accessors to check and update the next GpId if necessary.Command
getRestoreCommand()
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 nullboolean
getUniversal()
String
getVersion()
void
remove(ExtensionElement el)
void
removeFrom(Buildable parent)
void
save()
void
saveAs()
void
setAttribute(String key, Object value)
Sets a buildFile (XML) attribute value for this component.void
setNextGpId(int id)
void
setup(boolean gameStarting)
Notify the GameComponent that a game has started/endedprotected void
updateGpIds()
Allocate new gpid's to all PieceSlots defined in a Buildable and all of it's childrenprotected void
updateGpIds(Buildable b)
protected void
write(boolean saveAs)
Methods inherited from class VASSAL.build.AbstractBuildable
add, build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, validate
-
Field Details
-
BASE_MODULE_NAME
- See Also:
- Constant Field Values
-
BASE_MODULE_VERSION
- See Also:
- Constant Field Values
-
VERSION
- See Also:
- Constant Field Values
-
VASSAL_VERSION_CREATED
- See Also:
- Constant Field Values
-
UNIVERSAL
- See Also:
- Constant Field Values
-
NEXT_PIECESLOT_ID
- See Also:
- Constant Field Values
-
EXTENSION_ID
- See Also:
- Constant Field Values
-
DESCRIPTION
- See Also:
- Constant Field Values
-
universal
protected boolean universal -
nextGpId
protected int nextGpId -
extensionId
-
idDisplay
-
description
-
-
Constructor Details
-
ModuleExtension
-
-
Method Details
-
getVersion
-
getDataArchive
-
getDescription
-
getUniversal
public boolean getUniversal() -
build
public void build() -
checkGpIds
-
updateGpIds
protected void updateGpIds()Allocate new gpid's to all PieceSlots defined in a Buildable and all of it's children -
updateGpIds
-
getNextGpId
public int getNextGpId()Description copied from interface:GpIdSupport
Accessors to check and update the next GpId if necessary.- Specified by:
getNextGpId
in interfaceGpIdSupport
-
setNextGpId
public void setNextGpId(int id)- Specified by:
setNextGpId
in interfaceGpIdSupport
-
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
-
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
- Parameters:
gameStarting
- if true, a game is starting. If false, then a game is ending
-
getAttributeNames
Description copied from class:AbstractBuildable
Lists all the buildFile (XML) attribute names for this component. If this component is ALSO anAbstractConfigurable
, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()
andAbstractConfigurable.getAttributeTypes()
.- Specified by:
getAttributeNames
in classAbstractBuildable
- Returns:
- a list of all buildFile (XML) attribute names for this component
-
getAllowableConfigureComponents
-
getHelpFile
-
removeFrom
-
confirmExit
public boolean confirmExit() -
getAttributeValueString
- Specified by:
getAttributeValueString
in classAbstractBuildable
- Parameters:
key
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
- Returns:
- 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)
.
-
setAttribute
Description copied from class:AbstractBuildable
Sets a buildFile (XML) attribute value for this component. Thekey
parameter will be one of those listed inAbstractBuildable.getAttributeNames()
. If thevalue
parameter is a String, it will be the value returned byAbstractBuildable.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 classAbstractBuildable
- Parameters:
key
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
value
- If thevalue
parameter is a String, it will be the value returned byAbstractBuildable.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()
-
getExtensionId
-
generateGpId
Generate a new Unique GamePiece Id- Specified by:
generateGpId
in interfaceGpIdSupport
- Returns:
- PieceSlot Id
-
addTo
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. -
getName
-
buildString
-
write
- Throws:
IOException
-
save
- Throws:
IOException
-
saveAs
- Throws:
IOException
-
remove
-
getEditAction
-