Package VASSAL.build.module
Class RandomTextButton
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.AbstractToolbarItem
VASSAL.build.module.DiceButton
VASSAL.build.module.RandomTextButton
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,AutoConfigurable
,Buildable
,Configurable
,GameComponent
,PropertyNameSource
,ValidityChecker
,Translatable
,Auditable
,ImageSearchTarget
,SearchTarget
- Author:
- Michael Blumoehr This component places a button into the controls window toolbar. Pressing the button generates random numbers or strings and displays the result in the Chatter
-
Nested Class Summary
Nested classes/interfaces inherited from class VASSAL.build.module.DiceButton
DiceButton.IconConfig, DiceButton.KeepConfig, DiceButton.ReportFormatConfig
Nested classes/interfaces inherited from class VASSAL.build.AbstractToolbarItem
AbstractToolbarItem.FormattedStringConfig
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected boolean
protected String[]
static final String
Fields inherited from class VASSAL.build.module.DiceButton
ADD_TO_TOTAL, addToTotal, BUTTON_TEXT, counts, DEPRECATED_NAME, HOTKEY, ICON, KEEP_COUNT, KEEP_DICE, KEEP_EQUAL, KEEP_GREATER, KEEP_LARGEST, KEEP_LESS, KEEP_OPTION, KEEP_SMALLEST, keepCount, keepDice, keepingDice, keepOption, keepProp, keepValue, launch, LOCK_ADD, LOCK_DICE, LOCK_PLUS, LOCK_SIDES, lockAdd, lockDice, lockPlus, lockSides, N_DICE, N_SIDES, NAME, nDice, nSides, NUMERIC_TOTAL, numericTotal, plus, PLUS, PROMPT_ALWAYS, promptAlways, property, ran, rawCounts, rawRolls, REPORT_FORMAT, REPORT_NAME, REPORT_TOTAL, reportFormat, reportTotal, RESULT, RESULT_N, SORT_DICE_RESULTS, sortDice, tooltip, TOOLTIP, totalProp
Fields inherited from class VASSAL.build.AbstractToolbarItem
CAN_DISABLE, canDisable, DISABLED_ICON, disabledIconConfig, HIDE_WHEN_DISABLED, hideWhenDisabled, PROPERTY_GATE, propertyGate, showDisabledOptions
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, name
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
In case reports use HTML and refer to any image filesprotected void
DR()
Forwards the result of the roll to theChatter.send(java.lang.String)
method of theChatter
of theGameModule
.String[]
This getAttributeDescriptions() will return the items specific to the Toolbar Button - classes extending this should add their own items as well.String[]
The additional Attributes of a RandomTextButton are:FACES
Text of the dice faces must be integer if USE_FACES=NUMERICNUMERIC
If true, then face text must be an integer, and reportTotal is enabledClass<?>[]
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 String
void
setAttribute
(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.Methods inherited from class VASSAL.build.module.DiceButton
addTo, formatResult, getAllowableConfigureComponents, getPropertyNames, initLaunchButton
Methods inherited from class VASSAL.build.AbstractToolbarItem
addPropertyGateListener, addPropertyGateListener, checkDisabled, disableIfTrue, getComponent, getLaunchButton, getMenuTextList, getNamedKeyStrokeList, getNameKey, getPropertyList, getRestoreCommand, isShowDisabledOptions, makeLaunchButton, propertyChange, removeFrom, removePropertyGateListener, setButtonTextKey, setHotKeyKey, setIconKey, setLaunchButton, setNameKey, setNamePrompt, setShowDisabledOptions, setTooltipKey, setup
Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, getExpressionList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, setAncestor, validate
Methods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNames
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface VASSAL.script.expression.Auditable
getComponentName, getComponentTypeName
Methods inherited from interface VASSAL.build.Buildable
build, getBuildElement, isMandatory, isMovable, isUnique
-
Field Details
-
m_faces
-
isNumeric
protected boolean isNumeric -
FACES
- See Also:
-
NUMERIC
- See Also:
-
-
Constructor Details
-
RandomTextButton
public RandomTextButton()
-
-
Method Details
-
getConfigureTypeName
-
DR
protected void DR()Forwards the result of the roll to theChatter.send(java.lang.String)
method of theChatter
of theGameModule
. Format is prefix+[comma-separated roll list]+suffix- Overrides:
DR
in classDiceButton
-
getAttributeVisibility
Description copied from class:AbstractConfigurable
By default, all attributes are visible- Specified by:
getAttributeVisibility
in interfaceAutoConfigurable
- Overrides:
getAttributeVisibility
in classDiceButton
- 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.
-
getAttributeNames
The additional Attributes of a RandomTextButton are:FACES
Text of the dice faces must be integer if USE_FACES=NUMERICNUMERIC
If true, then face text must be an integer, and reportTotal is enabled- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Overrides:
getAttributeNames
in classDiceButton
- Returns:
- an array of all buildFile (XML) attribute names for this component
-
getAttributeDescriptions
Description copied from class:AbstractToolbarItem
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:
getAttributeDescriptions
in interfaceAutoConfigurable
- Overrides:
getAttributeDescriptions
in classDiceButton
- 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:AbstractToolbarItem
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:
getAttributeTypes
in interfaceAutoConfigurable
- Overrides:
getAttributeTypes
in classDiceButton
- 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()
-
setAttribute
Description copied from class:AbstractToolbarItem
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. The
key
parameter will be one of those listed inAbstractToolbarItem.getAttributeNames()
. If thevalue
parameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
will be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
- Specified by:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Overrides:
setAttribute
in classDiceButton
- Parameters:
key
- the name of the attribute. Will be one of those listed inAbstractToolbarItem.getAttributeNames()
value
- If thevalue
parameter is a String, it will be the value returned byAbstractToolbarItem.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
can also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAttributeValueString
Description copied from class:AbstractToolbarItem
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:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Overrides:
getAttributeValueString
in classDiceButton
- 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.
-
getHelpFile
- Specified by:
getHelpFile
in interfaceConfigurable
- Overrides:
getHelpFile
in classDiceButton
- Returns:
- a HelpFile describing how to use and configure * this component
-
getFormattedStringList
- Specified by:
getFormattedStringList
in interfaceSearchTarget
- Overrides:
getFormattedStringList
in classAbstractConfigurable
- 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:
addLocalImageNames
in interfaceImageSearchTarget
- Overrides:
addLocalImageNames
in classDiceButton
- Parameters:
s
- Collection to add image names to
-