org.opa.core
Class OPAAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.opa.core.OPAAction
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable
Direct Known Subclasses:
ModuleInstallerAction, OPAContextSensitiveAction, OPAPanelAction, OPAShowContextHelpAction, OPAShowHelpAction, OPAShutdownAction, OPASystemOptionAction

public abstract class OPAAction
extends javax.swing.AbstractAction

This abstract class represents a response to a user initiated event. Modules register OPAAction classes with an instance of OPAActionManager. OPAActionManager is responsible for enabling/disabling all registered OPAActions in response to GUI focus changes. OPAActions are also used to build the application menubar, toolbars and popup menu. It is important that OPAAction classes be Singletons. That is, there should only ever be a single instance of the class in the JVM at any time. All requests for action will be directed to that instance. Therefore, OPAAction subclasses should provide a public static OPAAction getInstance() method. OPAAction is based on the Java Action API and the "Cookie" design pattern used by the Netbeans IDE (www.netbeans.org).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
OPAAction()
           
 
Method Summary
abstract  java.lang.Class getCookieInterface()
          Returns the OPACookie to be associated with this OPAAction.
abstract  java.lang.String getMenuPath()
          Returns a the preferred menu path for this events 'menu' agent.
abstract  java.lang.String getPosition()
          This is the priority level used by OPA when building the system menu.
abstract  boolean onMenubar()
          Add to application menubar?
abstract  boolean onPopup()
          Add to application popup menu?
abstract  boolean onToolbar()
          Add to application toolbar?
abstract  void setCookie(OPACookie cookieInstance)
          Adds an OPACookie instance to this action.
abstract  void setHelp(java.awt.Component c)
           
protected  void setIcon(javax.swing.Icon icon)
           
protected  void setName(java.lang.String name)
           
protected  void setToolTip(java.lang.String toolTip)
           
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Constructor Detail

OPAAction

public OPAAction()
Method Detail

onToolbar

public abstract boolean onToolbar()
Add to application toolbar?


onMenubar

public abstract boolean onMenubar()
Add to application menubar?


onPopup

public abstract boolean onPopup()
Add to application popup menu?


getMenuPath

public abstract java.lang.String getMenuPath()
Returns a the preferred menu path for this events 'menu' agent. This String is used by OPA to create the frame menus.


getPosition

public abstract java.lang.String getPosition()
This is the priority level used by OPA when building the system menu. This determines the final order of menubar items.


setHelp

public abstract void setHelp(java.awt.Component c)

getCookieInterface

public abstract java.lang.Class getCookieInterface()
Returns the OPACookie to be associated with this OPAAction. The OPACookie will be used by OPAActionManager to decide when to enable or disable this OPAAction. If this method returns null then this OPAAction will be enabled permanently.


setCookie

public abstract void setCookie(OPACookie cookieInstance)
Adds an OPACookie instance to this action. This is used by OPAActionManager instances ONLY when an OPAAction returns a Cookie Interface (when it is context sensitive). This OPACookie instance should be CHECKED by OPAAction implementations that it is the correct OPACookie type (eg OPADeleteCookie etc). OPAAction implementations can then use this instance to invoke actions on the GUI component with focus.


setName

protected void setName(java.lang.String name)

setToolTip

protected void setToolTip(java.lang.String toolTip)

setIcon

protected void setIcon(javax.swing.Icon icon)