etomica.action
Class ActionToggle

java.lang.Object
  extended by etomica.action.ActionToggle
All Implemented Interfaces:
IAction, Serializable

public class ActionToggle
extends Object
implements IAction, Serializable

Action that toggles a boolean value. This action can connect to any object capable of switching between two states. The action operates through a ModifierBoolean instance that must be connected to the state of the controlled object.

See Also:
Serialized Form

Constructor Summary
ActionToggle(ModifierBoolean modifier)
           
ActionToggle(ModifierBoolean modifier, String trueText, String falseText)
           
 
Method Summary
 void actionPerformed()
          Toggles the state of the target object (true to false, false to true).
static EtomicaInfo getEtomicaInfo()
           
 String getFalseLabel()
           
 String getLabel()
          Returns the true or false label, depending on the current state of the toggle.
 ModifierBoolean getModifier()
          Returns the boolean modifier used by this action.
 String getTrueLabel()
           
 void setFalseLabel(String text)
          Specifies the button's label when the toggle is set to false.
 void setModifier(ModifierBoolean newModifier)
          Specifies the boolean modifier that is set between true and false by the action.
 void setTrueLabel(String text)
          Specifies the button's label when the toggle is set to true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionToggle

public ActionToggle(ModifierBoolean modifier)

ActionToggle

public ActionToggle(ModifierBoolean modifier,
                    String trueText,
                    String falseText)
Method Detail

actionPerformed

public void actionPerformed()
Toggles the state of the target object (true to false, false to true).

Specified by:
actionPerformed in interface IAction

getEtomicaInfo

public static EtomicaInfo getEtomicaInfo()

getModifier

public ModifierBoolean getModifier()
Returns the boolean modifier used by this action.


setModifier

public void setModifier(ModifierBoolean newModifier)
Specifies the boolean modifier that is set between true and false by the action.


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.

getLabel

public String getLabel()
Returns the true or false label, depending on the current state of the toggle.