de.matthiasmann.twl.model
Class ToggleButtonModel

java.lang.Object
  extended by de.matthiasmann.twl.model.SimpleButtonModel
      extended by de.matthiasmann.twl.model.ToggleButtonModel
All Implemented Interfaces:
ButtonModel

public class ToggleButtonModel
extends SimpleButtonModel

A toggle button model based on SimpleButtonModel. Adds selected state bit. Can be backed by a BooleanModel.


Field Summary
protected static int STATE_MASK_SELECTED
           
 
Fields inherited from class de.matthiasmann.twl.model.SimpleButtonModel
actionCallbacks, state, STATE_MASK_ARMED, STATE_MASK_DISABLED, STATE_MASK_HOVER, STATE_MASK_PRESSED, stateCallbacks
 
Constructor Summary
ToggleButtonModel()
           
ToggleButtonModel(BooleanModel model)
           
ToggleButtonModel(BooleanModel model, boolean invertModelState)
           
 
Method Summary
protected  void buttonAction()
           
 void connect()
          Called when the Button is placed in the GUI tree.
 void disconnect()
          Called when the Button is no longer part of the GUI tree.
 BooleanModel getModel()
           
 boolean isInvertModelState()
           
 boolean isSelected()
           
 void setModel(BooleanModel model)
           
 void setModel(BooleanModel model, boolean invertModelState)
           
 void setSelected(boolean selected)
           
 
Methods inherited from class de.matthiasmann.twl.model.SimpleButtonModel
addActionCallback, addStateCallback, fireActionCallback, fireStateCallback, hasActionCallbacks, isArmed, isEnabled, isHover, isPressed, removeActionCallback, removeStateCallback, setArmed, setEnabled, setHover, setPressed, setStateBit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_MASK_SELECTED

protected static final int STATE_MASK_SELECTED
See Also:
Constant Field Values
Constructor Detail

ToggleButtonModel

public ToggleButtonModel()

ToggleButtonModel

public ToggleButtonModel(BooleanModel model)

ToggleButtonModel

public ToggleButtonModel(BooleanModel model,
                         boolean invertModelState)
Method Detail

isSelected

public boolean isSelected()
Specified by:
isSelected in interface ButtonModel
Overrides:
isSelected in class SimpleButtonModel

setSelected

public void setSelected(boolean selected)
Specified by:
setSelected in interface ButtonModel
Overrides:
setSelected in class SimpleButtonModel

buttonAction

protected void buttonAction()
Overrides:
buttonAction in class SimpleButtonModel

getModel

public BooleanModel getModel()

setModel

public void setModel(BooleanModel model)

setModel

public void setModel(BooleanModel model,
                     boolean invertModelState)

isInvertModelState

public boolean isInvertModelState()

connect

public void connect()
Description copied from interface: ButtonModel
Called when the Button is placed in the GUI tree. Callbacks to other models should only be installed after this call.

Specified by:
connect in interface ButtonModel
Overrides:
connect in class SimpleButtonModel

disconnect

public void disconnect()
Description copied from interface: ButtonModel
Called when the Button is no longer part of the GUI tree. Callbacks to other models should be removed.

Specified by:
disconnect in interface ButtonModel
Overrides:
disconnect in class SimpleButtonModel