Interview: Porting a Sales System to the NetBeans Platform

DZone 's Guide to

Interview: Porting a Sales System to the NetBeans Platform

· Java Zone ·
Free Resource

Aljoscha "Josh" Rittner (blog), who works for Sepix GmbH and lives near Göttingen in Germany, has been porting the Sepix Sales System, a plain Swing application, to the NetBeans Platform. The application is a customer relationship management system for sales managers on the road. At this stage, the application is running on the NetBeans Platform with a fully functional module for mapping and routing. The application offers a map display, works as a route planner, and is capable of displaying data from a database as geolocations. You can display any type of graphical layer over the map, with sales territories or any kind of POIs, such as speed limit zones (see the screenshots at the end for details).

In this interview (an interview from 2 years ago on a similar topic with Josh can be found here), Josh talks about the application and the cost (in time and energy) of porting it to the NetBeans Platform. He also describes the process of porting and the main NetBeans APIs that he has made use of. (Click here for a German PDF version of this interview.)

First, a screenshot to give an idea of what the application now looks like, i.e., on the NetBeans Platform (many more screenshots can be found at the end of the interview):

Let's start by talking about why you thought about using the NetBeans Platform in the first place.

Well, I've used the NetBeans IDE since the end of the '90's and have been, since that time, closely following the open sourcing of the related APIs into its current form as a fully-fledged Swing framework. With the 6.0 release I saw the time had come to migrate my current Swing projects to a new level of technology. The old plain Swing CRM system could function better if it were based on a modern desktop platform. Many components, which I had already programmed, were no longer modern and were increasingly difficult to maintain. I simply didn't have the time to redo all the basic things all over again. With a framework, such as that offered by the NetBeans Platform, I wanted to save a large portion of my development time and energy.

How did you go about porting the application?

There were three stages of development of the project:

  1. Initially, I had to modulerize and refactor the source code of my old Swing application so that it fit better into the NetBeans Platform. All the parts that the NetBeans Platform already provides had to be identified. The refactoring itself took up several months and was distinct from the work involved in relation to the NetBeans Platform itself.

  2. In the second step, I wrote a prototype application on top of NetBeans Platform 6.0. The application offered basic functions for the mapping & routing. I used a very monolithic structure at this stage. I only had a module suite as my project type, together with one additional module that covered the mapping and routing. During this time, I learned most about NetBeans in terms of its platform concept. The prototype required only two months to realize, however, and ended up providing the most important functionality. Nevertheless, it was obviously a huge chunk of code in one single module. That was, in principle, not a problem in terms of the NetBeans Platform. It was simply a fast implementation of the required functions.

  3. In the third stage, the prototype was rebuilt again. Everything I had now learned about the concepts of NetBeans modularization was applied in this phase. I have, for example, created a NetBeans Platform from the harness-cluster. So, I have a stable and consistent platform by means of "Module Suite Chaining". The NetBeans Platform is thus no longer dependent on the update cycles of the NetBeans IDE. In my NetBeans Platform, I have integrated the core modules for the required database access and basic CRM features. Now it is possible to access these features from different module suites. Many functions have been "out sourced" to extra modules and will now be addressed  as services. With this "SOA feature" you can install the map layer as extra NBM packages and display them automatically in the map.

Which parts are you happiest with?

It's hard to say which areas are highlights.

  • The Window System API was easiest to understand. The Window System API brought me the fastest successful visual experience.

  • The advantages of the Lookup API do not reveal themselves immediately, but once you start trying things out, it's a big help. This API can really let you develop independent, loosely coupled components.

  • The entire infrastructure of the Options API and the AutoUpdate Center API helps a lot in saving development time too. One no longer needs to develop boiler plate code in these areas at all.

Which of the NetBeans API's did you use?

Nearly all areas of the NetBeans Platform APIs! Of course, initially, the Window System API. Next, I needed the Options and Preferences API for the configuration of modules. The Lookup API is used for decoupling. The Nodes and Explorer APIs display the route lines, address lists, and map layer. The Wizard API simplifies complex steps for the user. The Explorer and Property Sheet API lets the user control the layer styles, such as color, border line thickness, and transparency. I use the AutoUpdate Center API so that software updates are made possible. I use the Palette API for predefined operations in the database query editor. To me, it was very important to learn as much as possible about the NetBeans Platform so that I could use as much of it as possible.

How has your experience been creating all of this?

The learning curve for a framework of this nature is very steep. Ultimately, what helped me were the books "NetBeans Platform 6: Rich Client Development with Java" by Heiko Boeck and "Rich Client Programming: Plugging into the NetBeans Platform". Of course, I read almost every article at http://www.planetnetbeans.org/, while constantly browsing the mailing lists at http://www.netbeans.org/community/lists/top.html). The Developer FAQ at http://wiki.netbeans.org/NetBeansDeveloperFAQ is equally indispensable.

But... the main source is still the source code of the NetBeans Platform itself!

Can you give some tips for someone beginning a similar project on the NetBeans Platform?

It is very important to deal with the module concept, the various Classloaders, and the Lookup API. These three areas simply must have been understood in order to work coherently with the NetBeans Platform as a whole.

Can you name some things that you'd like to have improved in the NetBeans Platform?

  1. TopComponents should also be "heavy weight", as it is in Swing, for example, with Swing's pop-up menus and tooltips. Currently I have the problem with the movie player module from the Java Media Framework because the player component overlaps other TopComponents when slided in. This is quite unpleasant.

  2. It should be easier to mount native foreign libraries into a NetBeans Platform application.

  3. I need the global selection management to be separate from TopComponents.  I have some cases with a global accessible object without any association to the focus-selection management. For example, I have a loaded list with customers in the QueryResultTopComponent, two toolbar buttons in the Navigator, and an AddressViewTopComponent. When I change the focus to the AddressViewTopComponent, the focus/activation-state gets lost from the AddressViewTopComponent and my toolbar buttons get greyed out. OK, I know some tricks to fix this problem, but it could be easier.

    For example, I know a method to change the Global Selection Management (GSM). It's a registered service in the META-INF/services folder. To replace the GSM, drop a text file named "org.openide.util.ContextGlobalProvider" into the META-INF/services folder and write these lines:


    The absolute minimal implementation is:

    public final class NonFocusActionContextImpl implements ContextGlobalProvider {
    private final InstanceContent contents = new InstanceContent();
    private final Lookup lkp = new AbstractLookup (contents);
    public Lookup getLookup() {
    return lkp;
    public void addContent (Object content) {
    public void removeContent (Object content) {
    contents.remove (content);

    But with this new class I lose the standard focus/TopComponent based GSM. Some applications need both behaviors.

What's the future of your application?

The mapping and routing module is now ready. Next steps include the migration of a mail client and a time planner, comparable to Outlook. In the old Swing application this functionality is already fully operational, they only need to be ported as modules to the NetBeans Platform. After that, the remaining areas of the old CRM application will transferred. I will certainly be pretty busy during the next six months or so!

Anything else you want to share?

Many things that I've learned in dealing with the NetBeans Platform I share in my blog, which is in German. I would be delighted if the NetBeans community in Germany would continue to grow. I have found the NetBeans Platform to be a superior framework for rich client applications!

Finally, some more screenshots to show the main parts of the new NetBeans Platform application:

Region builder:

Route list:

Route track wizard:

Query builder:

Speed limit zones:

Database query:

Found addresses:


Video tutorials:


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}