Onyx SDK

The developement kit is reserved to java software developper in order to transform their java application in an onyx plugin. This developpement kit consists of a plugin container, a documentation and a javadoc.

Developement Phase

First of all, it s easy! Your main class has to be changed and inherits the class Plugin and MUST BE in a package onyx.plugin and should be named XXXPlugin.java (Example:TestPlugin.java).

Here are the methods which has to be implemented by you:
public abstract void initialize()
This method is called at the start of Onyx to initialize your plugin.
public abstract void terminate()
This method is called at the end of Onyx to terminate your plugin.
public abstract java.lang.String getTitle()
Should return the title of your plugin.
public abstract java.awt.Image getImage()
Should return the picture of your plugin (50x50), this picture will appear on the plugin bar.
public abstract java.lang.String[] getActions()
(reserved) return null.
public abstract java.awt.Container getWorkingArea()
Should return the main container of your application.

This methods are called from Onyx to your plugin:
public boolean showNotify(PluginEvent se)
Called when the plugin is shown, return true if your plugin is ready to be shown
public boolean hideNotify(PluginEvent se)
Called when the plugin is hidden, return true if your plugin is ready to be hidden

When the user goes from a plugin A to a plugin B, Onyx asks a hideNotify to the plugin A. If true, Onyx asks a showNotify to the plugin B.

Here is the online javadoc of the SDK: here


Compiling Phase

The following command line will compile the plugin into the folder bin:
   javac -d ./bin -cp .;onyxplugin.jar ./onyx/plugin/*.java


Packaging Phase

All your compiled code as well as your resources (pics, sounds ...) should be included in a single jar file. The jar name file MUST BE the same as your plugin class name XXXPlugin.jar (Example:TestPlugin.jar)


Testing Phase

When you have the jar file ready, you can use the pluginDev container to run your plugin. Here the link to the PluginDev.exe. Just double clic on the executable and select your plugin.


Example:

We provide you the traditional Hello World example: HelloworldPlugin.rar
public class HelloworldPlugin extends Plugin {

protected JPanel panel = null;

public HelloworldPlugin(PluginContainer parent,Context context){
super(parent,context);
}

public void initialize(){
panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(new JLabel("Hello World!",JLabel.CENTER),BorderLayout.CENTER);
}

public void terminate(){
}

public String getTitle(){
return "Hello World";
}

public Image getImage(){
return Toolkit.getDefaultToolkit().getImage(onyx.plugin.
HelloworldPlugin.class.getClassLoader().getResource("Helloworld.gif"));
}

public String[] getActions(){
return null;
}

public Container getWorkingArea(){
return panel;
}

public boolean showNotify(PluginEvent pluginevent){
return true;
}

public boolean hideNotify(PluginEvent pluginevent){
return true;
}
};

Screenshot: