OME
Class AbstractPluginMethod

java.lang.Object
  |
  +--OME.AbstractPluginMethod
Direct Known Subclasses:
CreateElementMethod, CreateLinkMethod, MenuMethod, MenuSeparatorMethod, ObjectMethod, PopupMenuSeparatorMethod

public abstract class AbstractPluginMethod
extends java.lang.Object
implements PluginMethod

This class is an adapter class that implements all the methods in the PluginMethod interface as no-op's and that also includes a list of the supported parameter types as static fields.

This class exists as a convenience so that classes wishing to implement the PluginMethod interface can instead extend this class and override the methods of interest. (If one implements the PluginMethod interface, one has to define all of the methods in it. This adapter class defines no-op methods for them all, so that one need only define the methods one cares about).

See Also:
PluginMethod

Constructor Summary
AbstractPluginMethod()
           
 
Method Summary
 void cancelled()
          Cancel this PluginMethod.
 java.awt.Image getImage()
          Return Image associated with this PluginMethod.
 java.lang.String getName()
          Return name of this PluginMethod.
 java.util.Collection getSubmenu()
          Return the collection of PluginMethods that will constitute the submenu of this PluginMethod.
 java.util.Collection getSubmenu(ViewContext ovc)
          Return the collection of PluginMethods that will constitute the submenu of this PluginMethod, depending on the view context.
 void invoke()
          Execute this PluginMethod.
 boolean isEnabled(ViewContext con)
          Returns whether this PluginMethod should be enabled given the specified view context.
 PluginParameter nextParameter()
          Returns the next parameter to be used when this PluginMethod is invoked.
 void passParameter(java.util.Collection c)
          Passes a parameter (as a singleton Collection) to this PluginMethod.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPluginMethod

public AbstractPluginMethod()
Method Detail

getImage

public java.awt.Image getImage()
Return Image associated with this PluginMethod.
Specified by:
getImage in interface PluginMethod

getName

public java.lang.String getName()
Return name of this PluginMethod.
Specified by:
getName in interface PluginMethod

getSubmenu

public java.util.Collection getSubmenu(ViewContext ovc)
Return the collection of PluginMethods that will constitute the submenu of this PluginMethod, depending on the view context. This is only valid if this PluginMethod is used to implement a submenu. Otherwise this should return null. The ViewContext is provided so the submenu may be dynamically populated.
Specified by:
getSubmenu in interface PluginMethod
Parameters:
ovc - the view context for which we want the submenu

getSubmenu

public java.util.Collection getSubmenu()
Return the collection of PluginMethods that will constitute the submenu of this PluginMethod. This is only valid if this PluginMethod is used to implement a submenu. Otherwise this should return null.
Specified by:
getSubmenu in interface PluginMethod

nextParameter

public PluginParameter nextParameter()
Returns the next parameter to be used when this PluginMethod is invoked.
Specified by:
nextParameter in interface PluginMethod

passParameter

public void passParameter(java.util.Collection c)
Passes a parameter (as a singleton Collection) to this PluginMethod.
Specified by:
passParameter in interface PluginMethod
Parameters:
c - a singleton Collection containing the parameter to be passed to this PluginMethod.

invoke

public void invoke()
Execute this PluginMethod. This is analogous to the actionPerformed method in ActionListener's.
Specified by:
invoke in interface PluginMethod

cancelled

public void cancelled()
Cancel this PluginMethod. This method should do any neccessary clean up and exit the PluginMethod gracefully.
Specified by:
cancelled in interface PluginMethod

isEnabled

public boolean isEnabled(ViewContext con)
Returns whether this PluginMethod should be enabled given the specified view context.
Specified by:
isEnabled in interface PluginMethod
Parameters:
con - the ViewContext for which this PluginMethod is called.