Draw2D v2.0

org.eclipse.draw2d
Class ButtonModel

java.lang.Object
  |
  +--org.eclipse.draw2d.ButtonModel
Direct Known Subclasses:
ToggleModel

public class ButtonModel
extends Object

A model for buttons.


Field Summary
protected  String actionName
           
protected static int ARMED_FLAG
           
static String ARMED_PROPERTY
          Deprecated. This property will soon disappear since it is simply defined by (isPressed() & isRollover())
static int DEFAULT_FIRING_BEHAVIOR
           
protected static int ENABLED_FLAG
           
static String ENABLED_PROPERTY
           
protected  org.eclipse.draw2d.ButtonStateTransitionListener firingBehavior
           
protected  ButtonGroup group
           
protected static int MAX_FLAG
           
protected static int MOUSEOVER_FLAG
           
static String MOUSEOVER_PROPERTY
           
protected static int PRESSED_FLAG
           
static String PRESSED_PROPERTY
           
static int REPEAT_FIRING_BEHAVIOR
           
protected static int ROLLOVER_ENABLED_FLAG
           
static String ROLLOVER_ENABLED_PROPERTY
           
protected static int SELECTED_FLAG
           
static String SELECTED_PROPERTY
           
 
Constructor Summary
ButtonModel()
           
 
Method Summary
 void addActionListener(ActionListener listener)
          Registers the given listener as an ActionListener.
 void addChangeListener(ChangeListener listener)
          Registers the given listener as a ChangeListener.
 void addStateTransitionListener(org.eclipse.draw2d.ButtonStateTransitionListener listener)
          Registers the given listener as a ButtonStateTransitionListener.
protected  void fireActionPerformed()
          Notifies any ActionListeners on this ButtonModel that an action has been performed.
protected  void fireCanceled()
          Notifies any listening ButtonStateTransitionListener that the pressed state of this button has been cancelled.
protected  void firePressed()
          Notifies any listening ButtonStateTransitionListener that this button has been pressed.
protected  void fireReleased()
          Notifies any listening ButtonStateTransitionListener that this button has been released.
protected  void fireResume()
          Notifies any listening ButtonStateTransitionListeners that this button has resumed activity.
protected  void fireStateChanged(String property)
          Notifies any listening ChangeListeners that this button's state has changed.
protected  void fireSuspend()
          Notifies any listening ButtonStateTransitionListeners that this button has suspended activity.
 ButtonGroup getGroup()
          Returns the group to which this model belongs.
 Object getUserData()
          Returns an object representing user data.
protected  void installFiringBehavior()
          Sets the firing behavior for this button.
 boolean isArmed()
          Returns true if this button is armed.
 boolean isEnabled()
          Returns true if this button is enabled.
 boolean isMouseOver()
          Returns true if the mouse is over this button.
 boolean isPressed()
          Returns true if this button is pressed.
 boolean isSelected()
          Returns the selection state of this model.
 void removeActionListener(ActionListener listener)
          Removes the given ActionListener.
 void removeChangeListener(ChangeListener listener)
          Removes the given ChangeListener.
 void removeStateTransitionListener(org.eclipse.draw2d.ButtonStateTransitionListener listener)
          Removes the given ButtonStateTransitionListener.
 void setArmed(boolean value)
          Sets this button to be armed.
 void setEnabled(boolean value)
          Sets this button to be enabled.
 void setFiringBehavior(int type)
          Sets the firing behavior for this button.
 void setGroup(ButtonGroup bg)
          Sets the ButtonGroup to which this model belongs to.
 void setMouseOver(boolean value)
          Sets the mouseover property of this button.
protected  void setPressed(boolean value)
          Sets the pressed property of this button.
 void setSelected(boolean value)
          Sets this button to be selected.
 void setUserData(Object data)
          Sets user data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENABLED_PROPERTY

public static final String ENABLED_PROPERTY

PRESSED_PROPERTY

public static final String PRESSED_PROPERTY

SELECTED_PROPERTY

public static final String SELECTED_PROPERTY

ROLLOVER_ENABLED_PROPERTY

public static final String ROLLOVER_ENABLED_PROPERTY

MOUSEOVER_PROPERTY

public static final String MOUSEOVER_PROPERTY

ARMED_PROPERTY

public static final String ARMED_PROPERTY
Deprecated. This property will soon disappear since it is simply defined by (isPressed() & isRollover())


ARMED_FLAG

protected static final int ARMED_FLAG

PRESSED_FLAG

protected static final int PRESSED_FLAG

MOUSEOVER_FLAG

protected static final int MOUSEOVER_FLAG

SELECTED_FLAG

protected static final int SELECTED_FLAG

ENABLED_FLAG

protected static final int ENABLED_FLAG

ROLLOVER_ENABLED_FLAG

protected static final int ROLLOVER_ENABLED_FLAG

MAX_FLAG

protected static final int MAX_FLAG

DEFAULT_FIRING_BEHAVIOR

public static final int DEFAULT_FIRING_BEHAVIOR

REPEAT_FIRING_BEHAVIOR

public static final int REPEAT_FIRING_BEHAVIOR

actionName

protected String actionName

group

protected ButtonGroup group

firingBehavior

protected org.eclipse.draw2d.ButtonStateTransitionListener firingBehavior
Constructor Detail

ButtonModel

public ButtonModel()
Method Detail

addActionListener

public void addActionListener(ActionListener listener)
Registers the given listener as an ActionListener.
Since:
2.0

addChangeListener

public void addChangeListener(ChangeListener listener)
Registers the given listener as a ChangeListener.
Since:
2.0

addStateTransitionListener

public void addStateTransitionListener(org.eclipse.draw2d.ButtonStateTransitionListener listener)
Registers the given listener as a ButtonStateTransitionListener.
Since:
2.0

fireActionPerformed

protected void fireActionPerformed()
Notifies any ActionListeners on this ButtonModel that an action has been performed.
Since:
2.0

fireCanceled

protected void fireCanceled()
Notifies any listening ButtonStateTransitionListener that the pressed state of this button has been cancelled.
Since:
2.0

firePressed

protected void firePressed()
Notifies any listening ButtonStateTransitionListener that this button has been pressed.
Since:
2.0

fireReleased

protected void fireReleased()
Notifies any listening ButtonStateTransitionListener that this button has been released.
Since:
2.0

fireResume

protected void fireResume()
Notifies any listening ButtonStateTransitionListeners that this button has resumed activity.
Since:
2.0

fireStateChanged

protected void fireStateChanged(String property)
Notifies any listening ChangeListeners that this button's state has changed.
Since:
2.0

fireSuspend

protected void fireSuspend()
Notifies any listening ButtonStateTransitionListeners that this button has suspended activity.
Since:
2.0

getGroup

public ButtonGroup getGroup()
Returns the group to which this model belongs.
Since:
2.0

getUserData

public Object getUserData()
Returns an object representing user data.
Since:
2.0

installFiringBehavior

protected void installFiringBehavior()
Sets the firing behavior for this button.
Since:
2.0

isArmed

public boolean isArmed()
Returns true if this button is armed. If a button is armed, it will fire an ActionPerformed when released.
Since:
2.0

isEnabled

public boolean isEnabled()
Returns true if this button is enabled.
Since:
2.0

isMouseOver

public boolean isMouseOver()
Returns true if the mouse is over this button.
Since:
2.0

isPressed

public boolean isPressed()
Returns true if this button is pressed.
Since:
2.0

isSelected

public boolean isSelected()
Returns the selection state of this model. If this model belongs to any group, the group is queried for selection state, else the flags are used.
Returns:
The selection state of this model.
Since:
2.0

removeActionListener

public void removeActionListener(ActionListener listener)
Removes the given ActionListener.
Since:
2.0

removeChangeListener

public void removeChangeListener(ChangeListener listener)
Removes the given ChangeListener.
Since:
2.0

removeStateTransitionListener

public void removeStateTransitionListener(org.eclipse.draw2d.ButtonStateTransitionListener listener)
Removes the given ButtonStateTransitionListener.
Since:
2.0

setArmed

public void setArmed(boolean value)
Sets this button to be armed. If a button is armed, it will fire an ActionPerformed when released.
Since:
2.0

setEnabled

public void setEnabled(boolean value)
Sets this button to be enabled.
Since:
2.0

setFiringBehavior

public void setFiringBehavior(int type)
Sets the firing behavior for this button.
Parameters:
type - DEFAULT_FIRING_BEHAVIOR is the default behavior. Action performed events are not fired until mouse button is released. REPEAT_FIRING_BEHAVIOR causes action performed events to fire repeatedly until the mouse button is released.
Since:
2.0

setGroup

public void setGroup(ButtonGroup bg)
Sets the ButtonGroup to which this model belongs to. Adds this model as a listener to the group.
Parameters:
bg - Group to which this model belongs to.
Since:
2.0

setMouseOver

public void setMouseOver(boolean value)
Sets the mouseover property of this button.
Since:
2.0

setPressed

protected void setPressed(boolean value)
Sets the pressed property of this button.
Since:
2.0

setSelected

public void setSelected(boolean value)
Sets this button to be selected.
Since:
2.0

setUserData

public void setUserData(Object data)
Sets user data.
Since:
2.0

Draw2D v2.0