This content was developed by Hubert Soyer.
Creating a module
The user interface shipped with OpenSim is built upon the Netbeans Platform. For any GUI specific issues not concerning the access to OpenSim data, the Netbeans Platform documentation is the right place to go (http://netbeans.org/features/platform/all-docs.html).
In order to develop your own modules you will need to install a version of the Netbeans IDE.
The basic version with support for the "Netbeans Platform SDK" provides all the needed functionalities (http://netbeans.org/downloads/index.html).
After starting your IDE the first step is letting Netbeans know about the Netbeans Platform that is used for the OpenSim GUI. To do so, go to the "tools" menu and select the "Netbeans Platforms" entry. You will be presented with a window showing all your currently available Netbeans Platforms. Click on the "Add Platform..." button and add the OpenSim platform by specifying the path to OpenSim. In my case this path is "C:\OpenSim2.4.0".
This will add OpenSim to your list of available platforms.
Now you are able to create a new module by choosing "File → New Project → Netbeans Modules → Module" and following the dialog.
For adding functionality to your module you can choose among various types of components. By right clicking on your new project and selecting "new → other" you get the respective dialog.
For example "Action" lets you add a new entry to the OpenSim main menus, …
Access to OpenSim data from your module
Of course you will want to make your module interact with data that is currently loaded in the OpenSim GUI. Since the Netbeans Platform is modular you need to add modules that you want to access as dependencies to your own module to make sure they will be available and loaded at the time your module tries to access them. Therefore right click on your project in Netbeans and select "Properties". In the properties dialog choose "Libraries" on the left side and the tab "Module Dependencies" on the right. Add the modules you want to access. At start, the view module and the modeling module are usually sufficient.
Those modules provide their data via singleton instances of certain objects.
Good points of entry are:
- org.opensim.view.motions.MotionsDB : provides motion data
- org.opensim.view.pub.OpenSimDB : provides all kinds of data
- org.opensim.view.pub.ViewDB : provides data that is currently opened in the view
For anything further please refer to the OpenSim API documentation as well as the developers guide.
Testing and deploying your module
In order to test your module just hit the "play" button in your Netbeans main toolbar or right click on your project in the navigator and choose "run".
The auto update function poses one way to deploy your module of the Netbeans Platform.
To use it, build your module by right clicking on your project and choosing "build".
Netbeans will create a ".nbm" file in a subfolder of your project folder called "build".
You have to copy this file to a specific subfolder of your OpenSim installation. In my case, that is: "C:\OpenSim2.4.0\platform6\update\download". The disk name may vary however. After starting and closing OpenSim once, your module will be installed.