Table Of Contents

Previous topic

2.2. How it all fits together

Next topic

2.4. Add an Agent

This Page

2.3. GUI Plugins

When the GUI connects to an experiment, it collects information from the control node about the experiment including available agents and jar files. It will download any jar files loaded by the experiment-setup script. Once downloaded they are searched for any and all .class and .py files. Each java class is loaded and examined for a method with the signature “static void initModule()” in the named class. Each python module is loaded in the Jython environment and examined for the function “def initModule():”. Any functions matching these signatures are executed.

From within initModule, the user is free to do what ever they wish, with the understanding that all code loaded from the experiment is running in a restricted bytecode environment as it itsn’t verified. While you are free to do most things, there are some primary plugin points that will be of most use to you:

  1. SEER.instance.addGUIComponent()
  2. Controls.registerPanelFactory()
  3. DescriptionPanel.registerControlFactory()

Upon dettaching from an experiment, the same files will be searched for an unloadModule function to call before unloading. From here you should call any unregister functions.

  1. SEER.instance.removeGUIComponent()
  2. Controls.unregisterPanelFactory()
  3. DescriptionPanel.unregisterControlFactory()

2.3.1. addGUIComponent

This method lets you add a GUIComponent to the running interface. You specify a GUIComponent implementation as the first argument. If the plugin also has a graphical interface that extends from JComponent, you specify it in the second argument. For most plugins, both arguments with be the same object but do not have to be if the interface implementation talks to a different object that represents the graphical portion.

The GUIComponent object is registered in the main event loop and will get a chance to see all the data objects received from the experiment as well as a pointer to a MessagingInterface which lets you send messages to the experiment or other GUIComponents. It is also queried for Java Actions, offline and online, that are placed in their respective menus.

If a JComponent is provided in the second argument, it will be placed in its own tab.

2.3.2. registerPanelFactory

Registering a panel factory lets the user override the default panel creation behaviour in the controls. The registered factory is quered before the default factory to provide a panel for a given agent description. If it returns null, the other factories are given a chance.

2.3.3. registerControlFactory

Registering a control factory lets the user change the control panels in a finer grained fashion by creating the individual controls in a control panel. You can either override default controls or provide controls for new data types if you created a new VariableType for your agent.

2.3.4. Example using Jython

The panel for ‘Virtual Network’ is created using a GUI plugin written in python. You can see the example at http://seer.isi.deterlab.net/trac/browser/code/trunk/guipython/panelFAKE.py