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).
  • Field Details

  • Constructor Details

    • AbstractConfigurable

      public AbstractConfigurable()
  • Method Details

    • remove

      public void remove​(Buildable b)
      Remove a Buildable object from this object
      Specified by:
      remove in interface Configurable
    • getConfigureName

      public String getConfigureName()
      ConfigureName is used, in particular, by the Editor to track the names of components, and is preferred by UniqueIdManager.
      Specified by:
      getConfigureName in interface Configurable
      Returns:
      The language-independent name of this component used for programmatic identification (including within Modules by e.g. Traits and module components)
    • getLocalizedConfigureName

      public String getLocalizedConfigureName()
      Returns:
      The localized name for on-screen display
    • setConfigureName

      public void setConfigureName​(String s)
      Sets the name and fires a PropertyChangeEvent
    • getAttributeDescriptions

      public abstract String[] 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 interface AutoConfigurable
      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

      public abstract Class<?>[] 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 of AutoConfigurer will 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 in AbstractBuildable.getAttributeNames()
      Specified by:
      getAttributeTypes in interface AutoConfigurable
    • getAttributeVisibility

      public VisibilityCondition getAttributeVisibility​(String name)
      By default, all attributes are visible
      Specified by:
      getAttributeVisibility in interface AutoConfigurable
      Parameters:
      name - Name (key) of one of this component's attributes
      Returns:
      a VisibilityCondition for this attribute, or null if attribute should always be visible.
    • getI18nData

      public ComponentI18nData getI18nData()
      Specified by:
      getI18nData in interface Translatable
      Returns:
      the i18n data for this component
    • getI18nPrefix

      protected String getI18nPrefix()
      Returns:
      Generate a standard prefix for i18n keys for attributes of this component - Classname.attributeName
    • setAttributeTranslatable

      protected void setAttributeTranslatable​(String attr, boolean b)
      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/key
      b - true if translatable, false if not
    • setAllAttributesUntranslatable

      protected void setAllAttributesUntranslatable()
      Sets all attributes untranslatable.
    • add

      public void add​(Buildable b)
      Set the owning translatable of this component
      Specified by:
      add in interface Buildable
      Overrides:
      add in class AbstractBuildable
    • addPropertyChangeListener

      public void addPropertyChangeListener​(PropertyChangeListener l)
      Description copied from interface: Configurable
      Add a PropertyChangeListener. A PropertyChangeEvent should be fired with property name Configurable.NAME_PROPERTY when the value returned from Configurable.getConfigureName() has changed
      Specified by:
      addPropertyChangeListener in interface Configurable
    • removePropertyChangeListener

      public void removePropertyChangeListener​(PropertyChangeListener l)
    • getConfigureComponents

      public Configurable[] getConfigureComponents()
      Specified by:
      getConfigureComponents in interface Configurable
      Returns:
      A list of all child components (i.e. subcomponents) of this component that are configurable.
    • getConfigurer

      public Configurer getConfigurer()
      The default Configurer of an AbstractConfigurable class is an instance of AutoConfigurer
      Specified by:
      getConfigurer in interface Configurable
      Returns:
      Configurer for this component