Over a million developers have joined DZone.

Creating a PShelf Alternative for the NetBeans Platform

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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



Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}