Tree odd behaviour in Liferay Portlet


I’m using vaadin with liferay portlets, and i’m having a small problem with a Tree component. Im using HierarchicalContainer as datasource with lazy loading. I did not implemented any listenner…

|____ Child 1
|____ Child 2
|____ Child 3

If i click in child 1, the tree expands and present childs of child 1. After this, i click in Child 2 and nothing happens: the icon changes but no information is visible or sent (i set some prints on onRequestStart/onRequestEnd methods and no request is done). I click again, the icon changes, then i click again and the icon returns to previous, but no childs. To work, i must first select item in the name and then click int the icon and the tree expands with childs of child 2.

If i click in any child of opened childs (of 1 or 2) the first child works, but the others have the same problem…

Question, why do i need to click in the name first and in the icon to expand?




Thks for reading:)

The main problem is to load children, it’s necessary to click in the name of the item first and then in the icon to expand; Otherwise items are not loaded. This problem occurs for all children at same level except the first one to click.

No solution yet


I’m not quite sure what the problem is here. Are you saying that you expect the node to expand when you click on it (the text)? The Tree component currently only expands if you click on the triangular icon, see
the tree example
in Vaadin Sampler. This is the way it was designed to work.

If you want to expand the nodes when a user selects a node (that has children), you need to implement a ValueChangeListener that checks if this is the case and, if so, expands the node.


I’m saying that when i click on the triangular icon the tree does expand.

For instance, i added ExpandListener to Tree and i have 2 children

|____ > Child 1
|____ > Child 2

When i click in > for child 1 the tree expand and invoke method ExpandListener.nodeExpand, and the tree becomes like this:

|____ v Child 1
|	   |_______ Child 1.1
|____ > Child 2

Now if i click in ">" of child 2 nothing happens ... But if i click in the name "Child 2" and then in ">" of Child 2 then the listenner is invoked and the tree expands.

And this happens to all children, the first one to click works, but the other ones dont. I first need to click "item name" and then ">" to work. It seems that i need to select firt and then use ">" ....

Sounds like a bug. Could you please file a ticket at
? If possible, include a simple test application that shows the problem along with instructions on how to reproduce.


I found the “problem/solution”. I was trying to do lazy loading in getChildren method from container. I removed the overrided from my container and implemented Tree.ExpandListener in tree.

private class MyExpandListener implements Tree.ExpandListener {

	static private final long serialVersionUID = 1L;

	public void nodeExpand(ExpandEvent event) {
	    getWindow().showNotification("Element EXPANDED: " + event.getItemId());
	    final Long elementId = (Long) event.getItemId();
	    final Xpto xpto = Xpto.INFO.get(elementId);

	    final Collection<Long> result = new ArrayList<Long>(xpto.getSortedChildren().size());
	    for (final Xpto child : xpto.getSortedChildren()) {


		setParent(child.getId(), elementId);
		setChildrenAllowed(child.getId(), child.hasAnyChildren());


Lazy loading logic will be in nodeExpand and tree is working normally.