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
.
PluginListener
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.
actionPerformed
method will typically create a new
PluginFrame
and make that frame visible.
PluginFrame
PluginFrame
must implement the interfaces
DisconnectListener
, EventListener
and SpaceListener
.
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 EventListener
s
and SpaceListener
s before destroyig the frame.
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.
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.