Download NetBeans!

20071008 Monday October 08, 2007

Marilyn in a J2SE TreeTableView

At the end of yesterday's blog entry, hilz asked about multiple nodes in a TreeTableView. Well, here's the start of something along those lines:

It is the old NetBeans Nodes, Explorer Manager, and Component Palette Tutorial tutorial, but this time with a TreeTableView, and Marilyn isn't on the NetBeans Platform anymore. I just put the NetBeans API JARs into my J2SE application. Here's the source structure:

I put the sample in the Plugin Portal. When you install it, you'll get the info you need about the required JARs (probably the actions JAR isn't needed, actually):

And this is where you can find the sample in the New Project wizard:

I'll be extending the sample when/if I can find some time to do so. For example, in response to the question by Balazs, also at the end of yesterday's blog entry, I have made the first Tree column sortable (as well as adding various colors):

You need to use the TreeColumnTTV property, in order to identify the first column (as described here). Here's the bit of relevant code:

Node[] nodes = categories().getChildren().getNodes();

firstColumnprops = nodes[0].getPropertySets()[0].getProperties();
firstColumnprops[0].setValue("TreeColumnTTV", Boolean.TRUE); //NOI18N
firstColumnprops[0].setValue("SortingColumnTTV", Boolean.TRUE);
firstColumnprops[0].setValue("ComparableColumnTTV", Boolean.TRUE); //NOI18N
marilynTTV.setProperties(firstColumnprops);

secondColumnProps = nodes[1].getPropertySets()[0].getProperties();
secondColumnProps[0].setValue("ComparableColumnTTV", Boolean.TRUE);
marilynTTV.setProperties(secondColumnProps);

marilynTTV.setRootVisible(false);

For me, not only does the sort arrow appear in the column, but it works as expected when I click it. Hope this helps, Balazs!

Oct 08 2007, 11:02:39 AM PDT Permalink