public abstract class ModulePlugin
extends Object
chargerplugin
package.
The rest of the module's actual code can be packaged anywhere you want.
getDisplayName()
below) will appear on the
Tools menu of the HubFrame using the keystroke specified in getKeyStroke()
.
The module's properties Panel (if non-null) will be appear in Charger's own Preferences window as one of the tabs,
but only after it has been enabled (see below)
When selected, Charger will invoke the startup() method of your
boot class. After that, it's up to you!
Note that if your module creates any windows, those windows should implement and invoke the methods from Charger's window manager interface, or else they will not appear in the Window menu of Charger. They will still be accessible and selectable according to your operating system's way of managing windows.
An implementer is free to use the plugin class as the main class providing most or all of the module's functionality. The intention of this architecture, however, is that the plugin's actual instance is small and fast, since it may be instantiated in some situations where the module's main purpose will never be utilized.
A module's state can be categorized as follows:
When the module's shutdown()
method is called,
the module is no longer activated, but may remain enabled. Users may enable
tools from the Config tab of the Preferences window.
A module is provided with a built-in set of properties (default empty) that will be automatically loaded and saved for each activated module.
charger.util.WindowManager
Modifier and Type | Field and Description |
---|---|
static Properties |
moduleProperties
Automatically saved and retrieved whenever Charger properties are saved
or retrieved.
|
Constructor and Description |
---|
ModulePlugin() |
Modifier and Type | Method and Description |
---|---|
abstract void |
activate()
Called whenever the module is selected but is already running
|
abstract String |
getDisplayName()
Return the simple name of this module.
|
abstract String |
getInfo()
Return any other information about the module, such as copyright, purpose, etc.
|
abstract KeyStroke |
getKeyStroke()
Get the accelerator key combination needed for the menu.
|
protected File |
getModulePropertiesFile() |
Properties |
getProperties()
Provides access to the module's built-in properties.
|
abstract JPanel |
getPropertiesPanel()
Access the properties panel for this module, suitable for adding as a tab in the main Preferences window.
|
void |
saveProperties()
Saves the module's built-in properties as returned by getProperties().
|
void |
setProperties(Properties props)
Set the module's properties directly.
|
abstract void |
shutdown()
Perform whatever cleanup and finalizing necessary.
|
abstract void |
startup(ModulePlugin module)
Launch this module, attaching it to Charger.
|
public static Properties moduleProperties
saveProperties()
public abstract String getDisplayName()
public abstract KeyStroke getKeyStroke()
public abstract String getInfo()
public abstract void startup(ModulePlugin module)
public abstract void activate()
public abstract void shutdown()
protected File getModulePropertiesFile()
public Properties getProperties()
public void setProperties(Properties props)
props
- public void saveProperties()
public abstract JPanel getPropertiesPanel()