Top 10 NetBeans Platform 6.5 Features
Here are my personal favorite enhancements in relation to the NetBeans Platform for the upcoming 6.5 release.
Note that the NetBeans Platform is the infrastructure that underpins NetBeans IDE, as well as many other similar large modular Swing applications, hence this blog entry isn’t applicable to NetBeans IDE only.
It is applicable to any application built atop the NetBeans Platform. So, here are my personal favorite features, in no particular order-
01 | Lazy Children
A new constructor has been added to Children.Keys, receiving a Boolean that determines whether the child nodes are created lazily or not. This constructor is used throughout NetBeans IDE 6.5 to improve performance and is an approach you can use in your own application.
As a result, only when your users scroll beyond the visible explorer nodes are the new nodes created. Especially when there are thousands of nodes that need to be created, the performance improvements that your users will experience will be significant.
02 | Wrappers for Platform API’s
Increasingly, from 6.5 onwards, wrappers are being created for NetBeans Platform APIs. You, as a user of the APIs, will typically need to use only the standard JDK classes, instead of the lesser-known NetBeans API classes. A case in point is the CallableSystemAction class. Not only is this a NetBeans API class, but it also is a singleton class.
From 6.5 onwards, it is possible to have this class wrapped within the layer.xml file and then interact with it via the well-known ActionListener, which is a standard JDK class. When you use the New Action wizard, you will see this code being generated for you.
Similarly, the New File Type wizard creates several tags in the layer.xml file such that several typical complexities (DataLoader.class, for example) are hidden and you only need to code those classes that you actually need.
Another example, is the New Window Component wizard, which only creates a new TopComponent, and its related XML files, without the Action class for the menu item, since that is simply declared within the layer.xml file, so that you don’t need to deal with it directly. Of course, you can create your own customization if you want to, but the default implementation, which probably applies to 95% of cases, is wrapped within the layer.xml file.
Tim’s Outline component lets you create tree tables in a far simpler way than before. The TreeTableView itself should be considered deprecated and, where possible, you should replace it with the OutlineView, which does not have the bugs and problems that users of the TreeTableView have been struggling with increasingly since its inception.
04 | ETable
Imagine you had a JTable with a lot of default functionality such as the ability to be sorted, across multiple columns? Welcome to the ETable (where “E” stands for “extension”) providing you with a perfect replacement for the JTable, even in completely standard Java SE applications, i.e., outside the NetBeans Platform.
05 | Code Generator API
Clicking Alt-Insert in the NetBeans Java Editor has brought up a small popup since NetBeans IDE 6.0. The popup contains items that represent code that can be generated by selecting the item in question, such as “Constructor“ and “Getter and Setter“, which immediately generates code snippets without your fingers ever leaving the keyboard to reach for your mouse. The API has now been exposed and can be implemented for the MIME type of your choice, so that you can create such code generators for HTML files, for example, as well as any MIME type that you feel called upon to create.
06 | Quick Search API
When you press Ctrl-I in the IDE, the cursor finds itself in a small drop-down in the top right of the toolbar where you can search for help topics and actions.
Once found, you can simply select it to open/activate it. The related API has been exposed and you can add/remove items to/from this drop-down, depending on your needs as a NetBeans Platform developer.
For the first time, from 6.5 onwards, you can customize a NetBeans Platform application’s window system. As a result, you can specify whether its windows are dockable or not, resizable or not, etc. Not all developers want to give their users as much freedom as the NetBeans Platform provides by default.
On top of that, there’s a new panel in the Project Properties dialog for NetBeans Platform Applications which, thanks to a handful of self explanatory checkboxes, enable you to disable/enable this functionality.
In addition, when you create a new TopComponent via the Window Component template, you can specify that its minimized size should be determined by its minimum size, rather than by its default size.
These enhancements give you, for the first time, a lot of control over the window system of your application.
From 6.5 onwards, the Palette API has been enhanced so that you can drag code from any editor that support this functionality into the palette. When you do so, a new item is added to the palette and can therefore be dragged back into the editor. That’s a great way to reuse the bits of code that you find yourself using over and over again.
09 | Secondary Panels
It is now possible to create sub-panels within panels in the Options window, if the panel in question specifies that this is allowed.
10 | Template wizards
A very nice thing is that the NetBeans engineers are increasingly aware that changes to APIs can best be supported by providing new/changes template wizards. As a result, there’s a new Quick Search API wizard and a new Code Generator wizard, supporting the new APIs described above, as well as changes to the code generated by several of the existing wizards, such as the New Action wizard and the New File Type wizard, conforming to the changes mentioned in the 2nd item above. APIs continue to exist for creating your own similar API wizard, so please feel free to make use of them in NetBeans IDE 6.5!
So, this was Geertjan Wielenga for all of you, yes you read it right he did blog this entry. He’s actually my third special guest blogger, who was invited to blog the 90th entry over here.
Gj, (as we know him on the mailing lists), thank you so much! It was indeed a pleasure to have you blog over here.
Geertjan Wielenga, he is the technical writer in the NetBeans Docs team, primarily responsible for documentation relating to the NetBeans Platform. He co-authored Rich Client Programming: Plugging into the NetBeans Platform.
He is also a DZone leader and occasionally speaks at conferences.