etomica.graphics
Class DeviceToggleButton

java.lang.Object
  extended by etomica.graphics.Device
      extended by etomica.graphics.DeviceButton
          extended by etomica.graphics.DeviceToggleButton
All Implemented Interfaces:
GraphicalElement, Dimensioned

public class DeviceToggleButton
extends DeviceButton

Button that toggles a boolean value. This device can connect to any object capable of switching between two states. The device operates through a ModifierBoolean instance that must be connected to the state of the controlled object. Action is performed through the controller if given at construction or set afterwards.


Nested Class Summary
 
Nested classes/interfaces inherited from class etomica.graphics.Device
Device.ActionSet
 
Field Summary
protected  ActionToggle toggleAction
           
 
Fields inherited from class etomica.graphics.DeviceButton
button, targetAction
 
Fields inherited from class etomica.graphics.Device
controller, unit
 
Constructor Summary
DeviceToggleButton(IController controller)
           
DeviceToggleButton(IController controller, ModifierBoolean modifier)
           
DeviceToggleButton(IController controller, ModifierBoolean modifier, String trueText, String falseText)
           
 
Method Summary
static EtomicaInfo getEtomicaInfo()
           
 String getFalseLabel()
           
 boolean getState()
          Returns the current true/false state of the button.
 String getTrueLabel()
           
static void main(String[] args)
          Method to demonstrate and test the use of this class.
 void setFalseLabel(String text)
          Specifies the button's label when the toggle is set to false.
 void setModifier(ModifierBoolean modifier, String trueText, String falseText)
           
 void setState(boolean b)
          Toggles the button to the given state.
 void setTrueLabel(String text)
          Specifies the button's label when the toggle is set to true.
 
Methods inherited from class etomica.graphics.DeviceButton
getAction, getButton, getLabel, graphic, press, setAction, setLabel
 
Methods inherited from class etomica.graphics.Device
doAction, getController, getDimension, getPostAction, getPreAction, getUnit, graphic, setController, setPostAction, setPreAction, setUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toggleAction

protected ActionToggle toggleAction
Constructor Detail

DeviceToggleButton

public DeviceToggleButton(IController controller)

DeviceToggleButton

public DeviceToggleButton(IController controller,
                          ModifierBoolean modifier)

DeviceToggleButton

public DeviceToggleButton(IController controller,
                          ModifierBoolean modifier,
                          String trueText,
                          String falseText)
Method Detail

getEtomicaInfo

public static EtomicaInfo getEtomicaInfo()

setModifier

public void setModifier(ModifierBoolean modifier,
                        String trueText,
                        String falseText)

setState

public void setState(boolean b)
Toggles the button to the given state. No action is performed if the button is already in the given state.


getState

public boolean getState()
Returns the current true/false state of the button.


setTrueLabel

public void setTrueLabel(String text)
Specifies the button's label when the toggle is set to true.


getTrueLabel

public String getTrueLabel()
Returns:
the label displayed when the toggle is set to true.

setFalseLabel

public void setFalseLabel(String text)
Specifies the button's label when the toggle is set to false.


getFalseLabel

public String getFalseLabel()
Returns:
the label displayed when the toggle is set to false.

main

public static void main(String[] args)
Method to demonstrate and test the use of this class. Slider is used to control the temperature of a hard-sphere MD simulation