Package VASSAL.build
Class AbstractBuildable
java.lang.Object
VASSAL.build.AbstractBuildable
- All Implemented Interfaces:
Buildable,PropertyNameSource,ValidityChecker
- Direct Known Subclasses:
AbstractConfigurable,BoardPicker,BrowserHelpFile,ChatServerControls,ConnectionWindow,EventLog,MapCenterer,ModuleExtension,PieceMover,Scroller
public abstract class AbstractBuildable extends Object implements Buildable, ValidityChecker, PropertyNameSource
Abstract implementation of the Buildable interface To make a Buildable
component, extend this class. You'll need to implement the methods and
specify the Buildable attributes of this class, and the build process is
handled automatically.
-
Field Summary
Fields Modifier and Type Field Description protected List<Buildable>buildComponentsprotected ValidityCheckervalidator -
Constructor Summary
Constructors Constructor Description AbstractBuildable() -
Method Summary
Modifier and Type Method Description voidadd(Buildable b)Add a Buildable object to this objectvoidbuild(Element e)Build this component by getting all XML attributes of the XML element and callingsetAttribute(java.lang.String, java.lang.Object)with the String value of the attribute<T> Enumeration<T>getAllDescendantComponents(Class<T> target)Deprecated, for removal: This API element is subject to removal in a future version.UsegetAllDescendantComponentsOf(Class)instead.<T> List<T>getAllDescendantComponentsOf(Class<T> target)Recursively descend the build tree and return aListof all components that are instances of the given classabstract String[]getAttributeNames()abstract StringgetAttributeValueString(String key)Return a String representation of the attribute with the given name.List<Buildable>getBuildables()Returns a Collection of Buildable objects which are the direct children of this object in the Buildable containment hierarchy.Enumeration<Buildable>getBuildComponents()Deprecated, for removal: This API element is subject to removal in a future version.UsegetBuildables()instead.ElementgetBuildElement(Document doc)<T> Enumeration<T>getComponents(Class<T> target)Deprecated, for removal: This API element is subject to removal in a future version.UsegetComponentsOf(Class)instead.<T> List<T>getComponentsOf(Class<T> target)List<String>getPropertyNames()Default implementation of PropertyNameSource - No properties exposedabstract voidsetAttribute(String key, Object value)Sets an attribute value for this component.voidvalidate(Buildable target, ValidationReport report)
-
Field Details
-
Constructor Details
-
AbstractBuildable
public AbstractBuildable()
-
-
Method Details
-
build
Build this component by getting all XML attributes of the XML element and callingsetAttribute(java.lang.String, java.lang.Object)with the String value of the attribute -
getAttributeNames
- Returns:
- a list of all attribute names for this component
-
setAttribute
Sets an attribute value for this component. Thekeyparameter will be one of those listed ingetAttributeNames(). If thevalueparameter is a String, it will be the value returned bygetAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluewill be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()- Parameters:
key- the name of the attribute. Will be one of those listed ingetAttributeNames()
-
getAttributeValueString
Return a String representation of the attribute with the given name. When initializing a module, this String value will be passed tosetAttribute(java.lang.String, java.lang.Object).- Parameters:
key- the name of the attribute. Will be one of those listed ingetAttributeNames()
-
getComponents
@Deprecated(since="2020-08-06", forRemoval=true) public <T> Enumeration<T> getComponents(Class<T> target)Deprecated, for removal: This API element is subject to removal in a future version.UsegetComponentsOf(Class)instead.- Returns:
- all build components that are an instance of the given class
-
getComponentsOf
- Returns:
- all build components that are an instance of the given class
-
getAllDescendantComponents
@Deprecated(since="2020-08-06", forRemoval=true) public <T> Enumeration<T> getAllDescendantComponents(Class<T> target)Deprecated, for removal: This API element is subject to removal in a future version.UsegetAllDescendantComponentsOf(Class)instead.Recursively descend the build tree and return an enumeration of all components that are instances of the given class- Parameters:
target- Target class- Returns:
- Results
-
getAllDescendantComponentsOf
Recursively descend the build tree and return aListof all components that are instances of the given class- Parameters:
target- Target class- Returns:
- Results
-
getBuildElement
- Specified by:
getBuildElementin interfaceBuildable- Returns:
- an XML element from which this component can be built
-
add
Add a Buildable object to this object -
getBuildComponents
Deprecated, for removal: This API element is subject to removal in a future version.UsegetBuildables()instead.Returns an enumeration of Buildable objects which are the direct children of this object in the Buildable containment hierarchy. ThegetBuildElement(org.w3c.dom.Document)method uses these objects to construct the XML element from which this object can be built. -
getBuildables
Returns a Collection of Buildable objects which are the direct children of this object in the Buildable containment hierarchy. ThegetBuildElement(org.w3c.dom.Document)method uses these objects to construct the XML element from which this object can be built. -
validate
- Specified by:
validatein interfaceValidityChecker
-
getPropertyNames
Default implementation of PropertyNameSource - No properties exposed- Specified by:
getPropertyNamesin interfacePropertyNameSource
-