Class ModuleExtension
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.module.ModuleExtension
- All Implemented Interfaces:
Buildable, GpIdSupport, GameComponent, PluginsLoader.PluginElement, PropertyNameSource, ValidityChecker, Auditable, ImageSearchTarget
- 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 ClassesModifier and TypeClassDescriptionstatic classA command that verifies that a certain extension has been loaded -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected Stringstatic final Stringstatic final Stringprotected Stringprotected JTextFieldstatic final Stringprotected intprotected booleanstatic final Stringstatic final Stringstatic final StringFields inherited from class AbstractBuildable
buildComponents, validator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds this component to its parent.voidbuild()protected voidcheckGpIds(Buildable b, GpIdChecker checker) booleanGenerate a new Unique GamePiece IdClass<?>[]String[]Lists all the buildFile (XML) attribute names for this component.getName()intAccessors to check and update the next GpId if necessary.When saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullbooleanvoidvoidremoveFrom(Buildable parent) voidsave()voidsaveAs()voidsetAttribute(String key, Object value) Sets a buildFile (XML) attribute value for this component.voidsetNextGpId(int id) voidsetup(boolean gameStarting) Notify the GameComponent that a game has started/endedprotected voidAllocate new gpid's to all PieceSlots defined in a Buildable and all of it's childrenprotected voidprotected voidwrite(boolean saveAs) Methods inherited from class AbstractBuildable
add, addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validateModifier and TypeMethodDescriptionvoidAdd a Buildable object to this objectvoidAdds all images used by this component AND any subcomponents to the collectionvoidBuild this component by getting all XML attributes of the XML element and callingAbstractBuildable.setAttribute(String, Object)with the String value of the attribute<T> List<T> getAllDescendantComponentsOf(Class<T> target) Recursively descend the build tree and return aListof all components that are instances of the given classDeprecated, for removal: This API element is subject to removal in a future version.getBuildElement(Document doc) <T> Enumeration<T> getComponents(Class<T> target) Deprecated, for removal: This API element is subject to removal in a future version.UseAbstractBuildable.getComponentsOf(Class)instead.<T> List<T> getComponentsOf(Class<T> target) Override this method to provide a list of properties to be exposed for use by expressions in the module.voidsetAncestor(Buildable ancestor) voidvalidate(Buildable target, ValidationReport report) Methods inherited from class AbstractImageFinder
addLocalImageNames, getAllImageNames, getLocalImageNamesModifier and TypeMethodDescriptionvoidClasses extending AbstractImageFinder should override this method in order to add the names of any image files they use to the collection.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Auditable
getComponentName, getComponentTypeNameMethods inherited from interface Buildable
isMandatory, isMovable, isUniqueModifier and TypeMethodDescriptiondefault booleanIs this component a reqired component within its parent?default booleanIs this component allowed to be moved around the Configure Tree?default booleanisUnique()Does this component need to be unique within it's parent?
-
Field Details
-
BASE_MODULE_NAME
- See Also:
-
BASE_MODULE_VERSION
- See Also:
-
VERSION
- See Also:
-
VASSAL_VERSION_CREATED
- See Also:
-
UNIVERSAL
- See Also:
-
NEXT_PIECESLOT_ID
- See Also:
-
EXTENSION_ID
- See Also:
-
DESCRIPTION
- See Also:
-
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:GpIdSupportAccessors to check and update the next GpId if necessary.- Specified by:
getNextGpIdin interfaceGpIdSupport
-
setNextGpId
public void setNextGpId(int id) - Specified by:
setNextGpIdin interfaceGpIdSupport
-
getRestoreCommand
Description copied from interface:GameComponentWhen saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommandin interfaceGameComponent
-
setup
public void setup(boolean gameStarting) Description copied from interface:GameComponentNotify the GameComponent that a game has started/ended- Specified by:
setupin interfaceGameComponent- Parameters:
gameStarting- if true, a game is starting. If false, then a game is ending
-
getAttributeNames
Description copied from class:AbstractBuildableLists 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:
getAttributeNamesin classAbstractBuildable- Returns:
- a list of all buildFile (XML) attribute names for this component
-
getAllowableConfigureComponents
-
getHelpFile
-
removeFrom
-
confirmExit
public boolean confirmExit() -
getAttributeValueString
- Specified by:
getAttributeValueStringin classAbstractBuildable- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractBuildable.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
AbstractBuildable.setAttribute(String, Object). It is also frequently used for checking the current value of an attribute.
-
setAttribute
Description copied from class:AbstractBuildableSets a buildFile (XML) attribute value for this component. Thekeyparameter will be one of those listed inAbstractBuildable.getAttributeNames(). If thevalueparameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluewill be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()- Specified by:
setAttributein classAbstractBuildable- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()value- If thevalueparameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getExtensionId
-
generateGpId
Generate a new Unique GamePiece Id- Specified by:
generateGpIdin interfaceGpIdSupport- Returns:
- PieceSlot Id
-
addTo
Description copied from interface:BuildableAdds this component to its parent. In order to make Buildable objects extensible, the child is responsible 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
-
write
- Throws:
IOException
-
save
- Throws:
IOException
-
saveAs
- Throws:
IOException
-
remove
-
getEditAction
-
AbstractBuildable.getBuildables()instead.