Class BrowserHelpFile.ConfigSupport
java.lang.Object
VASSAL.build.module.documentation.BrowserHelpFile.ConfigSupport
- All Implemented Interfaces:
AutoConfigurable
,Buildable
,Configurable
,Translatable
- Enclosing class:
- BrowserHelpFile
protected class BrowserHelpFile.ConfigSupport extends Object implements AutoConfigurable
The attributes we want to expose in the editor are not the same as the ones we want to save to the buildFile, so we
use this object to specify the properties in the editor. Also packs up the contents directory and saves it to the
ArchiveWriter
-
Nested Class Summary
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
Constructors Modifier Constructor Description protected
ConfigSupport()
-
Method Summary
Modifier and Type Method Description void
add(Buildable child)
Adds a child component.void
addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeListener.void
addTo(Buildable parent)
Adds this component to its parent.void
build(Element e)
Build the objectClass<?>[]
getAllowableConfigureComponents()
Return a list of valid sub-component Classes.String[]
getAttributeDescriptions()
Return an array of Strings describing the attributes of this object.String[]
getAttributeNames()
Class<?>[]
getAttributeTypes()
Return the Class for the attributes of this object.String
getAttributeValueString(String key)
Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML elementVisibilityCondition
getAttributeVisibility(String name)
Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.Element
getBuildElement(Document doc)
Configurable[]
getConfigureComponents()
String
getConfigureName()
The name of this Configurable ObjectConfigurer
getConfigurer()
Return aConfigurer
object which can be used to set the attributes of this objectHelpFile
getHelpFile()
ComponentI18nData
getI18nData()
void
packContents()
protected void
packFile(File packed, String prefix, ZipOutputStream out)
void
remove(Buildable child)
Remove a child componentvoid
removeFrom(Buildable parent)
Remove this component from its parentvoid
setAttribute(String key, Object value)
Called by theBuildable.build(org.w3c.dom.Element)
method, wherevalue
is the String value read by the XML attribute.
-
Field Details
-
DIR
- See Also:
- Constant Field Values
-
dir
-
-
Constructor Details
-
ConfigSupport
protected ConfigSupport()
-
-
Method Details
-
getAttributeDescriptions
Description copied from interface:AutoConfigurable
Return an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object.- Specified by:
getAttributeDescriptions
in interfaceAutoConfigurable
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Returns:
- an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element
-
getAttributeTypes
Description copied from interface:AutoConfigurable
Return the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, File, Color, and KeyStroke- Specified by:
getAttributeTypes
in interfaceAutoConfigurable
-
getAttributeValueString
Description copied from interface:AutoConfigurable
Called by theBuildable.getBuildElement(org.w3c.dom.Document)
method to write the attributes into an XML element- Specified by:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Parameters:
key
- the name of the attribute. If the implementing class extendsAbstractConfigurable
, 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
Translatable.setAttribute(java.lang.String, java.lang.Object)
.
-
getAttributeVisibility
Description copied from interface:AutoConfigurable
Because attributes are not always applicable in all cases, this method returns an interface to determine when the controls for specifying the named attribute should be visible.- Specified by:
getAttributeVisibility
in interfaceAutoConfigurable
- Returns:
- null if the attribute controls should always be visible;
-
setAttribute
Description copied from interface:AutoConfigurable
Called by theBuildable.build(org.w3c.dom.Element)
method, wherevalue
is the String value read by the XML attribute. Can also be called with Object value to set the attribute.- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Parameters:
key
- the name of the attribute. If the implementing class extendsAbstractConfigurable
, will be one of those listed inAbstractBuildable.getAttributeNames()
.value
- If thevalue
parameter is a String, it will be the value returned byTranslatable.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()
-
packContents
public void packContents() -
packFile
- Throws:
IOException
-
addPropertyChangeListener
Description copied from interface:Configurable
Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTY
when the value returned fromConfigurable.getConfigureName()
has changed- Specified by:
addPropertyChangeListener
in interfaceConfigurable
-
getAllowableConfigureComponents
Description copied from interface:Configurable
Return a list of valid sub-component Classes. If a Class appears in this list, then instances of that class may be added to this component from the Configuration Window.- Specified by:
getAllowableConfigureComponents
in interfaceConfigurable
-
getConfigureComponents
- Specified by:
getConfigureComponents
in interfaceConfigurable
- Returns:
- an array of Configurer objects representing the Configurable children of this Configurable object
-
getConfigureName
Description copied from interface:Configurable
The name of this Configurable Object- Specified by:
getConfigureName
in interfaceConfigurable
-
getConfigurer
Description copied from interface:Configurable
Return aConfigurer
object which can be used to set the attributes of this object- Specified by:
getConfigurer
in interfaceConfigurable
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Returns:
- a HelpFilte describing how to use and configure this component
-
remove
Description copied from interface:Configurable
Remove a child component- Specified by:
remove
in interfaceConfigurable
-
removeFrom
Description copied from interface:Configurable
Remove this component from its parent- Specified by:
removeFrom
in interfaceConfigurable
-
add
Description copied from interface:Buildable
Adds a child component. Both this method andBuildable.addTo(VASSAL.build.Buildable)
are invoked when adding a child to a parent -
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. -
build
Description copied from interface:Buildable
Build the object -
getBuildElement
- Specified by:
getBuildElement
in interfaceBuildable
- Returns:
- an XML element from which this component can be built
-
getI18nData
- Specified by:
getI18nData
in interfaceTranslatable
-