Wednesday Oct 31, 2012

JFall 2012

JFall 2012 was over far too soon! Seven tracks going on simultaneously in a great location, with many artifacts reminding me of JavaOne, and nice snacks and drinks afterwards. The day started, as such things always do, with a keynote. Thanks to @royvanrijn for the photo below, I didn't take any myself and without a picture this report might have been too dry:

What you see above is Steve Chin riding into the keynote hall on his NightHacking bike. The keynote was interesting, I can't be too complimentary about it, since I was part of it myself. Bert Ertman introduced the day and then Steve Chin took over, together with Sharat Chander, Tom Eugelink, Timon Veenstra, and myself. We had a strict choreography for the keynote, one that would ensure a lot of variation and some unexpected surprises, such as Steve being thrown off the stage a few times by Bert because of mentioning JavaOne too many times, rather than the clearly much cooler JFall.

Steve talked about JavaOne and the direction Java is headed in, Sharat talked about JavaME and embedded devices, Steve and Tom did a demo involving JavaFX, I did a Project Easel demo, and Timon from Ordina talked about his Duke's Choice Award winning AgroSense project. I think the Project Easel demo (which I repeated later in a screencast for Parleys arranged by Eugene Boogaart) came across well and several people I spoke to especially like the roundtrip/bi-directional work that can be done, from browser to IDE and back again, very simply and intuitively. (In a long conversation on the drive back home afterwards, the scenario of a designer laying out the UI in HTML and then handing the HTML to a developer for back-end work, a developer who would then find it convenient to open the HTML in a browser and quickly navigate from the browser to the resources within the IDE, was discussed and considered to be extremely interesting and worth considering adopting NetBeans for, for no other reason than that.)

Later I attended a session by David Delabassee on Java EE 7, Hans Dockter on Gradle, and Sander Mak on cross-build injection attacks. I was sorry to have missed Martijn Verburg's session, which sounded like it was really fantastic, among others, such as Gerrit Grunwald. I did a session too, entitled "Unlocking the Java EE 6 Platform", which was very well attended, pretty much a full room, and the demo went very smoothly. I talked to many people, e.g., a long time with Hans Dockter about how cool Gradle is and how great the Gradle/NetBeans plugin is turning out to be. I also had a long conversation (and did a demo) with Chris Chedgey, from Structure101, after his session, which was incredibly well attended; very interesting how popular modularity is.

I met several people for the first time, as well as some colleagues from past places I've worked at. All in all, it was a great conference, unfortunately too short, which was very well attended (clearly over 1000) people, with several international speakers, as well as international attendees such as Mattias Karlsson, Sweden JUG leader. And, unsurprisingly, I came across NetBeans Platform applications again, none of which I had ever heard of before. In each case, "our fat client application" was mentioned in passing, never as a main application, and never in a context where there are plans for the application to be migrated to the web or mobile, simply because doing so makes no business sense at all.

Great times at JFall, looking forward to meeting with some of the people I met again soon.

Tuesday Oct 30, 2012

Sortable & Filterable PrimeFaces DataTable

    <p:dataTable value="#{resultManagedBean.customers}" var="customer">
        <p:column id="nameHeader" filterBy="#{}" sortBy="#{}">
            <f:facet name="header">
                <h:outputText value="Name" />
            <h:outputText value="#{}" />
        <p:column id="cityHeader" filterBy="#{}" sortBy="#{}">
            <f:facet name="header">
                <h:outputText value="City" />
            <h:outputText value="#{}" />

Or an alternative to the above:

            filterBy="${}" sortBy="${}" 
            filterBy="${}" sortBy="${}" 
            filterBy="${item.state}" sortBy="${item.state}" 

That gives me this:

And here's the filter in action:

Behind this, I have:

import com.mycompany.mavenproject3.entities.Customer;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.RequestScoped;
import javax.inject.Named;

@Named(value = "resultManagedBean")
public class ResultManagedBean implements Serializable {

    private CustomerSessionBean customerSessionBean;

