Guus Hiddink on the NetBeans Platform

Two days ago I read that Guus Hiddink (one of my favorite famous people, for many different reasons) and a few others were being considered as the next coach of Chelsea. As soon as I see "a few others" of anything (i.e., some kind of array), I can't help but think of child nodes. But this time I also knew about the ODF Toolkit, so I thought it would be fun to start with a spreadsheet, which is called "chelsea.ods" and is located within "/home/geertjan":

That's my spreadsheet. I want to display the first column as child nodes in the IDE:

Here's how to create it (i.e., this is literally all the required code):

public class RootNode extends AbstractNode {

    public RootNode() {
        super(Children.create(new RootChildrenFactory(), true));

    static class RootChildrenFactory extends ChildFactory<String> {

        protected boolean createKeys(List toPopulate) {
            try {
                OdfDocument odfDoc = OdfDocument.loadDocument(new File("/home/geertjan/chelsea.ods"));
                OdfFileDom odfContent = odfDoc.getContentDom();
                XPath xpath = odfDoc.getXPath();
                DTMNodeList nodeList = (DTMNodeList) xpath.evaluate("//table:table-row/table:table-cell[1]", odfContent, XPathConstants.NODESET);
                for (int i = 0; i < nodeList.getLength(); i++) {
                    org.w3c.dom.Node cell = nodeList.item(i);
                    if (!cell.getTextContent().isEmpty()) {
            } catch (Exception ex) {
            return true;

        protected Node createNodeForKey(String key) {
            return new CoachNode(key);

    static class CoachNode extends AbstractNode {

        CoachNode(String key) {

Make sure to put that ODF Toolkit into a library wrapper module and then onto your ui module's classpath, after putting both in a suite.

Then add this to your layer file and you're good to go:

<folder name="UI">
    <folder name="Runtime">
        <file name="org.odftoolkit.ods.RootNode.instance" />

Deploy and your specified ODS file (i.e., a spreadsheet) will have its first column displayed as nodes in the Services window. Welcome to the NetBeans Platform, Guus!


Just for completion, Hiddink is the new Chelsea coach :-)

Posted by Suhail Manzoor on February 11, 2009 at 03:15 AM PST #

I know. :-) But I wish he'd chosen (or been allowed to) between Russia and Chelsea. I guess working for the owner of both has its ups and downs.

Posted by Geertjan on February 11, 2009 at 03:18 AM PST #

Slaven Bilic! :)

Posted by as on February 11, 2009 at 03:19 PM PST #

Lol :D

Posted by Varun on February 12, 2009 at 08:36 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

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.


« August 2015