MAEPlugin
Class MAEPlugin

java.lang.Object
  |
  +--MAEPlugin.MAEPlugin
All Implemented Interfaces:
PluginStub
Direct Known Subclasses:
CheckBoxMenuPlugin, MenuPlugin

public abstract class MAEPlugin
extends java.lang.Object
implements PluginStub

This abstract class defines the base MAEPlugin base class. Created on September 5, 2001, 5:26 PM

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/03/03 16:21:30 $ / $Revision: 1.5 $
Author:
Jai Evans (DECA/CIT), C. Santos (DECA/CIT), P. Lemkin (NCI-FCRDC)
See Also:
MAExplorer Home, MaeJavaAPI, MAEStub

Field Summary
static boolean DBUG_MAEP
           
protected  JarResources jarResources
          access to the jar file for loading support files
static int registryMaxSize
          Set the initial and max size for the number of resgistry entries
 
Fields inherited from interface MAEPlugin.PluginStub
PLUGIN_VERSION
 
Constructor Summary
MAEPlugin()
          MAEPlugin() - This private constructor prevents non-labeled and registered plugins
MAEPlugin(java.lang.String menuLabel)
          MAEPlugin() - Constructor registers the plugin and sets up menu item.
MAEPlugin(java.lang.String menuLabel, java.lang.String pluginFileName)
          MAEPlugin() - Constructor registers the plugin and sets up menu item.
 
Method Summary
 boolean getFlag()
          getFlag() - get the menu status (CheckBox) menuFlag
 MAEPlugin getInstance()
          getInstance() - returns Registry instance of this class or new if not loaded
 MAEStub getMAEStub()
          getMAEStub() - get the menu stub for this instance of plugin
 java.awt.MenuItem getMenuHook()
          getMenuHook() - get menu Item hook to put our instance of plugin
 java.lang.String getMenuInsertionPointName()
          getMenuInsertionPointName() - get the name of menu insertion point If it is not defined, then it returns null that indicates the Plugins menu.
 java.awt.MenuItem getMenuItem()
          getMenuItem() - get menu item for this instance of the plugin
static int getNumberPlugins()
          getNumberPlugins() - get the number of plugins (loaded).
 java.lang.String getPluginDescription()
          getPluginDescription() - returns a human readable description of the Plugin if any is defined by the plugin writer.
 java.lang.String getPluginFileName()
          getPluginFileName() - returns the plugin file name without the ".jar"
 java.lang.String getPluginName()
          getPluginName() - This is the human readable name for use in menu labels
static java.util.Enumeration getPlugins()
          getPlugins() - gets Registry list of MAEPlugins
 void menuActivated()
          menuActivated() - this method calls the pluginMain() method in GUI contexts.
 void pluginHalt()
          pluginHalt() - Plugin halt method.
 void pluginInit()
          pluginInit() - Plugin init method.
abstract  void pluginMain()
          pluginMain() - abstract method end-users must implement to use the API.
protected static boolean removePlugin(MAEPlugin o)
          removePlugin () - unloads plugin and removes it from the MAexplorer menu.
 void setFlag(boolean b)
          setFlag() - set the menu status (CheckBox) menuFlag
 void setJarResources(JarResources obj)
          setJarResources() - sets the JarResources object to get to the contents of the Jar object.
 void setMAEStub(MAEStub obj)
          setMAEStub() - get the menu stub for this instance of plugin
 void setMenuHook(java.awt.MenuItem mi)
          setMenuHook() - set menu Item hook to put our instance of plugin
 void setMenuInsertionPointName(java.lang.String menuInsertionPointName)
          setMenuInsertionPointName() - set the name of menu insertion point.
 void setMenuItem(java.awt.MenuItem menuItem)
          setMenuItem() - get menu item for this instance of the plugin
protected  void setMenuLabel(java.lang.String s)
          setMenuLabel() - changes the label on the mennItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBUG_MAEP

public static final boolean DBUG_MAEP

registryMaxSize

public static final int registryMaxSize
Set the initial and max size for the number of resgistry entries

jarResources

protected JarResources jarResources
access to the jar file for loading support files
Constructor Detail

MAEPlugin

public MAEPlugin()
MAEPlugin() - This private constructor prevents non-labeled and registered plugins

MAEPlugin

public MAEPlugin(java.lang.String menuLabel)
MAEPlugin() - Constructor registers the plugin and sets up menu item.
Parameters:
menuLabel - name of the plugin that will be used as MAExplorer menu item.

MAEPlugin

public MAEPlugin(java.lang.String menuLabel,
                 java.lang.String pluginFileName)
MAEPlugin() - Constructor registers the plugin and sets up menu item.
Parameters:
menuLabel - name of the plugin that will be used as MAExplorer menu item.
pluginFileName - name of the plugin without the ".jar"
Method Detail

getInstance

