Time for action – my first tree
Let's start coding right away! Follow these steps to create your first tree:
Create a new Vaadin project named my-first-tree using your IDE.
Implement your
UI
class like this one:public class MyFirstTreeUI extends UI { protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); Tree familyTree = new Tree(); familyTree.addItem("Families"); familyTree.addItem("The Jackson"); familyTree.addItem("The Simpsons"); familyTree.addItem("The Rothschilds"); familyTree.addItem("The Hapsburgs"); familyTree.addItem("The Addams"); familyTree.setParent("The Jackson", "Families"); familyTree.setParent("The Simpsons", "Families"); familyTree.setParent("The Rothschilds", "Families"); familyTree.setParent("The Hapsburgs", "Families"); familyTree.setParent("The Addams", "Families"); familyTree.setChildrenAllowed(...