I find it rather odd that clicking 1 on the tree is not observed until I click 2. Or is that not the intent of these listener as oppose Valuechangelistener?
Window mainWindow = new Window();
VerticalLayout demolay = new VerticalLayout();
Tree tree = new Tree();
tree.addItem(1);
tree.addItem(2);
tree.setImmediate(true);
tree.addListener(new ItemClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void itemClick(ItemClickEvent event) {
System.out.println(event.getItemId());
}
});
mainWindow.addComponent(tree);
setMainWindow(mainWindow);