edu.iu.iv.common.plugin
Class BasicPlugin

java.lang.Object
  |
  +--edu.iu.iv.common.plugin.BasicPlugin
All Implemented Interfaces:
Plugin

public class BasicPlugin
extends java.lang.Object
implements Plugin

A basic implementation of the Plugin interface. Models for which an unsupported reason is not provided are given the default reason "Model not supported". This class provides a programmatic way of creating a plugin. The recommended way of creating a plugin, however is to make your own implementation of the Plugin interface.

Author:
Josh Bonner

Field Summary
static java.lang.String DEFAULT_UNSUPPORTED_REASON
           
 
Constructor Summary
BasicPlugin(java.lang.String description, java.lang.String menuPath, java.util.List supportedModels, java.util.Map unsupportedReasonMap, javax.swing.JInternalFrame view)
          Constructs a new BasicPlugin with the given information.
 
Method Summary
 java.lang.String getDefaultMenuPath()
          Gets this plugin's menu path, a "/"-delimited string which describes where in the GUI menu its menu item will be inserted.
 java.lang.String getDescription()
           
 javax.swing.Icon getMenuIcon()
          Gets the menu icon to be shown on the menu for this plugin.
 PropertyMap getPropertyMap()
          Gets the property map for this plugin which specifies additional properties of the plugin that can be gotten.
 javax.swing.JInternalFrame getView(java.lang.Object model)
          Returns a view of the data given.
 boolean supports(java.lang.Object model)
          Determines whether a model is supported by this plugin or not.
 java.lang.String unsupportedReason(java.lang.Object model)
          Retrieves the reason why a particular model is unsupported by this plugin.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_UNSUPPORTED_REASON

public static final java.lang.String DEFAULT_UNSUPPORTED_REASON
See Also:
Constant Field Values
Constructor Detail

BasicPlugin

public BasicPlugin(java.lang.String description,
                   java.lang.String menuPath,
                   java.util.List supportedModels,
                   java.util.Map unsupportedReasonMap,
                   javax.swing.JInternalFrame view)
Constructs a new BasicPlugin with the given information.

Parameters:
description - this plugin's description
menuPath - the path that creates a menu entry for the plugin in the GUI.
supportedModels - the models supported by this plugin
unsupportedReasonMap - reasons why models are unsupported
view - this plugin's view
Method Detail

getDefaultMenuPath

public java.lang.String getDefaultMenuPath()
Description copied from interface: Plugin
Gets this plugin's menu path, a "/"-delimited string which describes where in the GUI menu its menu item will be inserted. For example, "File/Save/To Database" places the menu item "To Database" in the "Save" submenu of the "File" top-level menu.

Specified by:
getDefaultMenuPath in interface Plugin
Returns:
this plugin's menu path
See Also:
edu.iu.iv.core.Plugin#getMenuPath()

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface Plugin
Returns:
a description of this plugin
See Also:
edu.iu.iv.core.Plugin#getDescription()

supports

public boolean supports(java.lang.Object model)
Description copied from interface: Plugin
Determines whether a model is supported by this plugin or not.

Specified by:
supports in interface Plugin
Parameters:
model - the model to check for support
Returns:
true if the given model is supported, false otherwise
See Also:
edu.iu.iv.core.Plugin#supports(java.lang.Object)

unsupportedReason

public java.lang.String unsupportedReason(java.lang.Object model)
Description copied from interface: Plugin
Retrieves the reason why a particular model is unsupported by this plugin.

Specified by:
unsupportedReason in interface Plugin
Parameters:
model - the model to look up a reason for
Returns:
the reason the given model is unsupported
See Also:
edu.iu.iv.core.Plugin#unsupportedReason(java.lang.Object)

getView

public javax.swing.JInternalFrame getView(java.lang.Object model)
Description copied from interface: Plugin
Returns a view of the data given. The model given, must be supported by the plugin. Some plugins may ignore the model given to it. You may return null if you wish for no interface to be shown (as is the case with some algorithms).

Specified by:
getView in interface Plugin
Parameters:
model - the model to get a view of or to be acted upon.
Returns:
a swing frame that can then be added to the IVC User Interface.
See Also:
edu.iu.iv.core.Plugin#getView(Object)

getMenuIcon

public javax.swing.Icon getMenuIcon()
Description copied from interface: Plugin
Gets the menu icon to be shown on the menu for this plugin.

Specified by:
getMenuIcon in interface Plugin
Returns:
this plugin's icon, or null if it has none
See Also:
edu.iu.iv.core.Plugin#getIcon()

getPropertyMap

public PropertyMap getPropertyMap()
Description copied from interface: Plugin
Gets the property map for this plugin which specifies additional properties of the plugin that can be gotten.

Specified by:
getPropertyMap in interface Plugin
Returns:
a plugin property map from PluginProperty->Value
See Also:
Plugin.getPropertyMap()