public final MAEPlugin getInstance()
                            throws PluginException,
                                   java.lang.InstantiationException,
                                   java.lang.IllegalAccessException
getInstance() - returns Registry instance of this class or new if not loaded
Returns:
instance of MAEPlugin
Throws:
PluginException, -  
java.lang.InstantiationException -  
java.lang.IllegalAccessException -  

removePlugin

protected static final boolean removePlugin(MAEPlugin o)
removePlugin () - unloads plugin and removes it from the MAexplorer menu.
Parameters:
o - plugin object to be removed
Returns:
true if succeed.
See Also:
pluginHalt()

getNumberPlugins

public static final int getNumberPlugins()
getNumberPlugins() - get the number of plugins (loaded).

getPlugins

public static final java.util.Enumeration getPlugins()
getPlugins() - gets Registry list of MAEPlugins
Returns:
enumeration list of MAEPlugins

getMAEStub

public final MAEStub getMAEStub()
getMAEStub() - get the menu stub for this instance of plugin
Returns:
the MAEstub for this MAEPlugin

setMAEStub

public final void setMAEStub(MAEStub obj)
setMAEStub() - get the menu stub for this instance of plugin
Parameters:
obj - MAEstub to be registered for this MAEPlugin

getMenuItem

public final java.awt.MenuItem getMenuItem()
getMenuItem() - get menu item for this instance of the plugin
Returns:
menu item for this MAEplugin

setMenuItem

public final void setMenuItem(java.awt.MenuItem menuItem)
setMenuItem() - get menu item for this instance of the plugin
Parameters:
menuItem - to be assigned for this MAEPlugin

getMenuHook

public final java.awt.MenuItem getMenuHook()
getMenuHook() - get menu Item hook to put our instance of plugin
Returns:
menu item hook for this MAEPlugin

setMenuHook

public final void setMenuHook(java.awt.MenuItem mi)
setMenuHook() - set menu Item hook to put our instance of plugin
Parameters:
mi - is the menu item hook to be assigned for this MAEPlugin

setFlag

public final void setFlag(boolean b)
setFlag() - set the menu status (CheckBox) menuFlag
Parameters:
b - is the status to be assigned

getFlag

public final boolean getFlag()
getFlag() - get the menu status (CheckBox) menuFlag
Returns:
the status to be assigned

menuActivated

public final void menuActivated()
menuActivated() - this method calls the pluginMain() method in GUI contexts.
Specified by:
menuActivated in interface PluginStub

pluginInit

public void pluginInit()
pluginInit() - Plugin init method. Code to initialize the plugin at plugin Load goes here when it is installed in the menu. The plugin writer may override this with their own method.
Specified by:
pluginInit in interface PluginStub

pluginMain

public abstract void pluginMain()
pluginMain() - abstract method end-users must implement to use the API. It is called when the plugin is started from the menu. The plugin writer may override this with their own method.
Specified by:
pluginMain in interface PluginStub

pluginHalt

public void pluginHalt()
pluginHalt() - Plugin halt method. Code to execute if plugin in disabled when the plugin is Unloaded - not when it is closed. The plugin writer may override this with their own method.
Specified by:
pluginHalt in interface PluginStub

getMenuInsertionPointName

public java.lang.String getMenuInsertionPointName()
getMenuInsertionPointName() - get the name of menu insertion point If it is not defined, then it returns null that indicates the Plugins menu.
Returns:
the menu Insertion Point name

setMenuInsertionPointName

public void setMenuInsertionPointName(java.lang.String menuInsertionPointName)
setMenuInsertionPointName() - set the name of menu insertion point.
[NOT FULLY IMPLEMENTED]
List of acceptable Menu stub names for: PluginMenuStubName (When enabled), you will be able to insert plugins into specified parts of the MAExplorer menu. If the menu stub is not found, it will install them in the generic "Plugin" pull-down menu.
Parameters:
menuInsertionPointName -  

getPluginName

public java.lang.String getPluginName()
getPluginName() - This is the human readable name for use in menu labels
Specified by:
getPluginName in interface PluginStub
Returns:
the plugInName.

getPluginFileName

public java.lang.String getPluginFileName()
getPluginFileName() - returns the plugin file name without the ".jar"
Specified by:
getPluginFileName in interface PluginStub
Returns:
the plugInFileName.

getPluginDescription

public java.lang.String getPluginDescription()
getPluginDescription() - returns a human readable description of the Plugin if any is defined by the plugin writer.
Specified by:
getPluginDescription in interface PluginStub
Returns:
the plugin description.

setMenuLabel

protected final void setMenuLabel(java.lang.String s)
setMenuLabel() - changes the label on the mennItem
Parameters:
s - is the new menu item label

setJarResources

public final void setJarResources(JarResources obj)
setJarResources() - sets the JarResources object to get to the contents of the Jar object.
Parameters:
obj - is the jarResources to set.