|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.marvin.plugin.PluginFactory
public class PluginFactory
Plugin factroy: responsible for plugin parameter panel and plugin creation and central management.
| Nested Class Summary | |
|---|---|
class |
PluginFactory.PluginRecord
Stores plugin data. |
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_CONFIG_FILE
The default config file name. |
static java.lang.String |
NOPARAMS
No parameter panel sign in property file: if present then no parameter panel belongs to the plugin. |
static java.lang.String |
PRELOAD
Deprecated. Not used. |
| Constructor Summary | |
|---|---|
PluginFactory()
Constructor. |
|
| Method Summary | |
|---|---|
static ParameterPanelHandler |
createDefaultParameterPanel(java.lang.Class pluginClass,
java.lang.String cl,
java.awt.Component parent)
|
static ParameterPanelHandler |
createDefaultParameterPanel(java.lang.String cl,
java.awt.Component parent)
Creates default parameter panel based on XML config. |
int |
getCount()
Returns the number of plugin records. |
CalculatorPluginDisplay |
getDisplay(int index)
Gets a display object, loads it if needed. |
java.lang.String |
getGroup(int index)
Gets the menu group for a plugin. |
char |
getGroupMnemonic(int index)
Gets the group mnemonic for a plugin. |
java.lang.String |
getKey(int index)
Gets the menu key for a plugin. |
java.lang.String |
getMenu(int index)
Gets the menu string for a plugin. |
char |
getMnemonic(int index)
Gets the menu mnemonic for a plugin. |
OptionsPane |
getOptionsPane(int index)
Gets the options pane for a plugin, loads it if needed. |
ParameterPanelHandler |
getParameterPanel(int index)
Gets the parameter panel for a plugin, loads it if needed. |
CalculatorPlugin |
getPlugin(int index)
Gets a plugin, loads it if needed. |
int |
getPluginIndex(java.lang.String key)
Gets a plugin index from record key. |
boolean |
hasParameters(int index)
Returns true if plugin has parameter panel,
false otherwise. |
boolean |
isOptionsPaneLoaded(int index)
Returns true is options pane is loaded for plugin,
false otherwise. |
void |
load()
Loads default property file. |
void |
load(java.util.Properties props)
Loads plugin data from properties. |
void |
load(java.lang.String file,
java.lang.String alterfile)
Loads plugin data from property file. |
void |
saveParameterSettings()
Saves plugin parameter settings to file $HOME/chemaxon/<plugin class name>Parameters.properties (Windows), or
$HOME/.chemaxon/<plugin class name>Parameters.properties (UNIX / Linux). |
void |
setOKActionListener(java.awt.event.ActionListener okActionListener)
Sets the "OK" button pressed action listener. |
void |
setParentComponent(java.awt.Component parent)
Sets the parent component - this is used to set options panes positions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_CONFIG_FILE
public static final java.lang.String PRELOAD
public static final java.lang.String NOPARAMS
| Constructor Detail |
|---|
public PluginFactory()
| Method Detail |
|---|
public void setOKActionListener(java.awt.event.ActionListener okActionListener)
okActionListener - is the "OK" button pressed action listenerpublic void setParentComponent(java.awt.Component parent)
parent - is parent component
public static ParameterPanelHandler createDefaultParameterPanel(java.lang.String cl,
java.awt.Component parent)
throws PluginException
ParameterPanel object based on the
<plugin class name>Parameters.xml
configuration XML read from CalculatorPlugin.PLUGIN_DIR,
with user parameter settings read from
$HOME/chemaxon/<plugin class name>Parameters.properties (Windows), or
$HOME/.chemaxon/<plugin class name>Parameters.properties (UNIX / Linux).
Returns null (no paramter panel for this plugin) if the configuration XML
is not found.
cl - the full plugin class name
null if no XML config file found
PluginException
public static ParameterPanelHandler createDefaultParameterPanel(java.lang.Class pluginClass,
java.lang.String cl,
java.awt.Component parent)
throws PluginException
PluginException
public void load()
throws PluginException
PluginException
public void load(java.lang.String file,
java.lang.String alterfile)
throws PluginException
key=$<plugin class name>$<plugin JAR URL>$<menu>$<mnemonics>$<group>$<groupmnemonic>$<NOPARAMS>The first character in the value (after the '=' sign) is the delimiter - can be any ASCII character that does not occur in the value string. The '$' character is appropriate in most cases. Plugins will be sorted by key. At least one of the plugin class name and the plugin JAR has to be specified, all other entries are optional. Omitted fields should be denoted by empty strings.
Creating the plugin parameter panel:
<plugin name>Parameters.xml.
If this file is found then a generic parameter panel is generated,
plugin.getParameterPanel().
$HOME/chemaxon/<plugin name>Parameters.properties (Windows) or
$HOME/.chemaxon/<plugin name>Parameters.properties (UNIX / Linux)
if exists, otherwise default initial values are set from the configuration XML or
in plugin.getParameterPanel().
Creating the plugin:
Plugin-Class attribute of the JAR manifest.
file - is the config file name as resource, relative to the CLASSPATHalterfile - the optional config file name as resource, relative to
the CLASSPATH, set it to null to prefer the default config file
PluginException - on error
public void load(java.util.Properties props)
throws PluginException
key=$<plugin class name>$<plugin JAR URL>$<menu>$<mnemonics>$<group>$<groupmnemonic>$<NOPARAMS>The first character in the value (after the '=' sign) is the delimiter - can be any ASCII character that does not occur in the value string. The '$' character is appropriate in most cases. Plugins will be sorted by key. At least one of the plugin class name and the plugin JAR has to be specified, all other entries are optional. Omitted fields should be denoted by empty strings.
Creating the plugin parameter panel:
plugin/<plugin name>Parameters.xml.
If this file is found then a generic parameter panel is generated,
plugin.getParameterPanel().
$HOME/chemaxon/<plugin name>Parameters.properties (Windows) or
$HOME/.chemaxon/<plugin name>Parameters.properties (UNIX / Linux)
if exists, otherwise default initial values are set from the configuration XML or
in plugin.getParameterPanel().
Creating the plugin:
Plugin-Class attribute of the JAR manifest.
props - is the property object storing the plugin configuration
PluginException - on errorpublic void saveParameterSettings()
$HOME/chemaxon/<plugin class name>Parameters.properties (Windows), or
$HOME/.chemaxon/<plugin class name>Parameters.properties (UNIX / Linux).
public int getCount()
public java.lang.String getMenu(int index)
index - is the plugin record index
public java.lang.String getKey(int index)
index - is the plugin record index
public char getMnemonic(int index)
index - is the plugin record index
public java.lang.String getGroup(int index)
index - is the plugin record index
public char getGroupMnemonic(int index)
index - is the plugin record index
public ParameterPanelHandler getParameterPanel(int index)
throws PluginException
index - is the plugin record index
PluginException - on error
public OptionsPane getOptionsPane(int index)
throws PluginException
index - is the plugin record index
PluginException - on error
public CalculatorPlugin getPlugin(int index)
throws PluginException
index - is the plugin record index
PluginException - on error
public CalculatorPluginDisplay getDisplay(int index)
throws PluginException
index - is the plugin record index
PluginException - on errorpublic boolean hasParameters(int index)
true if plugin has parameter panel,
false otherwise.
public boolean isOptionsPaneLoaded(int index)
true is options pane is loaded for plugin,
false otherwise.
public int getPluginIndex(java.lang.String key)
key - is the plugin record key
-1 for non-existent key
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||