    public ResultManagedBean() {

    private List<Customer> customers;

    public void init(){
        customers = customerSessionBean.getCustomers();
    public List<Customer> getCustomers() {
        return customers;

    public void setCustomers(List<Customer> customers) {
        this.customers = customers;


And the above refers to the EJB below, which is a standard EJB that I create in all my Java EE 6 demos:

import com.mycompany.mavenproject3.entities.Customer;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public class CustomerSessionBean implements Serializable{

    EntityManager em;
    public List getCustomers() {
        return em.createNamedQuery("Customer.findAll").getResultList();


Only problem is that the columns are only sortable after the first time I use the filter.

Monday Oct 29, 2012

A New Way of Working with HTML5

For more information: HTML5 Development for Dummies

Sunday Oct 28, 2012

Play Framework Plugin for NetBeans IDE (Part 2)

After I published part 1 of this series, the first external contribution (i.e., not by me) to the NetBeans plugin for Play Framework 2 was committed today.

Yann D'Isanto added support for creating new Play projects:

That completely solves a problem I was working on, in a different way altogether. I was working on creating a new wizard that would call "play new" on the command line and pass into the command line the entered name and application type (1 for Java and 2 for Scala). However, Yann's solution is better, at least in the sense in that it works, as opposed to mine which didn't, because of problems I continually had with the command line, since one needs to press Enter multiple times on the Play command line when creating new projects, which I wasn't able to simulate in my new wizard. Yann's approach is simply to follow the approach taken in the Project Type Module Tutorial, which explains how to register a project sample in the IDE.

I was inspired by Yann's contribution, especially when he mentioned that one needs to build Play projects on the command line. So, I added a new menu item on the right-click of a project for building Play projects, which simply passes "play compile" to the command line for the current project:

Via the IDE's main menu bar, you can also Build and Run the application, though the code for the Clean function needs to be added still, which would be a cool thing for anyone out there to add, by using all the existing code and then passing "play clean compile" to the command line.

Something else that Yann added is an Options Window extension, thanks to the Options Window Module Tutorial, for registering the Play installation, which is a step forward from my hard coded solution. I changed things slightly so that, when Build or Run are selected, without a Play installation being defined, the Options window opens, displaying the tab that Yann created, shown below. Notice that there's no Browse button, which would be a simple next step for anyone else to contribute. A small tip is to use the FileChooserBuilder from the NetBeans IDE APIs when working on the Browse button:

Looking forward to more contributions to the Play Framework 2 plugin for NetBeans IDE. Just leave a message here with your ideas, with your name, and then I'll add you to the project on, where I very much look forward to your contributions:

Saturday Oct 27, 2012

UNESCO, J-ISIS, and the JavaFX 2.2 WebView

J-ISIS, which is the newly developed Java version of the UNESCO generalized information storage and retrieval system for bibliographic information, continues to be under heavy development and code refactoring in its open source repository. Read more about J-ISIS and its NetBeans Platform basis here.

Soon a new version will be available for testing and it would be cool to see the application in action at that time. Currently, it looks as follows, though note that the menu bar is under development and many menus you see there will be replaced or removed soon:

About one aspect of the application, the browser, which you can see above, Jean-Claude Dauphin, its project lead, wrote me the following:

The DJ-Native Swing JWebBrowser has been a nice solution for getting a Java Web Browser for most popular platforms. But the Java integration has always produced from time to time some strange behavior (like losing the focus on the other components after clicking on the Browser window, overlapping of windows, etc.), most probably because of mixing heavyweight and lightweight components and also because of our incompetency in solving the issues.

Thus, recently we changed for the JavaFX 2.2 WebWiew. The integration with Java is fine and we have got rid of all the DJ-Native Swing problems. However, we have lost some features which were given for free with the native browsers such as downloading resources in different formats and opening them in the right application.

This is a pretty cool step forward, i.e., the JavaFX integration. It also confirms for me something I've heard other people saying too: the JavaFX WebView component is a perfect low threshold entry point for Swing developers feeling their way into the world of JavaFX.

Friday Oct 26, 2012

Save Actions in NetBeans IDE 7.3

Several developers, especially those familiar with equivalent functionality in Eclipse, have been asking for so-called "Save Actions", that is, support for actions that are automatically performed when a file is saved.

Here's the related NetBeans issue:  

In NetBeans IDE 7.3, the issue is resolved as follows:

  1. A new "On Save" tab is found in the "Editor" tab of the Options window. Defaults for all languages are set via the "All Languages" item in the drop-down. Here, for all languages, you can specify what kind (all, none, or only modified lines) of formatting and space removal will occur automatically when a file is saved:

  2. Via the drop-down, you see all the languages supported by the IDE:

  3. You can pick a language and then override the default On Save settings:

  4. Per language, there may be additional On Save settings. For example, for Java, you can specify that, when saving a Java file, unused import statements should be removed and/or the rules you've set for organizing import statements should be applied:

There's also a set of new NetBeans IDE APIs for adding new On Save functionality via custom plugins. Via MIME type registration of OnSaveTask.Factory, you can register new On Save actions that will be run for files conforming to the relevant MIME type. There's also extensions via the Editor Options API for registering new panels (one per language) to the On Save panel in the Options window. I'll demonstrate some examples of the APIs in upcoming blog entries.

Thursday Oct 25, 2012

NASCIO Award for NetBeans Platform Legislative Software

Two days ago, 23 October 2012, the Kansas Legislative Information System and Services (KLISS) was awarded the 2012 NASCIO Award for Open Government at the NASCIO annual State IT Recognition awards.

KLISS is developed by Propylon in partnership with the executive and legislative branches of the Kansas Government involving a complete overhaul of the Legislature's IT systems.

This video gives an overview of the system:

In other good news, Propylon has recently announced that it will work with the Indiana Legislative Services Agency to implement a complete Legislative Enterprise Architecture.

For details on the NetBeans Platform angle to all this, in addition to watching the movie above, see Legislative Software on NetBeans. And note that Java developers with NetBeans Platform experience are welcome to apply to work at Propylon.

And congratulations to the Propylon team!

Wednesday Oct 24, 2012

Exie Builder

Part 1:

Part 2:

Tuesday Oct 23, 2012

TopComponent, Node, Lookup, Palette, and Visual Library

Here's a small example that puts together several pieces in the context of a NetBeans Platform application, i.e., TopComponent, Node, Lookup, Palette, and Visual Library:

The result is a drag-and-drop user interface, i.e., drag items from the palette and drop them onto the window, that's all it does, nothing too fancy, just puts the basic NetBeans Platform pieces together in a pretty standard combination:

Monday Oct 22, 2012

NetBeans IDE 7.3 Keyboard Shortcuts

New keyboard shortcuts in NetBeans IDE 7.3:

  • Ctrl+Shift+D: Show clipboard history.

  • Alt+Shift+L: Copy file path.

  • CTRL+ALT+T: Reopen recently closed document.

  • Ctrl+Shift+S: Turn select mode on/off in embedded browser. 

Also note, Output window has configurable shortcuts now:

Source of the above info:

Saturday Oct 20, 2012

Play Framework Plugin for NetBeans IDE (Part 1)

The start of minimal support for the Play Framework in NetBeans IDE 7.3 Beta would constitute (1) recognizing Play projects, (2) an action to run a Play project, and (3) classpath support.

Well, most of that I've created already, as can be seen, e.g., below you can see logical views in the Projects window for Play projects (i.e., I can open all the samples that come with the Play distribution). Right-clicking a Play project lets you run it and, if the embedded browser is selected in the Options window, you can see the result in the IDE. Make a change to your code and refresh the browser, which immediately shows you your changes:

What needs to be done, among other things:

  • A wizard for creating new Play projects, i.e., it would use the Play command line to create the application and then open it in the IDE.
  • Integration of everything available on the Play command line.
  • Maybe the logical view, i.e., what is shown in the Projects window, should be changed. Right now, only the folders "app" and "test" are shown there, with everything else accessible in the Files window, as can be seen in the screenshot above.
  • More work on the classpath, i.e., I've hardcoded a few things just to get things to work correctly.
  • Options window extension to register the Play executable, instead of the current hardcoded solution.
  • Scala integrations, i.e., investigate if/how the NetBeans Scala plugin is helpful and, if not, create different/additional solutions. E.g., the HTML templates are partly in Scala, i.e., need to embed Scala support into HTML.
  • Hyperlinking in the "routes" file, as well as special support for the "application.conf" file.

Anyone interested, especially if you're a Play fan (a "playboy"?), in joining me in working on this NetBeans plugin? I'll be uploading the sources to a repository soon. It will be here, once it has been made publicly accessible:

Kind of cool detail is that the NetBeans plugin is based on Maven, which means that you could use any Maven-supporting IDE to work on this plugin.

Friday Oct 19, 2012

Implementing the NetBeans Project API on Maven in IntelliJ IDEA

James McGivern, one of the speakers I met at JAX London, is creating media software on the NetBeans Platform. However, he's using Maven and IntelliJ IDEA and one of the features he needs is project support, i.e., the project infrastructure that's part of NetBeans IDE.

The two documents that describe the NetBeans Project API are these:

By combining the above two, you'll understand how to create a project infrastructure on top of the NetBeans Platform with Maven. However, an additional step of complexity is added when IntelliJ IDEA is included into the mix and therefore I created the following screencast which, in 15 minutes, puts all the pieces together.

Be aware that I'm probably not using IntelliJ IDEA and Maven as optimally as I could and I'm publishing this at least partly so that the errors of my ways can be pointed out to me. But, first and foremost, this is especially for you James: 

Note: Intentionally no sound, only callouts explaining what I'm doing. You'll probably need to pause the movie here and there to absorb the text; for details on the text, see the two links referred to above.

Thursday Oct 18, 2012

Glass Fish Release Party in Amsterdam

If you're in Amsterdam on Saturday 20 October, i.e., the day after tomorrow, come to the Bimhuis at 20.30 to attend the release party of the new CD "Glass Fish". Here's a cool movie that explains why and how the music on this brand new CD is so unique:

Wednesday Oct 17, 2012

Play in NetBeans IDE (Part 2)

Peter Hilton was one of many nice people I met for the first time during the last few days constituting JAX London. He did a session today on the Play framework which, if I understand it correctly, is an HTML5 framework. It doesn't use web.xml, Java EE, etc. It uses Scala internally, as well as in its templating language. 

Support for Play would, I guess, based on the little I know about it right now, consist of extending the HTML5 application project, which is new in NetBeans IDE 7.3. The workflow I imagine goes as follows. You'd create a new HTML5 application project, at which point you can choose a variety of frameworks and templates (Coffee Script, Angular, etc), which comes out of the box with the HTML5 support (i.e., Project Easel) in NetBeans IDE 7.3.

Then, once the project is created, you'll right-click it and go to the Project Properties dialog, where you'll be able to enable Play support:

At this stage, i.e., when you've checked the checkbox above and then clicked OK, all the necessary Play files will be added to your project, e.g., the routes file and the application.conf, for example. And then you have a Play application.

Creating support in this way entails nothing more than creating a module that looks like this, i.e., with one Java class, where even the layer.xml file below is superfluous:

All the code in the that you see above is as follows:

import java.awt.BorderLayout;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
import org.openide.util.Lookup;

public class PlayEnablerPanel implements ProjectCustomizer.CompositeCategoryProvider {

            projectType = "org.netbeans.modules.web.clientproject", 
            position = 1000)
    public static PlayEnablerPanel enablePlay() {
        return new PlayEnablerPanel();
    public Category createCategory(Lookup lkp) {
        return ProjectCustomizer.Category.create("Play Framework", "Configure Play", null);

    public JComponent createComponent(Category ctgr, Lookup lkp) {
        JPanel playPanel = new JPanel(new BorderLayout());
        playPanel.add(new JCheckBox("Enable Play"), BorderLayout.NORTH);
        return playPanel;

Looking forward to having a beer with Peter soon (he lives not far away, in Rotterdam) to discuss this! Also read Part 1 of this series, which I wrote some time ago, and which has other ideas and considerations.

Tuesday Oct 16, 2012

HTML5 Front End for an Existing Java EE Application

Go here to see a complete HTML5 front end for the  NetBeans E-commerce Tutorial, which creates the Affable Bean Project:

The process of creating the HTML5 implementation of the project is described by David Konecny in this JavaOne session (there's a link to a screencast and a downloadable MP4 in the link below):

The high level steps described in the session are as follows:

server-side work:

  • add REST services
  • configure JSON providers
  • enable CORS (cross origin resource sharing)

client-side work:

  • pick an MVC framework (JavaScript one)
  • write code which talks to REST services
  • write the app UI using HTML5 and your MVC framework
  • write unit tests for the app
  • package the app inside the original Java Web app 

Here's two screenshots, one showing the server side, the other the client side, downloadable from the link with which this blog entry started.

Monday Oct 15, 2012

HTML5 Development for Dummies

What's HTML5 all about and what does it actually mean, concretely, to develop HTML5 applications? NetBeans IDE 7.3 provides something called "Project Easel", which is a bundling of HTML5-related tools into a coherent toolset.

Within a matter of hours, you'll know everything you need to know about what all this is about if you follow the steps below. 

  1. Get A Solid Overview. Start by viewing this screencast from JavaOne 2012 (click the media link on the right side once you've clicked the link below, a downloadable MP4 file is also available there):

    That is an awesome way to get you in the right mindframe for what HTML5 is and how it fits into the programming world, together with a very cool and entertaining demo, presented by JB Brock. He starts with about three slides and then does a super awesome demo that puts you into the picture very quickly.

  2. Understand How HTML5 Relates To Java EE. Now here's a very cool follow up to the above, again demo-driven (click the media links on the right side once you've clicked the link below):

    David Konecny takes the Affable Bean project created via the NetBeans E-commerce Tutorial and creates an HTML5 front end for it! I.e., you are shown how HTML5 can provide a different front end, as an alternative to JSF. Why would you do that? Well, that's explained in David's session, as well as in JB Brock's session, i.e., choose the right technology for the right situation. Sometimes HTML5 might make sense, other times JSF might make sense.

  3. Follow The NetBeans Screencasts. To revise and firm up everything you've learned from the above two JavaOne sessions, watch two screencasts by Ken Ganfield, part 1, Getting Started with HTML5 and part 2, Working with JavaScript in HTML5 Applications. In particular, you'll learn how NetBeans IDE provides tools to thoroughly cover the needs of HTML5 developers.
Having taken the above three steps, you now have a thorough background, together with an understanding of the tools and procedures needed for creating your own HTML5 applications.

Sunday Oct 14, 2012

Lost in Code?

Sometimes you're coding and you find yourself forgetting your context. For example, look at this situation:

The cursor is on line 52. Imagine you're coding there and you're puzzling on some problem for some time. Wouldn't it be handy to know, without scrolling up (and then back down again to where you were working), what the method signature looks like? And does the method begin two lines above the visible code or 10 lines? That information can now, in NetBeans IDE 7.3 (and already in the 7.3 Beta) very easily be ascertained, by putting the cursor on the closing brace of the code block:

As you can see, a new vertical line is shown parallel to the line numbers, connecting the end of the method with its start, as well as, at the top of the editor, the complete method signature, together with the number of the line on which it's found. Very handy. Same support is found for other file types, such as in JavaScript files.

Saturday Oct 13, 2012

JEditorPane Code Completion (Part 3)

The final step is to put an object into the Lookup on key listening in each of the JEditorPanes, e.g., a "City" object for the CityEditorPane and a "Country" object for the CountryEditorPane. Then, within the CompletionProviders, only add items to the CompletionResultSet if the object of interest is in the Lookup.

The result is that you can then have different code completions in different JEditorPanes, as shown below:

I've also included the Tools | Options | Editor | Code Completion tab, so that the code completion can be customized.

The full source code for the example is here:

Friday Oct 12, 2012

JEditorPane Code Completion (Part 2)

Figured it out! No need to create a fake Java file, unlike what I said in part 1, no need to depend on all the Java Editor modules, if you use DialogBinding.bindComponentToDocument, instead of DialogBinding.bindComponentToFile:

public final class CountryEditorTopComponent extends TopComponent {

    public CountryEditorTopComponent() {


        EditorKit kit = CloneableEditorSupport.getEditorKit("text/plain");
        DialogBinding.bindComponentToDocument(jEditorPane1.getDocument(), 0, 0, jEditorPane1);


The above requires a dependency on Editor Library 2, which is where DialogBinding is found. Aside from that, you need all the dependencies required by the Code Completion API, as described in the Code Completion tutorial on the NetBeans Platform Learning Trail.

Once you've done that, go to the Project Properties dialog of the application and then in the "ide" cluster, include "Plain Editor" and "Plain Editor Library". I.e., two additional JARs only. These two are needed because you've set the MIME type to "text/plain", which is needed because DialogBinding expects the JEditorPane to have a MIME type.

And now everything works. Press Ctrl-Space in your JEditorPane and, because your CompletionProvider is registered in "text/x-dialog-binding" (via the annotation on CompletionProvider), your completion items are displayed. (The only MIME type for binding a document to a component, by default, is "text/x-dialog-binding", which means the next step is for someone to figure out how to support multiple different of such MIME types, since each JEditorPane in your application is likely to require its own specific code completion support.)

I think this is a really workable solution for real scenarios where JEditorPanes in NetBeans Platform applications require code completion.

Update. Part 3 shows how to register multiple CompletionProviders in text/x-dialog-binding, while ensuring that only the appropriate items appear in the code completion.

Thursday Oct 11, 2012

Best JavaOne 2012 Session!

Go here to watch a really cool BOF, which was run late at night at some stage during the past week's JavaOne 2012, and which I really enjoyed even though I was falling asleep due to jetlag. (I literally woke up a few times, which means I must have been sleeping.) I loved it even though it was on a topic that doesn't really interest me as such, I just happen to know the speaker. (And I was too tired to stumble back to the hotel for a nap so thought I'd do so while attending a session thereby killing two birds with one stone.) It's really funny and educational. I won't reveal what it is about.

Guaranteed, if you watch to the end, you'll have a good time and learn a lot. You'll learn WAY more than the narrow confines of the specific topic.


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


  • NetBeans IDE
« October 2012 »