NDVis is currently used in neuroscience classes at Emory University and in ongoing research projects at Brandeis University and abroad.
I've been in touch with its main developer, John Langton from VisiTrend, who is interested in moving some of his tools to the NetBeans Platform. From my side, the easiest one to get started with was NDVis, since it is available in the open source.
I've taken the first steps, ending up with this GUI:
The remaining step, which could be quite complex, involves integrating the Database Explorer from the NetBeans Platform into the tool, the first steps of which have already been taken, as you can see above. The advantages will be many, e.g., all the tools are visible in the UI (instead of accessible via small dialogs, as is the case in the original) and almost all the db-related code in the original can, ultimately, simply be deleted, since the Database Explorer from NetBeans IDE can be reused, as seen above. Plus, the end users will have an SQL Editor, in addition to the visualization tool, which can't be a bad thing either.
Getting to the above application from scratch is fairly trivial:
@TopComponent.Registration(mode="editor",openAtStartup=true)
@TopComponent.Description(preferredID="NDVis")
public class NDVis extends TopComponent implements ChangeListener {
Now you'll need to tweak the code very slightly, e.g., remove "pack()", since you're using a TopComponent rather than a JFrame. Do the same at the end of the next step.
@TopComponent.Registration(mode = "output", openAtStartup = true)
@TopComponent.Description(preferredID = "ColorMapper")
public class ColorMapper extends TopComponent implements MapColorListener,
MonitoringINF {
@ActionID(category="NDVisActions",id="com.visitrend.ndvis.actions.AddNewImageAction")
@ActionRegistration(displayName="Add New Image")
@ActionReference(path="Menu/File")
public class AddNewImageAction extends AbstractAction {
@ActionID(category="NDVisActions",id="com.visitrend.ndvis.acolormapper.actions.OpenQueryAction")
@ActionRegistration(displayName="Open Query")
@ActionReference(path="Menu/File")
public class OpenQueryAction extends AbstractAction {
public class OpenQueryAction extends AbstractAction {
private ColorMapper colmap;
public OpenQueryAction(ColorMapper colmap) {
super("Open Query");
this.colmap = colmap;
}
...
...
...
So, in the constructor of the "ColorMapper" class, you need to put the ColorMapper into its own Lookup:
associateLookup(Lookups.singleton(this));
That will enable the "OpenQueryAction", which needs a "ColorMapper" in the Lookup in order to become enabled. A similar piece of code is needed in the "NDVis" class, to enable the "Add New Image" action.
Now I'm figuring out how to hook the database connection into the correct part of the code to allow the color analyzer to be run correctly, using the queries created in the Color Mapper. Then the final step will be to put the various Actions into the main menubar of the application.
The nice thing about the new annotation-based registration techniques is how it allows you to change very little of the original classes in order to integrate them into the NetBeans Platform. Just annotate a few classes, hook the Lookup code into the correct places, enable the modules you need, hide items you don't need via the layer, and then you're mostly done.
I have to say the @annotations seem to be even more handy than I expected. I am amazed that the originally existing action already was "context sensitive" and that you can achieve all of this with a bunch of annotations and single line change.
Yup, you're better than you think. :-)