Geertjan's Blog

  • July 30, 2006

Tree Table Views and Marilyn Monroe

Geertjan Wielenga
Product Manager
There are a few 'holy grails' in the NetBeans APIs. These are API classes that, once you've successfully implemented them, you sit back and go: "Wow. That was tough, I haven't slept for three days, but now it is finally done and the result is really cool." One of these is definitely the MultiView API. Another one is the Explorer API and, specifically, the org.openide.explorer.view package. On Tom Wheeler's NetBeans Site, you'll find the only example of this package (that I know of). If you search for "Todo" on that page, you'll find a downloadable for the "Todo List Manager". It is a standalone application, i.e., not a module (although, of course, it is built out of modules). When you run it you'll see a cool splash screen and then this application (the data in there is mine):

I've been working through that sample, trying to understand it and, specifically, I've been working on creating a TreeTableView. In my mind, the TreeTableView is as much a 'holy grail' as a MultiView editor. It's not easy. You're supposed to use it to display the properties of the node selected in the tree view. So, in the screenshot above, I right-clicked "Christmas Shopping List.tdl" and then all the nodes appeared in the Y axis while the node's properties appeared in the X axis. My first attempt at implementing this myself was without properties. That's also possible and results in the following effect:

Not very useful, except if you'd like to use the tree table view as the tree view (in other words, you wouldn't implement the left side of the screenshot above at all, but only the right side, because you like the table effect, with rows and so on). However, ideally you'd want the node's properties to be displayed in the X axis, so I went a bit further, again using Tom's sample as my reference point, and ended up here:

The properties are hard coded, so that's something I still need to work on. But at least the tree table view is visible and you can see that the correct nodes are displayed. Once I've worked out how the properties work, I will make this sample available here in this blog.

By the way, the top level icon (which in open state is different to when it is closed) comes from a recent commit by Pierre Matthijs to the JFugue Music NotePad project. Thanks, Pierre! Those are great icons and I also re-used your new RootNode.java!

In other news. Friday's blog entry, on Explorer Managers and Marilyn Monroe, is listed in the Marilyn Monroe News! Hurray.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.