com.guiseframework.prototype
Class ProxyActionPrototype

java.lang.Object
  extended by com.globalmentor.beans.BoundPropertyObject
      extended by com.guiseframework.model.AbstractModel
          extended by com.guiseframework.prototype.AbstractProxyPrototype<P>
              extended by com.guiseframework.prototype.AbstractEnableableProxyPrototype<ActionPrototype>
                  extended by com.guiseframework.prototype.ProxyActionPrototype
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, ActionListenable, ActionModel, Enableable, InfoModel, LabelModel, Model, ActionPrototype, Prototype

public class ProxyActionPrototype
extends AbstractEnableableProxyPrototype<ActionPrototype>
implements ActionPrototype

An action prototype that is a proxy for another action prototype.

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.Enableable
ENABLED_PROPERTY
 
Fields inherited from interface com.guiseframework.model.InfoModel
DESCRIPTION_CONTENT_TYPE_PROPERTY, DESCRIPTION_PROPERTY, INFO_CONTENT_TYPE_PROPERTY, INFO_PROPERTY
 
Fields inherited from interface com.guiseframework.model.LabelModel
GLYPH_URI_PROPERTY, LABEL_CONTENT_TYPE_PROPERTY, LABEL_PROPERTY
 
Fields inherited from interface com.guiseframework.model.Model
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE
 
Constructor Summary
ProxyActionPrototype(ActionPrototype proxiedPrototype)
          Proxied prototype constructor.
 
Method Summary
 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()
           
protected  ActionListener getRepeatActionListener()
           
protected  void installListeners(ActionPrototype newProxiedPrototype)
          Installs listeners to a proxied prototype.
 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.
protected  void uninstallListeners(ActionPrototype oldProxiedPrototype)
          Uninstalls listeners from a proxied prototype.
 
Methods inherited from class com.guiseframework.prototype.AbstractEnableableProxyPrototype
fireProxiedPrototypeBoundPropertyChanges, isEnabled, setEnabled
 
Methods inherited from class com.guiseframework.prototype.AbstractProxyPrototype
getDescription, getDescriptionContentType, getGlyphURI, getInfo, getInfoContentType, getLabel, getLabelContentType, getProxiedPrototype, setDescription, setDescriptionContentType, setGlyphURI, setInfo, setInfoContentType, setLabel, setLabelContentType, setProxiedPrototype
 
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.guiseframework.model.Enableable
isEnabled, setEnabled
 
Methods inherited from interface com.guiseframework.model.InfoModel
getDescription, getDescriptionContentType, getInfo, getInfoContentType, setDescription, setDescriptionContentType, setInfo, setInfoContentType
 
Methods inherited from interface com.guiseframework.model.LabelModel
getGlyphURI, getLabel, getLabelContentType, setGlyphURI, setLabel, setLabelContentType
 
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
 

Constructor Detail

ProxyActionPrototype

public ProxyActionPrototype(ActionPrototype proxiedPrototype)
Proxied prototype constructor.

Parameters:
proxiedPrototype - The prototype proxied by this prototype.
Throws:
java.lang.NullPointerException - if the given proxied prototype is null is null.
Method Detail

getRepeatActionListener

protected ActionListener getRepeatActionListener()
Returns:
An action listener to repeat copies of events received, using this object as the source.

uninstallListeners

protected void uninstallListeners(ActionPrototype oldProxiedPrototype)
Uninstalls listeners from a proxied prototype.

Overrides:
uninstallListeners in class AbstractProxyPrototype<ActionPrototype>
Parameters:
oldProxiedPrototype - The old proxied prototype.

installListeners

protected void installListeners(ActionPrototype newProxiedPrototype)
Installs listeners to a proxied prototype.

Overrides:
installListeners in class AbstractProxyPrototype<ActionPrototype>
Parameters:
newProxiedPrototype - The new proxied prototype.

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 ActionModel.performAction(int, int) on the proxied prototype to perform the actual action. An ActionEvent is not fired to registered ActionListeners; the proxied action prototype should fire such an event, which we will them repeat.

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.

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.