Package gcspy.vis.plugins

This package provides the classes for the view plugin mechanism.

See:
          Description

Class Summary
PluginFrame Abstract base class for plugins' frames.
PluginListener A plugin view called MyView must provide a PluginListener called MyViewListener.
PluginManager This class manages pluggable views.
 

Exception Summary
PluginException An exception for the plugin mechanism
 

Package gcspy.vis.plugins Description

This package provides the classes for the view plugin mechanism.

Developers of a new plugin view are required to provide (at least) classes that extend PluginFrame and PluginListener. A jar file containing the new view should be placed in the plugins directory in the classpath.

Suppose that you wish to create a new view called MyView. The PluginManager constructor will search the plugins directory for a jar file called MyView.jar. A new item MyView will be added to the visualiser's Plugins menu. However, this view will not appear as a button on any space in the main view of the visualiser until it is selected by the user. When the view is selected, a new button for this view, labelled "MyView", will be added to each space in the main view. Each button will have an instance of a subclass of PluginListener as its ActionListener.

Classes extending PluginListener
Classes extending PluginListener are typically trivial. The constructor will typically call the constructor of the PluginListener parent class, passing it the name of the view as a string.
The actionPerformed method will typically create a new PluginFrame and make that frame visible.

 

Classes extending PluginFrame
Classes extending PluginFrame must implement the interfaces DisconnectListener, EventListener and SpaceListener.
  1. The DisconnectListener requires one method
    public void disconnect(boolean reconnecting)
    to handle the client disconnecting from the server. Typicall, this will call PluginFrame.shutdown to remove this PluginFrame from the interpreter's lists of EventListeners and SpaceListeners before destroyig the frame.

     

  2. The SpaceListener requires one method
    public void space (ClientSpace space)
    which responds to a SPACE command from the server. The SPACE command provides bootstrap information for a space. Typically, space will: check whether the new space has the same ID as the space this PluginFrame is visualising; reset its maximum number of tiles, if necessary.

     

  3. The EventListener requires one method
    public void event (int eventID, int elapsedTime, int compensationTime)
    which responds to a EVENT command from the server. This method should cause the visualisation to be updated for the new event, redrawing each "tile" appropriately.