VASSAL.build.module
Class SpecialDiceButton

java.lang.Object
  |
  +--VASSAL.build.AbstractBuildable
        |
        +--VASSAL.build.AbstractConfigurable
              |
              +--VASSAL.build.module.SpecialDiceButton
All Implemented Interfaces:
AutoConfigurable, Buildable, CommandEncoder, Configurable, UniqueIdManager.Identifyable, ValidityChecker

public class SpecialDiceButton
extends AbstractConfigurable
implements CommandEncoder, UniqueIdManager.Identifyable

...


Inner Class Summary
static class SpecialDiceButton.IconConfig
           
static class SpecialDiceButton.ReportFormatConfig
           
static class SpecialDiceButton.ShowResults
          Command for displaying the results of a roll of the dice
 
Inner classes inherited from class VASSAL.build.AutoConfigurable
AutoConfigurable.Util
 
Field Summary
static java.lang.String BACKGROUND_COLOR
           
static java.lang.String BUTTON_TEXT
           
static java.lang.String CHAT_RESULT_FORMAT
           
static java.lang.String DICE_SET
           
static java.lang.String HOTKEY
           
static java.lang.String ICON
           
protected  java.lang.String id
           
static java.lang.String NAME
           
static java.lang.String NONE
           
protected  java.util.Random ran
           
protected  boolean reportResultAsText
           
protected  boolean reportResultInButton
           
protected  boolean reportResultInWindow
           
static java.lang.String RESULT_BUTTON
           
static java.lang.String RESULT_CHATTER
           
static java.lang.String RESULT_N
           
static java.lang.String RESULT_TOTAL
           
static java.lang.String RESULT_WINDOW
           
static java.lang.String SHOW_RESULTS_COMMAND
           
protected  java.lang.String sMapName
           
static java.lang.String WINDOW_TITLE_RESULT_FORMAT
           
static java.lang.String WINDOW_X
           
static java.lang.String WINDOW_Y
           
 
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, name
 
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
 
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
 
Constructor Summary
SpecialDiceButton()
           
 
Method Summary
 void addSpecialDie(SpecialDie d)
           
 void addTo(Buildable parent)
          Expects to be added to a SymbolDice.
 Command decode(java.lang.String s)
          Translate a String into a Command
protected  void DR()
          Forwards the result of the roll to the Chatter.send(java.lang.String) method of the Chatter of the GameModule.
 java.lang.String encode(Command c)
          Translate a Command into a String
 java.lang.Class[] getAllowableConfigureComponents()
          Return a list of valid sub-component Classes.
 java.lang.String[] getAttributeDescriptions()
          Return an array of Strings describing the attributes of this object.
 java.lang.String[] getAttributeNames()
          The Attributes of a DiceButton are: BUTTON_TEXT the label of the button in the toolbar ICON the icon of the button in the toolbar HOTKEY the hotkey equivalent of the button DICE_SET list 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.
 java.lang.Class[] getAttributeTypes()
          Return the Class for the attributes of this object.
 java.lang.String getAttributeValueString(java.lang.String key)
          Called by the AbstractBuildable.getBuildElement(org.w3c.dom.Document) method to write the attributes into an XML element
 VisibilityCondition getAttributeVisibility(java.lang.String name)
          By default, all attributes are visible
static java.lang.String getConfigureTypeName()
           
 HelpFile getHelpFile()
           
 java.lang.String getId()
           
 java.lang.String getIdentifier()
          Make a best gues for a unique identifier for the target.
protected  java.lang.String getReportPrefix()
          The text reported before the results of the roll
protected  java.lang.String getReportSuffix()
          Deprecated.  
static java.lang.String intArrayToString(int[] ia)
          create String from int array
 void removeFrom(Buildable b)
          Remove this component from its parent
 void removeSpecialDie(SpecialDie d)
           
 void setAttribute(java.lang.String key, java.lang.Object o)
          Called by the AbstractBuildable.build(org.w3c.dom.Element) method, where value is the String value read by the XML attribute.
 void setId(java.lang.String id)
           
static int[] stringToIntArray(java.lang.String s)
          get int array from string
 
Methods inherited from class VASSAL.build.AbstractConfigurable
addPropertyChangeListener, getConfigureComponents, getConfigureName, getConfigurer, remove, setConfigureName
 
Methods inherited from class VASSAL.build.AbstractBuildable
add, build, getBuildComponents, getBuildElement, getComponents, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface VASSAL.tools.UniqueIdManager.Identifyable
getConfigureName
 
Methods inherited from interface VASSAL.build.Buildable
add, build, getBuildElement
 

Field Detail

SHOW_RESULTS_COMMAND

public static final java.lang.String SHOW_RESULTS_COMMAND

ran

protected java.util.Random ran

reportResultAsText

protected boolean reportResultAsText

reportResultInWindow

protected boolean reportResultInWindow

reportResultInButton

protected boolean reportResultInButton

id

protected java.lang.String id

sMapName

protected java.lang.String sMapName

BUTTON_TEXT

public static final java.lang.String BUTTON_TEXT

NAME

public static final java.lang.String NAME

ICON

public static final java.lang.String ICON

RESULT_CHATTER

public static final java.lang.String RESULT_CHATTER

CHAT_RESULT_FORMAT

public static final java.lang.String CHAT_RESULT_FORMAT

RESULT_N

public static final java.lang.String RESULT_N

RESULT_TOTAL

public static final java.lang.String RESULT_TOTAL

RESULT_WINDOW

public static final java.lang.String RESULT_WINDOW

WINDOW_TITLE_RESULT_FORMAT

public static final java.lang.String WINDOW_TITLE_RESULT_FORMAT

RESULT_BUTTON

public static final java.lang.String RESULT_BUTTON

