How to Create a Satellite View in a Navigator for a Custom DataObject
By Geertjan on Jun 03, 2013
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: