Monday Jun 03, 2013

How to Create a Satellite View in a Navigator for a Custom DataObject

Recently there was a question on the NetBeans Platform mailing list (if you're creating NetBeans Platform applications and are not on the mailing list, you're missing a lot of good discussions and code samples) about custom DataObjects, Navigators, and Visual Library satellite views.

So I started with the code in the NetBeans File Type Integration tutorial. I added a Navigator, in a separate module, just to prove the point that it can work that way. Rather than the Navigator somehow finding the MultiViewElement, and then getting the Scene from it, the DataObject has the Scene in its Lookup. That enables the MultiViewElement to get the Scene from the DataObject, while the Navigator gets it from the selection.

Also, a requirement is that when the Source is open, i.e., the Source toggle button has been clicked, the Navigator should be emptied, i.e., the satellite view should not show anything. To achieve that, I add/remove the Scene from the DataObject's Lookup in the MultiViewElement's componentShowing/componentHidden. That's possible because I put the DataObject's InstanceContent into its own Lookup (maybe unorthodox or plain wrong but it works), then retrieve the InstanceContent in the MultiViewElement and add/remove the Scene from it.

The code is here:


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2013 »