Package VASSAL.build.module
Class SpecialDiceButton
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.SpecialDiceButton
- All Implemented Interfaces:
AutoConfigurable,Buildable,Configurable,PropertyNameSource,CommandEncoder,ValidityChecker,Translatable,UniqueIdManager.Identifyable
public class SpecialDiceButton extends AbstractConfigurable implements CommandEncoder, UniqueIdManager.Identifyable
...
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpecialDiceButton.IconConfigstatic classSpecialDiceButton.ReportFormatConfigstatic classSpecialDiceButton.ShowResultsCommand for displaying the results of a roll of the diceNested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
Fields 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 Constructor Description SpecialDiceButton() -
Method Summary
Modifier and Type Method Description voidaddSpecialDie(SpecialDie d)voidaddTo(Buildable parent)Expects to be added to a SymbolDice.Commanddecode(String s)Translate a String into aCommandprotected voidDR()Forwards the result of the roll to theChatter.send(java.lang.String)method of theChatterof theGameModule.Stringencode(Command c)Translate aCommandinto a StringClass<?>[]getAllowableConfigureComponents()Return a list of valid sub-component Classes.String[]getAttributeDescriptions()Return an array of Strings describing the attributes of this object.String[]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.Class<?>[]getAttributeTypes()Return the Class for the buildFile (XML) attributes of this component.StringgetAttributeValueString(String key)Called by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML elementVisibilityConditiongetAttributeVisibility(String name)By default, all attributes are visiblestatic StringgetConfigureTypeName()HelpFilegetHelpFile()StringgetId()StringgetIdentifier()Make a best gues for a unique identifier for the target.List<String>getPropertyNames()Implement PropertyNameSource - Expose roll result propertyprotected StringgetReportPrefix()The text reported before the results of the rollprotected StringgetReportSuffix()Deprecated, for removal: This API element is subject to removal in a future version.Handled by Message Formatstatic StringintArrayToString(int[] ia)create String from int arrayvoidremoveFrom(Buildable b)Remove this component from its parentvoidremoveSpecialDie(SpecialDie d)voidsetAttribute(String key, Object o)Sets a buildFile (XML) attribute value for this component.protected voidsetFormat(int[] results)voidsetId(String id)static int[]stringToIntArray(String s)get int array from stringMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, getI18nData, getI18nPrefix, getLocalizedConfigureName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, validateMethods 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.tools.UniqueIdManager.Identifyable
getConfigureName
-
Field Details
-
idMgr
-
SHOW_RESULTS_COMMAND
- See Also:
- Constant Field Values
-
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
-
BUTTON_TEXT
- See Also:
- Constant Field Values
-
TOOLTIP
- See Also:
- Constant Field Values
-
NAME
- See Also:
- Constant Field Values
-
ICON
- See Also:
- Constant Field Values
-
RESULT_CHATTER
- See Also:
- Constant Field Values
-
CHAT_RESULT_FORMAT
- See Also:
- Constant Field Values
-
RESULT_N
- See Also:
- Constant Field Values
-
RESULT_TOTAL
- See Also:
- Constant Field Values
-
RESULT_WINDOW
- See Also:
- Constant Field Values
-
WINDOW_TITLE_RESULT_FORMAT
- See Also:
- Constant Field Values
-
RESULT_BUTTON
- See Also:
- Constant Field Values
-
WINDOW_X
- See Also:
- Constant Field Values
-
WINDOW_Y
- See Also:
- Constant Field Values
-
BACKGROUND_COLOR
- See Also:
- Constant Field Values
-
DICE_SET
- See Also:
- Constant Field Values
-
HOTKEY
- See Also:
- Constant Field Values
-
NONE
- See Also:
- Constant Field Values
-
-
Constructor Details
-
SpecialDiceButton
public SpecialDiceButton()
-
-
Method Details
-
getConfigureTypeName
-
getReportPrefix
The text reported before the results of the roll -
getReportSuffix
Deprecated, for removal: This API element is subject to removal in a future version.Handled by Message FormatThe text reported after 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- Specified by:
getAttributeNamesin classAbstractBuildable- Returns:
- a list of all buildFile (XML) attribute names for this component
-
getAttributeDescriptions
Description copied from interface:AutoConfigurableReturn 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:
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
Description copied from class:AbstractConfigurableReturn 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 ofAutoConfigurerwill 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 inAbstractBuildable.getAttributeNames()- Specified by:
getAttributeTypesin interfaceAutoConfigurable- Specified by:
getAttributeTypesin classAbstractConfigurable
-
getAttributeVisibility
Description copied from class:AbstractConfigurableBy default, all attributes are visible- Specified by:
getAttributeVisibilityin interfaceAutoConfigurable- Overrides:
getAttributeVisibilityin classAbstractConfigurable- 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 -
removeFrom
Description copied from interface:ConfigurableRemove this component from its parent- Specified by:
removeFromin interfaceConfigurable
-
setId
- Specified by:
setIdin interfaceUniqueIdManager.Identifyable
-
getId
- Specified by:
getIdin interfaceUniqueIdManager.Identifyable
-
getIdentifier
Make a best gues for a unique identifier for the target. Useif non-null, otherwise use {@link VASSAL.tools.UniqueIdManager.Identifyable#getId- Parameters:
target-- Returns:
-
setAttribute
Description copied from class:AbstractBuildableSets a buildFile (XML) attribute value for this component. Thekeyparameter will be one of those listed inAbstractBuildable.getAttributeNames(). If thevalueparameter is a String, it will be the value returned byAbstractBuildable.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- Specified by:
setAttributein classAbstractBuildable- Parameters:
key- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()o- If thevalueparameter is a String, it will be the value returned byAbstractBuildable.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 interface:AutoConfigurableCalled by theBuildable.getBuildElement(org.w3c.dom.Document)method to write the attributes into an XML element- 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 inAbstractBuildable.getAttributeNames()- Returns:
- a String representation of the attribute with the given name. When initializing a module, this String value will be passed to
AbstractBuildable.setAttribute(java.lang.String, java.lang.Object).
-
getAllowableConfigureComponents
Description copied from interface:ConfigurableReturn 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 Configuration Window.- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- a HelpFilte 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 classAbstractBuildable- 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
-