Creating a PShelf Alternative for the NetBeans Platform

DZone 's Guide to

Creating a PShelf Alternative for the NetBeans Platform

· Java Zone ·
Free Resource
I’m currently porting our  Tornado CMS from Eclipse RCP to the NetBeans Platform. In the Eclipse version, we used the the excellent Nebula PShelf component to display different menus in an OutlookBar fashion.

There is no such component in the NetBeans Platform, but we wanted our users to have a similar experience in the new version of our app. I have gotten great help from the brilliant Geertjan Wielenga on the NetBeans docs team, and he even wrote a blog post about my usecase where he created an implementation of such a component, based on the work done by Steven Haines back in 2005 to create a Java implementation of the OutlookBar.

However, I wanted the component to be more like the rest of the NetBeans Platform. The NetBeans version should support fully fledged TopComponents, and proxy their lookups, icon and displayName, as well as listen to and convey lifecycle events like componentShowing, componentHidden etc. Last but not least, it should be able to dock and undock existing TopComponents. Therefore, I give you the NetBeans Dock component:

The NetBeans Dock

The dock/undock operations and the lifecycle proxying was not possible to do without using reflection on the Modes and TopComponents, but the end result was really nice.

Now my users can undock the Article tab, and place it alongside or even under the rest of the docked components, to get a more efficient working environment. TopComponents can also register themselves in the System Filesystem to be opened and docked automatically when the Dock itself is opened. A typical registration, here exemplified with the ArticleTree, looks like this in the layer.xml:

<folder name="Dock">
<file name="no-tornado-vortex-cms-article-ArticleTree.instance">
<attr name="instanceCreate" methodvalue="no.tornado.vortex.cms.article.ArticleTree.getDefault"/>

To dock/undock components, you right click either on the empty area if you have no docked components, or on any tab:

The undock option
The dock menu will contain all opened TopComponents in any mode. Using Drag and Drop to dock/undock would be better, but this will do for now. If anyone is interested in this component I’d be happy to provide the source.

From http://blog.syse.no/edvin



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}