com.guiseframework.model
Class DefaultActionModel

java.lang.Object
  extended by com.globalmentor.beans.BoundPropertyObject
      extended by com.guiseframework.model.AbstractModel
          extended by com.guiseframework.model.DefaultActionModel
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, ActionListenable, ActionModel, Model

public class DefaultActionModel
extends AbstractModel
implements ActionModel

A default implementation of an action model. If a subclass wants to perform some action, it should override action(int, int).

Author:
Garret Wilson

Field Summary
 
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
 
Fields inherited from interface com.guiseframework.model.Model
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE
 
Constructor Summary
DefaultActionModel()
           
 
Method Summary
protected  void action(int force, int option)
          Performs whatever is necessary.
 void addActionListener(ActionListener actionListener)
          Adds an action listener.
protected  void fireActionPerformed(ActionEvent actionEvent)
          Fires a given action event to all registered action listeners.
protected  void fireActionPerformed(int force, int option)
          Fires an action event to all registered action listeners.
 java.lang.Iterable<ActionListener> getActionListeners()
           
 void performAction()
          Performs the action with default force and default option.
 void performAction(int force, int option)
          Performs the action with the given force and option.
 void removeActionListener(ActionListener actionListener)
          Removes an action listener.
 
Methods inherited from class com.guiseframework.model.AbstractModel
getEventListenerManager, getPlainText
 
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
 

Constructor Detail

DefaultActionModel

public DefaultActionModel()
Method Detail

addActionListener

public void addActionListener(ActionListener actionListener)
Adds an action listener.

Specified by:
addActionListener in interface ActionListenable
Parameters:
actionListener - The action listener to add.

removeActionListener

public void removeActionListener(ActionListener actionListener)
Removes an action listener.

Specified by:
removeActionListener in interface ActionListenable
Parameters:
actionListener - The action listener to remove.

getActionListeners

public java.lang.Iterable<ActionListener> getActionListeners()
Specified by:
getActionListeners in interface ActionModel
Returns:
All registered action listeners.

performAction

public void performAction()
Performs the action with default force and default option. An ActionEvent is fired to all registered ActionListeners. This method delegates to performAction(int, int).

Specified by:
performAction in interface ActionModel

performAction

public void performAction(int force,
                          int option)
Performs the action with the given force and option. This implementation calls action(int, int) to perform the actual action. An ActionEvent is fired to all registered ActionListeners.

Specified by:
performAction in interface ActionModel
Parameters:
force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.

action

protected void action(int force,
                      int option)
Performs whatever is necessary. This method is guaranteed to be called before any action event is fired to any listeners. This version does nothing.

Parameters:
force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.

fireActionPerformed

protected void fireActionPerformed(int force,
                                   int option)
Fires an action event to all registered action listeners. This method delegates to fireActionPerformed(ActionEvent).

Parameters:
force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.
See Also:
ActionListener, ActionEvent

fireActionPerformed

protected void fireActionPerformed(ActionEvent actionEvent)
Fires a given action event to all registered action listeners.

Parameters:
actionEvent - The action event to fire.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.