Edvin has posted 8 posts at DZone. View Full User Profile

Creating a PShelf Alternative for the NetBeans Platform

  • submit to reddit
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


Published at DZone with permission of its author, Edvin Syse.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Edvin Syse replied on Tue, 2010/07/20 - 6:18am

The source code is now available here, as well as a compiled NetBeans module ready for use :)

Matt Coleman replied on Mon, 2013/04/01 - 4:02am in response to: Edvin Syse

thanks for the information Edvin...it sure does makes it easier

buffalo freelance web designer 

Cata Nic replied on Fri, 2013/09/06 - 3:09am

 The source code is useful but should be explained with some comments in the code.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.