I’ve read through the tutorial which was very good and searched the forums but I’m really struggling with how to bind a tree. I have an object model like:
Project
->List
->List
And I want the tree to display
Project a
->Folder 1
->Folder 2
->Document 1
Project b
->Folder 3
->Folder 4
…
I am not sure if there’s a real good way to bind Project to a BeanItemContainer and implement Hierarchical to accomplish this without writing a lot of code. I don’t see any real good examples. Can someone point me to one?
As you already discovered, the BeanItemContainer doesn’t implement Hierarchical. You have two options; 1, you use HierarchicalContainer and create the wanted properties yourself, or 2, extend BeanItemContainer to support Hierarchical. For the second one you can take a look at the implementation of HierarchicalContainer, which is an extension of the IndexedContainer, and only adds the hierarchy.
Thanks for the suggestions. I think I will stick with the first option. The demo has a really good example of that. Just wanted to make sure I wasn’t missing out on a better way.
Just starting with Vaadin though I’ve been aware of it for some time. Overall - I’m very impressed. I was an early proponent of ZK but their licensing methods turned me off. Hoping this is one of the trickier parts of the framework. Rest of it looks easy and straight-forward.