I need to create a tree whose layout is shown below. I understand that the itemIDs in a tree must me unique. How do I go about doing this?
You are correct, itemIds must be unique. The way I solved this way back when I needed similar functionality was to use generated itemIds and a property for the actual data object. It wasn’t as nice as using the items directly, but it worked:
container.addItemProperty("data", RealDataClass.class, null);
Item i = container.addItem();
i.getItemProperty("data").setValue(actualDataObject);
actualDataObject = tree.getItem(tree.getValue()).getItemProperty("data").getValue();