Package VASSAL.build
Class AbstractToolbarItem
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.AbstractToolbarItem
- All Implemented Interfaces:
AutoConfigurable,Buildable,Configurable,PropertyNameSource,ValidityChecker,Translatable,ImageSearchTarget,SearchTarget
- Direct Known Subclasses:
ChangePropertyButton,DiceButton,DoActionButton,ImageSaver,Inventory,LayerControl,LOS_Thread,Map,MapShader,MassKeyCommand,NotesWindow,PieceRecenterer,PlayerRoster,SpecialDiceButton,TextSaver,ToolbarMenu
Creates an item that is both configurable w/ an edit box
AbstractConfigurable and buildable from the
XML buildFile AbstractBuildable, but which also has a Toolbar launch button.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfigures the toolbar's button icon.Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Stringstatic Stringstatic Stringprotected LaunchButtonstatic Stringstatic StringFields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameFields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validatorFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClasses extendingAbstractBuildableshould override this method in order to add the names of any image files they use to the collection.voidDefault behavior adds the button to the module toolbar.String[]This getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.String[]This getAttributeNames() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.Class<?>[]This getAttributeTypes() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.protected ComponentThe component to be added to the control window toolbarprotected LaunchButtonmakeLaunchButton(String tooltip, String button_text, String iconFile, ActionListener action)Create a standard toolbar launcher button for this itemvoidremoveFrom(Buildable b)Default behavior assumes we are removing this from the module toolbarvoidsetAttribute(String key, Object value)Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.protected voidsetButtonTextKey(String buttonTextKey)protected voidsetHotKeyKey(String hotKeyKey)protected voidsetIconKey(String iconKey)protected voidsetLaunchButton(LaunchButton launch)Sets launch button for this toolbar itemprotected voidsetNameKey(String nameKey)protected voidsetTooltipKey(String tooltipKey)Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getAttributeVisibility, getConfigureComponents, getConfigureName, getConfigurer, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getPropertyList, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, validateMethods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface VASSAL.build.Buildable
build, getBuildElementMethods inherited from interface VASSAL.build.Configurable
getAllowableConfigureComponents, getHelpFile
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
TOOLTIP
- See Also:
- Constant Field Values
-
BUTTON_TEXT
- See Also:
- Constant Field Values
-
HOTKEY
- See Also:
- Constant Field Values
-
ICON
- See Also:
- Constant Field Values
-
launch
-
-
Constructor Details
-
AbstractToolbarItem
public AbstractToolbarItem()
-
-
Method Details
-
setNameKey
-
setTooltipKey
-
setButtonTextKey
-
setHotKeyKey
-
setIconKey
-
makeLaunchButton
protected LaunchButton makeLaunchButton(String tooltip, String button_text, String iconFile, ActionListener action)Create a standard toolbar launcher button for this item- Parameters:
tooltip- String tooltip for buttonbutton_text- Text for buttoniconFile- filename for icon defaultaction- Action Listener when launch button is clicked- Returns:
- launch button
-
getLaunchButton
- Returns:
- Launch button for this Toolbar item.
-
setLaunchButton
Sets launch button for this toolbar item- Parameters:
launch- - launch button
-
getAttributeNames
This getAttributeNames() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeNames(), key1, ..., keyN), or supply their own order from scratch.Lists all the buildFile (XML) attribute names for this component. If this component is ALSO an
AbstractConfigurable, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()andAbstractConfigurable.getAttributeTypes().- Specified by:
getAttributeNamesin interfaceAutoConfigurable- Specified by:
getAttributeNamesin classAbstractBuildable- Returns:
- a list of all buildFile (XML) attribute names for this component
-
getAttributeDescriptions
This getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeDescriptions(), key1, ..., keyN), or supply their own order from scratch.- Specified by:
getAttributeDescriptionsin interfaceAutoConfigurable- Specified by:
getAttributeDescriptionsin classAbstractConfigurable- 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
This getAttributeTypes() will return the items specific to the Toolbar Button - classes extending this should add their own items as well. If the "nameKey" is blank, then no "name" configure entry will be generated. Extending classes can use ArrayUtils.addAll(super.getAttributeTypes(), key1, ..., keyN), or supply their own order from scratch.- Specified by:
getAttributeTypesin interfaceAutoConfigurable- Specified by:
getAttributeTypesin classAbstractConfigurable- 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
AutoConfigurerwill 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()
-
setAttribute
Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button. Sets a buildFile (XML) 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()- Specified by:
setAttributein interfaceAutoConfigurable- Specified by:
setAttributein interfaceTranslatable- Specified by:
setAttributein classAbstractBuildable- Parameters:
key- the name of the attribute. Will be one of those listed ingetAttributeNames()value- If thevalueparameter is a String, it will be the value returned bygetAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAttributeValueString
Classes extending AbstractToolbarItem can call this as a super() method after checking for their own keys, to avoid needing to deal with the nitty gritty of the toolbar button.- Specified by:
getAttributeValueStringin interfaceAutoConfigurable- Specified by:
getAttributeValueStringin interfaceTranslatable- Specified by:
getAttributeValueStringin classAbstractBuildable- Parameters:
key- the name of the attribute. Will be one of those listed ingetAttributeNames()- Returns:
- a String representation of the XML buildFile attribute with the given name. When initializing a module,
this String value will loaded from the XML and passed to
setAttribute(java.lang.String, java.lang.Object). It is also frequently used for checking the current value of an attribute.
-
getComponent
The component to be added to the control window toolbar -
addTo
Default behavior adds the button to the module toolbar.- Parameters:
parent- parent Buildable to add this component to as a subcomponent.
-
removeFrom
Default behavior assumes we are removing this from the module toolbar- Parameters:
b- parent
-
getMenuTextList
Description copied from class:AbstractConfigurable- Specified by:
getMenuTextListin interfaceSearchTarget- Overrides:
getMenuTextListin classAbstractConfigurable- Returns:
- a list of any Menu/Button/Tooltip Text strings referenced in the Configurable, if any (for search)
-
getNamedKeyStrokeList
Description copied from class:AbstractConfigurable- Specified by:
getNamedKeyStrokeListin interfaceSearchTarget- Overrides:
getNamedKeyStrokeListin classAbstractConfigurable- Returns:
- a list of any Named KeyStrokes referenced in the Configurable, if any (for search)
-
addLocalImageNames
Classes extendingAbstractBuildableshould override this method in order to add the names of any image files they use to the collection. For "find unused images" and "search".- Specified by:
addLocalImageNamesin interfaceImageSearchTarget- Overrides:
addLocalImageNamesin classAbstractImageFinder- Parameters:
s- Collection to add image names to
-