WINDOW_X

public static final java.lang.String WINDOW_X

WINDOW_Y

public static final java.lang.String WINDOW_Y

BACKGROUND_COLOR

public static final java.lang.String BACKGROUND_COLOR

DICE_SET

public static final java.lang.String DICE_SET

HOTKEY

public static final java.lang.String HOTKEY

NONE

public static final java.lang.String NONE
Constructor Detail

SpecialDiceButton

public SpecialDiceButton()
Method Detail

getConfigureTypeName

public static java.lang.String getConfigureTypeName()

getReportPrefix

protected java.lang.String getReportPrefix()
The text reported before the results of the roll

getReportSuffix

protected java.lang.String getReportSuffix()
Deprecated.  

The text reported after the results of the roll;

DR

protected void DR()
Forwards the result of the roll to the Chatter.send(java.lang.String) method of the Chatter of the GameModule. Format is prefix+[comma-separated roll list]+suffix additionally a command for every die is generated

getAttributeNames

public java.lang.String[] getAttributeNames()
The Attributes of a DiceButton are: BUTTON_TEXT the label of the button in the toolbar ICON the icon of the button in the toolbar HOTKEY the hotkey equivalent of the button DICE_SET list 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) NUMERIC result of all dice is numeric REPORT_TOTAL If numeric and true, add the results of the dice together and report the total. Otherwise, report the individual results SORT if true sort results per die by numeric value RESULT_CHATTER if true report results in chatter RESULT_WINDOW if true show result graphical in extra window WINDOW_X width of window or button WINDOW_Y height of window or button RESULT_MAP :TODO: if true show result in special area in map MAP_NAME :TODO: name of map RESULT_BUTTON if true show result graphical in button
Overrides:
getAttributeNames in class AbstractBuildable
Following copied from interface: VASSAL.build.AutoConfigurable
Returns:
an array of Strings giving all attributes of this Buildable component that will be written to/read from an XML element

getAttributeDescriptions

public java.lang.String[] getAttributeDescriptions()
Description copied from class: AbstractConfigurable
Return an array of Strings describing the attributes of this object. These strings are used as prompts in the Properties window for this object. The order of descriptions should be the same as the order of names in AbstractBuildable.getAttributeNames()
Overrides:
getAttributeDescriptions in class AbstractConfigurable

getAttributeTypes

public java.lang.Class[] getAttributeTypes()
Description copied from class: AbstractConfigurable
Return the Class for the attributes of this object. Valid classes are: String, Integer, Double, Boolean, Image, Color, and KeyStroke The order of classes should be the same as the order of names in AbstractBuildable.getAttributeNames()
Overrides:
getAttributeTypes in class AbstractConfigurable

getAttributeVisibility

public VisibilityCondition getAttributeVisibility(java.lang.String name)
Description copied from class: AbstractConfigurable
By default, all attributes are visible
Overrides:
getAttributeVisibility in class AbstractConfigurable
Following copied from class: VASSAL.build.AbstractConfigurable
Parameters:
name -  
Returns:
 

addSpecialDie

public void addSpecialDie(SpecialDie d)

removeSpecialDie

public void removeSpecialDie(SpecialDie d)

addTo

public void addTo(Buildable parent)
Expects to be added to a SymbolDice. Adds the button to the control window's toolbar and registers itself as a KeyStrokeListener

removeFrom

public void removeFrom(Buildable b)
Description copied from interface: Configurable
Remove this component from its parent

setId

public void setId(java.lang.String id)
Specified by:
setId in interface UniqueIdManager.Identifyable

getId

public java.lang.String getId()
Specified by:
getId in interface UniqueIdManager.Identifyable

getIdentifier

public java.lang.String getIdentifier()
Make a best gues for a unique identifier for the target. Use VASSAL.tools.UniqueIdManager.Identifyable#getConfigureName if non-null, otherwise use {@link VASSAL.tools.UniqueIdManager.Identifyable#getId
Parameters:
target -  
Returns:
 

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object o)
Description copied from interface: AutoConfigurable
Called by the Buildable.build(org.w3c.dom.Element) method, where value is the String value read by the XML attribute. Can also be called with Object value to set the attribute.
Overrides:
setAttribute in class AbstractBuildable
Following copied from class: VASSAL.build.AbstractBuildable
Parameters:
key - the name of the attribute. Will be one of those listed in AbstractBuildable.getAttributeNames()

getAttributeValueString

public java.lang.String getAttributeValueString(java.lang.String key)
Description copied from interface: AutoConfigurable
Called by the Buildable.getBuildElement(org.w3c.dom.Document) method to write the attributes into an XML element
Overrides:
getAttributeValueString in class AbstractBuildable
Following copied from class: VASSAL.build.AbstractBuildable
Parameters:
key - the name of the attribute. Will be one of those listed in AbstractBuildable.getAttributeNames()

getAllowableConfigureComponents

public java.lang.Class[] getAllowableConfigureComponents()
Description copied from interface: Configurable
Return 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.

getHelpFile

public HelpFile getHelpFile()
Following copied from interface: VASSAL.build.Configurable
Returns:
a HelpFilte describing how to use and configure this component

intArrayToString

public static java.lang.String intArrayToString(int[] ia)
create String from int array
Parameters:
ia - int-array
Returns:
encoded String

stringToIntArray

public static int[] stringToIntArray(java.lang.String s)
get int array from string
Parameters:
s - string with encoded int array
Returns:
int array

encode

public java.lang.String encode(Command c)
Description copied from interface: CommandEncoder
Translate a Command into a String
Specified by:
encode in interface CommandEncoder

decode

public Command decode(java.lang.String s)
Description copied from interface: CommandEncoder
Translate a String into a Command
Specified by:
decode in interface CommandEncoder