Icons in Tree

Hi

I would like to use multiple icons in a tree (see attached image) but only the last one is displayed.
So I was wondering if it is possible to use multiple icons in a tree.

Sample of the code I am currently using:


final HierarchicalContainer cont = new HierarchicalContainer();
cont.addContainerProperty("folder-add", Resource.class, new ThemeResource("../runo/icons/16/folder-add.png"));
cont.addContainerProperty("cancel", Resource.class, new ThemeResource("../runo/icons/16/cancel.png"));
cont.addContainerProperty("reload", Resource.class, new ThemeResource("../runo/icons/16/reload.png"));
cont.addContainerProperty("caption", String.class, null);
Tree tree = new Tree();
tree.setContainerDataSource(cont);
tree.setItemIconPropertyId("folder-add");
tree.setItemIconPropertyId("cancel");
tree.setItemIconPropertyId("reload");
tree.setItemCaptionPropertyId("caption");

Only the reload button is displayed.

You can only have one icon in a tree item. The [tt]
setItemIconPropertyId()
[/tt]
sets
the id of the property where the icon resource is found, it doesn’t
add
one.

If you want multiple icons, create an image resource that has those icons. You could even do it dynamically with a StreamResource.

Thank you for the confirmation, Marko.

I think I will wait for the TreeTable component because I want to be able to add checkbox and buttons in my tree as well :bashful:

I’m new with Vaadin and I have need for tree node with multiple icons also. Could you give an example code snippet on how I could get those multiple icons to my nodes using that StreamResource?