Class 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
  • Constructor Details

    • ProxyActionPrototype

      public ProxyActionPrototype(ActionPrototype proxiedPrototype)
      Proxied prototype constructor.
      Parameters:
      proxiedPrototype - The prototype proxied by this prototype.
      Throws:
      NullPointerException - if the given proxied prototype is null is null.
  • Method Details

    • 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)
      Description copied from class: AbstractProxyPrototype
      Uninstalls listeners from a proxied prototype.
      Overrides:
      uninstallListeners in class AbstractProxyPrototype<ActionPrototype>
      Parameters:
      oldProxiedPrototype - The old proxied prototype.
    • installListeners

      protected void installListeners(ActionPrototype newProxiedPrototype)
      Description copied from class: AbstractProxyPrototype
      Installs listeners to a proxied prototype.
      Overrides:
      installListeners in class AbstractProxyPrototype<ActionPrototype>
      Parameters:
      newProxiedPrototype - The new proxied prototype.
    • addActionListener

      public void addActionListener(ActionListener actionListener)
      Description copied from interface: ActionListenable
      Adds an action listener.
      Specified by:
      addActionListener in interface ActionListenable
      Parameters:
      actionListener - The action listener to add.
    • removeActionListener

      public void removeActionListener(ActionListener actionListener)
      Description copied from interface: ActionListenable
      Removes an action listener.
      Specified by:
      removeActionListener in interface ActionListenable
      Parameters:
      actionListener - The action listener to remove.
    • getActionListeners

      public 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. An ActionEvent is fired to all registered ActionListeners.

      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 initiated 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:
    • fireActionPerformed

      protected void fireActionPerformed(ActionEvent actionEvent)
      Fires a given action event to all registered action listeners.
      Parameters:
      actionEvent - The action event to fire.