Class AbstractConfigurable

All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, PropertyNameSource, ValidityChecker, Translatable, Auditable, ImageSearchTarget, SearchTarget
Direct Known Subclasses:
AboutScreen, AbstractDeckKeyCommand, AbstractFolder, AbstractScript, AbstractToolbarItem, BasicPreference, Board, BrowserPDFFile, ChessClock, ChessClockControl, ColorManager, ColorSwatch, CounterDetailViewer, DieManager, Documentation, Flare, FontManager, FontStyle, GameModule, GamePieceImage, GamePieceImageDefinitions, GamePieceLayout, GamePieceLayoutsContainer, GlobalOptions, GlobalProperties, GlobalProperty, GlobalTranslatableMessage, GlobalTranslatableMessages, HelpFile, HexGrid, HighlightLastMoved, IconFamily, Item, ItemInstance, Language, LayeredPieceCollection, Plugin, PredefinedSetup, PrototypeDefinition, PrototypesContainer, Region, RegionGrid, RegularGridNumbering, ScenarioPropertiesOptionTab, ScriptContainer, SelectionHighlighter, SelectionHighlighters, SetupStack, SpecialDie, SpecialDieFace, SquareGrid, StackMetrics, TranslatableMarker, Translation, TurnComponent, TurnGlobalHotkey, Tutorial, Widget, Zone, ZonedGrid, ZonedGridHighlighter, ZoneHighlight, Zoomer

public abstract class AbstractConfigurable extends AbstractBuildable implements AutoConfigurable, SearchTarget
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()
      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 interface AutoConfigurable
      Returns:
      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()
    • 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
      Parameters:
      b - Child to attach to this buildable as a subcomponent
    • 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
    • getExpressionList

      public List<String> getExpressionList()
      Specified by:
      getExpressionList in interface SearchTarget
      Returns:
      a list of the Configurables string/expression fields if any (for search)
    • getFormattedStringList

      public List<String> getFormattedStringList()
      Specified by:
      getFormattedStringList in interface SearchTarget
      Returns:
      a list of any Message Format strings referenced in the Configurable, if any (for search)
    • getMenuTextList

      public List<String> getMenuTextList()
      Specified by:
      getMenuTextList in interface SearchTarget
      Returns:
      a list of any Menu/Button/Tooltip Text strings referenced in the Configurable, if any (for search)
    • getNamedKeyStrokeList

      public List<NamedKeyStroke> getNamedKeyStrokeList()
      Specified by:
      getNamedKeyStrokeList in interface SearchTarget
      Returns:
      a list of any Named KeyStrokes referenced in the Configurable, if any (for search)
    • getPropertyList

      public List<String> getPropertyList()
      Specified by:
      getPropertyList in interface SearchTarget
      Returns:
      a list of any Property Names referenced in the Configurable, if any (for search)
    • getTypeName

      public String getTypeName()
      Returns the name of the configurable type for display purposes. Reflection is used to call getConfigureTypeName(), which should be a static method if it exists in the given class. (This is necessary because static methods are not permitted in interfaces.)
      Returns:
      the configure name of the class