Package VASSAL.build
Class AbstractConfigurable
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
- All Implemented Interfaces:
AutoConfigurable,Buildable,Configurable,PropertyNameSource,ValidityChecker,Translatable
- Direct Known Subclasses:
AboutScreen,AbstractScript,BasicPreference,Board,ChangePropertyButton,ColorManager,ColorSwatch,CounterDetailViewer,DiceButton,DieManager,DoActionButton,Documentation,FontManager,FontStyle,GameModule,GamePieceImage,GamePieceImageDefinitions,GamePieceLayout,GamePieceLayoutsContainer,GlobalOptions,GlobalProperties,GlobalProperty,HelpFile,HexGrid,HighlightLastMoved,IconFamily,ImageSaver,Inventory,Item,ItemInstance,Language,LayerControl,LayeredPieceCollection,LOS_Thread,Map,MapShader,MassKeyCommand,NotesWindow,PieceRecenterer,PlayerRoster,Plugin,PredefinedSetup,PrototypeDefinition,PrototypesContainer,Region,RegionGrid,RegularGridNumbering,ScriptContainer,SelectionHighlighter,SelectionHighlighters,SetupStack,SpecialDiceButton,SpecialDie,SpecialDieFace,SquareGrid,StackMetrics,TextSaver,ToolbarMenu,TranslatableMarker,Translation,TurnComponent,TurnGlobalHotkey,Tutorial,Widget,Zone,ZonedGrid,ZonedGridHighlighter,ZoneHighlight,Zoomer
public abstract class AbstractConfigurable extends AbstractBuildable implements AutoConfigurable
An abstract implementation of the
Configurable interface. To make a component which is both buildable from the buildFile (XML)
and whose XML attributes are then editable/configurable with a dialog in the Editor, extend this class. Takes care of most of
the Configurable functionality. Provides the basis for a component to have a configuration dialog in the Editor, allowing various
attributes to be edited, retained, and saved/loaded from the module's buildFile (XML).-
Nested Class Summary
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
Fields Modifier and Type Field Description protected PropertyChangeSupportchangeSupportprotected Configurerconfigprotected StringlocalizedNameprotected ComponentI18nDatamyI18nDataprotected StringnameFields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validatorFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY -
Constructor Summary
Constructors Constructor Description AbstractConfigurable() -
Method Summary
Modifier and Type Method Description voidadd(Buildable b)Set the owning translatable of this componentvoidaddPropertyChangeListener(PropertyChangeListener l)Add a PropertyChangeListener.abstract String[]getAttributeDescriptions()Return an array of Strings describing the attributes of this object.abstract Class<?>[]getAttributeTypes()Return the Class for the buildFile (XML) attributes of this component.VisibilityConditiongetAttributeVisibility(String name)By default, all attributes are visibleConfigurable[]getConfigureComponents()StringgetConfigureName()ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.ConfigurergetConfigurer()ComponentI18nDatagetI18nData()protected StringgetI18nPrefix()StringgetLocalizedConfigureName()voidremove(Buildable b)Remove a Buildable object from this objectvoidremovePropertyChangeListener(PropertyChangeListener l)protected voidsetAllAttributesUntranslatable()Sets all attributes untranslatable.protected voidsetAttributeTranslatable(String attr, boolean b)Over-ride the default attribute translatability.voidsetConfigureName(String s)Sets the name and fires a PropertyChangeEventMethods inherited from class VASSAL.build.AbstractBuildable
build, getAllDescendantComponents, getAllDescendantComponentsOf, getAttributeNames, getAttributeValueString, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, setAttribute, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface VASSAL.build.AutoConfigurable
getAttributeNames, getAttributeValueString, setAttributeMethods inherited from interface VASSAL.build.Buildable
addTo, build, getBuildElementMethods inherited from interface VASSAL.build.Configurable
getAllowableConfigureComponents, getHelpFile, removeFrom
-
Field Details
-
changeSupport
-
name
-
localizedName
-
config
-
myI18nData
-
-
Constructor Details
-
AbstractConfigurable
public AbstractConfigurable()
-
-
Method Details
-
remove
Remove a Buildable object from this object- Specified by:
removein interfaceConfigurable
-
getConfigureName
ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred byUniqueIdManager.- Specified by:
getConfigureNamein interfaceConfigurable- Returns:
- The language-independent name of this component used for programmatic identification (including within Modules by e.g. Traits and module components)
-
getLocalizedConfigureName
- Returns:
- The localized name for on-screen display
-
setConfigureName
Sets the name and fires a PropertyChangeEvent -
getAttributeDescriptions
Description copied from interface:AutoConfigurableReturn 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:
getAttributeDescriptionsin interfaceAutoConfigurable- Returns:
- an array of Strings describing the buildFile (XML) attributes of this component. These strings are used as prompts in the
Properties window for this object, when the component is configured in the Editor. The order of descriptions should
be the same as the order of names in
AbstractBuildable.getAttributeNames()
-
getAttributeTypes
Return the Class for the buildFile (XML) attributes of this component. Valid classes include: String, Integer, Double, Boolean, Image, Color, and KeyStroke, along with any class for which a Configurer exists in VASSAL.configure. The class determines, among other things, which type ofAutoConfigurerwill be used to configure the attribute when the object is configured in the Editor. The order of classes should be the same as the order of names inAbstractBuildable.getAttributeNames()- Specified by:
getAttributeTypesin interfaceAutoConfigurable
-
getAttributeVisibility
By default, all attributes are visible- Specified by:
getAttributeVisibilityin interfaceAutoConfigurable- Parameters:
name- Name (key) of one of this component's attributes- Returns:
- a
VisibilityConditionfor this attribute, or null if attribute should always be visible.
-
getI18nData
- Specified by:
getI18nDatain interfaceTranslatable- Returns:
- the i18n data for this component
-
getI18nPrefix
- Returns:
- Generate a standard prefix for i18n keys for attributes of this component - Classname.attributeName
-
setAttributeTranslatable
Over-ride the default attribute translatability. This is called by individual components to force specific attributes to be translatable or not translatable- Parameters:
attr- Attribute name/keyb- true if translatable, false if not
-
setAllAttributesUntranslatable
protected void setAllAttributesUntranslatable()Sets all attributes untranslatable. -
add
Set the owning translatable of this component- Specified by:
addin interfaceBuildable- Overrides:
addin classAbstractBuildable
-
addPropertyChangeListener
Description copied from interface:ConfigurableAdd a PropertyChangeListener. A PropertyChangeEvent should be fired with property nameConfigurable.NAME_PROPERTYwhen the value returned fromConfigurable.getConfigureName()has changed- Specified by:
addPropertyChangeListenerin interfaceConfigurable
-
removePropertyChangeListener
-
getConfigureComponents
- Specified by:
getConfigureComponentsin interfaceConfigurable- Returns:
- A list of all child components (i.e. subcomponents) of this component that are configurable.
-
getConfigurer
- Specified by:
getConfigurerin interfaceConfigurable- Returns:
- Configurer for this component
-