Package VASSAL.build.module
Class SpecialDiceButton
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.AbstractToolbarItem
VASSAL.build.module.DoActionButton
VASSAL.build.module.SpecialDiceButton
- All Implemented Interfaces:
PropertyChangeListener,EventListener,AutoConfigurable,Buildable,Configurable,GameComponent,PropertyNameSource,CommandEncoder,ComponentDescription,ValidityChecker,Translatable,Auditable,ImageSearchTarget,SearchTarget,RecursionLimiter.Loopable,UniqueIdManager.Identifyable
public class SpecialDiceButton
extends DoActionButton
implements CommandEncoder, UniqueIdManager.Identifyable, ComponentDescription
...
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated, for removal: This API element is subject to removal in a future version.static classstatic classCommand for displaying the results of a roll of the diceNested classes/interfaces inherited from class VASSAL.build.module.DoActionButton
DoActionButton.HotkeyConfig, DoActionButton.LoopConfig, DoActionButton.LoopCountConfig, DoActionButton.LoopTypeConfig, DoActionButton.NamedHotkeyListConfigurer, DoActionButton.SoundConfigNested classes/interfaces inherited from class VASSAL.build.AbstractToolbarItem
AbstractToolbarItem.FormattedStringConfigNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected Colorstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.static final Stringprotected Stringprotected Stringstatic final Stringprotected JDialogprotected JLabelprotected List<SpecialDie>static final Stringprotected FormattedStringstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.static final StringDeprecated, for removal: This API element is subject to removal in a future version.protected Stringprotected static final UniqueIdManagerstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.static final Stringprotected final MutableProperty.Implprotected Randomprotected booleanprotected booleanprotected booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected VASSAL.build.module.SpecialDiceButton.ResultsIconstatic final Stringprotected Stringprotected Stringstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.static final Stringstatic final Stringstatic final Stringprotected StringFields inherited from class VASSAL.build.module.DoActionButton
DO_HOTKEY, DO_LOOP, DO_REPORT, DO_SOUND, doHotkey, doLoop, doReport, doSound, hasIndex, hotkeys, HOTKEYS, INDEX, INDEX_PROPERTY, INDEX_START, INDEX_STEP, indexProperty, indexStart, indexStep, indexValue, launch, LOOP_COUNT, LOOP_TYPE, loopCount, loopIndexProperty, loopPropertyRegistered, loopType, POST_LOOP_HOTKEY, postLoopKey, PRE_LOOP_HOTKEY, preLoopKey, REPORT_FORMAT, reportFormat, SOUND_CLIP, soundClip, UNTIL_EXPRESSION, untilExpression, WHILE_EXPRESSION, whileExpressionFields inherited from class VASSAL.build.AbstractToolbarItem
CAN_DISABLE, canDisable, DISABLED_ICON, disabledIconConfig, HIDE_WHEN_DISABLED, hideWhenDisabled, PROPERTY_GATE, propertyGate, showDisabledOptionsFields 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 TypeMethodDescriptionvoidIn case reports use HTML and refer to any image filesvoidvoidExpects to be added to a SymbolDice.Translate a String into aCommandprotected voidDR()Forwards the result of the roll to theChatter.send(java.lang.String)method of theChatterof theGameModule.Translate aCommandinto a StringClass<?>[]String[]This getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.String[]The Attributes of a DiceButton are:BUTTON_TEXTthe label of the button in the toolbarICONthe icon of the button in the toolbarHOTKEYthe hotkey equivalent of the buttonDICE_SETlist of dice sets, an entry can be: [number]name of die[+|-modifier] "name of die" must be SpecialDie "modifier" is added/subtracted to/from total of dice [number]Dnumber of sides (e.g.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.getAttributeVisibility(String name) By default, all attributes are visiblestatic StringgetId()Make a best guess for a unique identifier for the target.Implement PropertyNameSource - Expose roll result propertyprotected StringThe text reported before the results of the rollstatic StringintArrayToString(int[] ia) create String from int arrayvoidRemove from our parentvoidvoidsetAttribute(String key, Object o) 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 voidsetFormat(int[] results) voidstatic int[]get int array from stringMethods inherited from class VASSAL.build.module.DoActionButton
decodeHotkeys, doActions, doHotKey, encodeHotkeys, executeActions, getComponentName, getComponentTypeName, getExpressionList, getNamedKeyStrokeList, getPropertyList, setIndexPropertyValue, updateLoopPropertyRegistrationMethods inherited from class VASSAL.build.AbstractToolbarItem
addPropertyGateListener, addPropertyGateListener, checkDisabled, disableIfTrue, getComponent, getLaunchButton, getMenuTextList, getNameKey, getRestoreCommand, isShowDisabledOptions, makeLaunchButton, propertyChange, removePropertyGateListener, setButtonTextKey, setHotKeyKey, setIconKey, setLaunchButton, setNameKey, setNamePrompt, setShowDisabledOptions, setTooltipKey, setupMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, getI18nData, getI18nPrefix, getLocalizedConfigureName, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, setAncestor, 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, getBuildElement, isMandatory, isMovable, isUniqueMethods inherited from interface VASSAL.tools.UniqueIdManager.Identifyable
getConfigureName
-
Field Details
-
idMgr
-
SHOW_RESULTS_COMMAND
- See Also:
-
dice
-
ran
-
reportResultAsText
protected boolean reportResultAsText -
reportResultInWindow
protected boolean reportResultInWindow -
reportResultInButton
protected boolean reportResultInButton -
id
-
sMapName
-
dialog
-
dialogLabel
-
bgColor
-
resultsIcon
protected VASSAL.build.module.SpecialDiceButton.ResultsIcon resultsIcon -
format
-
chatResultFormat
-
windowTitleResultFormat
-
tooltip
-
property
-
description
-
RESULT_CHATTER
- See Also:
-
CHAT_RESULT_FORMAT
- See Also:
-
RESULT_N
- See Also:
-
RESULT_TOTAL
- See Also:
-
RESULT_WINDOW
- See Also:
-
WINDOW_TITLE_RESULT_FORMAT
- See Also:
-
RESULT_BUTTON
- See Also:
-
WINDOW_X
- See Also:
-
WINDOW_Y
- See Also:
-
BACKGROUND_COLOR
- See Also:
-
DICE_SET
- See Also:
-
NONE
- See Also:
-
DESCRIPTION
- See Also:
-
BUTTON_TEXT
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
TOOLTIP
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
NAME
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
ICON
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
HOTKEY
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
-
Constructor Details
-
SpecialDiceButton
public SpecialDiceButton()
-
-
Method Details
-
getConfigureTypeName
-
getDescription
- Specified by:
getDescriptionin interfaceComponentDescription- Returns:
- Description to be displayed next to component type/name in the main Editor window. Or null or "" to not display anything.
-
getReportPrefix
The text reported before the results of the roll -
DR
protected void DR()Forwards the result of the roll to theChatter.send(java.lang.String)method of theChatterof theGameModule. Format is prefix+[comma-separated roll list]+suffix additionally a command for every die is generated -
setFormat
protected void setFormat(int[] results) -
getAttributeNames
The Attributes of a DiceButton are:BUTTON_TEXTthe label of the button in the toolbarICONthe icon of the button in the toolbarHOTKEYthe hotkey equivalent of the buttonDICE_SETlist of dice sets, an entry can be: [number]name of die[+|-modifier] "name of die" must be SpecialDie "modifier" is added/subtracted to/from total of dice [number]Dnumber of sides (e.g. 2D6)NUMERICresult of all dice is numericREPORT_TOTALIf numeric and true, add the results of the dice together and report the total. Otherwise, report the individual resultsSORTif true sort results per die by numeric valueRESULT_CHATTERif true report results in chatterRESULT_WINDOWif true show result graphical in extra windowWINDOW_Xwidth of window or buttonWINDOW_Yheight of window or buttonRESULT_MAP:TODO: if true show result in special area in mapMAP_NAME:TODO: name of mapRESULT_BUTTONif true show result graphical in button- Specified by:
getAttributeNamesin interfaceAutoConfigurable- Overrides:
getAttributeNamesin classDoActionButton- Returns:
- an array of all buildFile (XML) attribute names for this component
-
getAttributeDescriptions
Description copied from class:AbstractToolbarItemThis 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- Overrides:
getAttributeDescriptionsin classDoActionButton- 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
Description copied from class:AbstractToolbarItemThis 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- Overrides:
getAttributeTypesin classDoActionButton- 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()
-
getAttributeVisibility
Description copied from class:AbstractConfigurableBy default, all attributes are visible- Specified by:
getAttributeVisibilityin interfaceAutoConfigurable- Overrides:
getAttributeVisibilityin classDoActionButton- Parameters:
name- Name (key) of one of this component's attributes- Returns:
- a
VisibilityConditionfor this attribute, or null if attribute should always be visible.
-
addSpecialDie
-
removeSpecialDie
-
addTo
Expects to be added to a SymbolDice. Adds the button to the control window's toolbar and registers itself as aKeyStrokeListener- Specified by:
addToin interfaceBuildable- Overrides:
addToin classAbstractToolbarItem- Parameters:
parent- parent Buildable to add this component to as a subcomponent.
-
removeFrom
Description copied from class:AbstractToolbarItemRemove from our parent- Specified by:
removeFromin interfaceConfigurable- Overrides:
removeFromin classAbstractToolbarItem- Parameters:
b- parent
-
setId
- Specified by:
setIdin interfaceUniqueIdManager.Identifyable
-
getId
- Specified by:
getIdin interfaceUniqueIdManager.Identifyable
-
getIdentifier
Make a best guess for a unique identifier for the target. UseUniqueIdManager.Identifyable.getConfigureName()if non-null, otherwise useUniqueIdManager.Identifyable.getId() -
setAttribute
Description copied from class:AbstractToolbarItemClasses 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. The
keyparameter will be one of those listed inAbstractToolbarItem.getAttributeNames(). If thevalueparameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(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- Overrides:
setAttributein classDoActionButton- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractToolbarItem.getAttributeNames()o- If thevalueparameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(java.lang.String)for the samekey. If the implementing class extendsAbstractConfigurable, thenvaluecan also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAttributeValueString
Description copied from class:AbstractToolbarItemClasses 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- Overrides:
getAttributeValueStringin classDoActionButton- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractToolbarItem.getAttributeNames()- 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
AbstractToolbarItem.setAttribute(java.lang.String, java.lang.Object). It is also frequently used for checking the current value of an attribute.
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable- Overrides:
getAllowableConfigureComponentsin classDoActionButton- Returns:
- 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 Editor's
ConfigureTreewindow by right-clicking on the component and selecting the appropriate "Add" option.
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Overrides:
getHelpFilein classDoActionButton- Returns:
- a HelpFile describing how to use and configure * this component
-
intArrayToString
create String from int array- Parameters:
ia- int-array- Returns:
- encoded String
-
stringToIntArray
get int array from string- Parameters:
s- string with encoded int array- Returns:
- int array
-
getPropertyNames
Implement PropertyNameSource - Expose roll result property- Specified by:
getPropertyNamesin interfacePropertyNameSource- Overrides:
getPropertyNamesin classDoActionButton- Returns:
- Default implementation of PropertyNameSource - No properties exposed
-
encode
Description copied from interface:CommandEncoderTranslate aCommandinto a String- Specified by:
encodein interfaceCommandEncoder
-
decode
Description copied from interface:CommandEncoderTranslate a String into aCommand- Specified by:
decodein interfaceCommandEncoder
-
getFormattedStringList
- Specified by:
getFormattedStringListin interfaceSearchTarget- Overrides:
getFormattedStringListin classDoActionButton- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
addLocalImageNames
In case reports use HTML and refer to any image files- Specified by:
addLocalImageNamesin interfaceImageSearchTarget- Overrides:
addLocalImageNamesin classDoActionButton- Parameters:
s- Collection to add image names to
-
AbstractToolbarItem.IconConfiginstead.