Vaadin TreeTable - Path enumeration


trying to get Data out of my Database and built a TreeTable.

My Database looks like:

Now i want to display this in a TreeTable.

Is there any “easy way” to manage this.

And is there a way to get an item id by property?


If by “easy”, you mean automated, then no. It should however be relatively trivial to populate a HierarchicalContainer manually in a loop based on that information, assuming that the data is ordered in the same way as in your example (eg, parent nodes are always before leaves).

The HierarchicalContainer extends an IndexedContainer and thus uses IndexedContainerProperty as its property implementation. IndexedContainerProperty does have a reference to the item id, but does not provide a getter for it.

HierarchicalContainer => Thats helps me a lot :slight_smile:

I will just give the Items the IDs of the Database and then i think i can set the “parents” quiet easy.

Thanks for your help.
Will try this later and give you feedback!

Hey I’ve got another question :frowning:

I’m using Spring Roo with Vaadin.

Between two tables i have not defined any relations.

I was thinking about making a loop to go through the one table and in this loop i do my Query for the other table.

That way I’ve got about 100-150 Requests.

Is there a way to cache my data in Vaadin and just request it if something changes? For example if someone adds sth in a form.

Thank you!

And another problem…

HierarchicalContainer hc = new HierarchicalContainer();
Pattern p = Pattern.compile("([0-9]
        for(Category cat: c) {
            Matcher m = p.matcher(cat.getPath());
            System.out.println("Path: "+cat.getPath());
            if(m.find()) {
            System.out.println("Parent: ";
            System.out.println("hc.setParent("+cat.getId()+", "");");
            hc.setParent(cat.getId().toString(), (String);



But in my Application there are shown NO relations :frowning:

Can give me a hint?


edit.: Dont know why… but it works when i set the Itemid to something like “category_”+c.getId(); .

Well so there’s only the older question left :slight_smile:

Any ideas??