com.pegacat.vcf
Interface Plugin


public interface Plugin


Method Summary
 java.awt.Component getMainScreenComponent()
          Called to get the (optional) component to be used in the main body of the framework.
 java.lang.String getName()
          Called to get the display name of the plugin.
 void init(BaseGUI parent, DataLayer data, Skin skin, PluginResource resource)
          This is called by the framework to set the DataLayer object, the parent GUI component, and the skin.
 void start()
          When the user presses the triggering button, this method is called.
 void stop()
          Called by the framework at shutdown to enable the plugin to do any cleaning up that may be required.
 

Method Detail

init

public void init(BaseGUI parent,
                 DataLayer data,
                 Skin skin,
                 PluginResource resource)
This is called by the framework to set the DataLayer object, the parent GUI component, and the skin. (Some or all of these objects may be needed by the plugin.) The plugin shouldn't usually do any serious processing at this stage, remembering it may be only one of dozens - serious activity should only begin when the 'start()' method is called.
Parameters:
parent - the 'parent' GUI (the awt.Frame descended object with buttons 'n stuff from which the plugin is invoked)
data - the 'data' class providing access to other data objects such as stars, surveys, techs etc.
skin - the user-configurable graphical skin which *may* be used to get extra graphics (e.g. skin compatible buttons).
resource - the PluginResource the plugin can use to access its own images/data files etc. (even if they're bundled in a jar file).

getName

public java.lang.String getName()
Called to get the display name of the plugin. This is what will be used to create the button that 'triggers' the plugin.
Returns:
the name of the plugin

getMainScreenComponent

public java.awt.Component getMainScreenComponent()
Called to get the (optional) component to be used in the main body of the framework. Many plugins may prefer to use a popup window instead, or at least implement a user configurable switch. It is perfectly valid for this method to return 'null', indicating that the plugin will handle it's own GUI/Frame creation etc. in a seperate window.
Returns:
a component to display in the main framework window.

start

public void start()
When the user presses the triggering button, this method is called. From here the plugin writer can create components, GUI windows and so on.


stop

public void stop()
Called by the framework at shutdown to enable the plugin to do any cleaning up that may be required.