Treetable and beans, confusion

hey all,
I am terrebly confused by treetable. What I need is a tree table that looks like the below.

Only the leave nodes should show data, not the intermediate nodes.
Now, if you get a set of beans from the DB. How would you program the above solution? In the above case 5 beans are showns, but it seems like that the TreetTable requires you to create beans for ‘Southwest’, ‘Arizona’, ‘Central Cal.’, "Nevada’.
I know about ‘’ But that operates on Objects, not beans.

I could manage to make it work though by creating additional beans and put other beans under them. But that looks like a terrble solution to this common problem.
I was hoping to find a function like:
setHierarchy(“region1”, “region2”); and the Hierarchcal container would take care of it based on properties, does that make sense?


I found a acceptable solution by:

  1. Creating a TreeNode object within my view that hold’s the nodes as shown here called ‘Region’. The TreeNode class is a simply bean with a name as getter/setter.

Then I use lambdaj to group my objects like this:

          Group<RegionData> group = group(data,

Then I simply iterate over each group. where the nodes are created as TreeNode, and all ‘data’ nodes will be added ‘as is’ (eg teh RegionData type).

Then I create generatedColumns like this for the rendering portion:

      table.addGeneratedColumn("Name", new Table.ColumnGenerator() {
            public Object generateCell(Table source, Object itemId, Object columnId) {
                String selected = null;
                if (itemId instanceof TreeNode) {
                    TreeNode f = (TreeNode) itemId;
                    selected = f.getName();
                } else if (itemId instanceof RegionData) {
                    RegionData f = (RegionData) itemId;
                    selected = f.getCity();
                return createLabel(itemId, selected);

From a ‘flow’ point of view this made a lot of sense and created fairly clean code.