Problem withTree Table height in Vaadin 6.8.1

Hello,

I discovered a strange bug in the last release (6.8.1) concerning the height of tree table. It seems that, when displayed, the height of the tree table is not correctly calculated if the page length is set to 0 and if initially the tree table was empty.
To reproduce the bug, follow these steps:

  • Create a tree table with no element displayed and set the length to 0

  • Add some elements in it ← Result: the height of the tree table is still null and the elements are invisible

  • Add some more elements ← This time, it works the size of the tree table is correctly calculated.

    I’ve tested with Vaadin 6.7.9 and 6.8.0 and there is no problem. The problem appears only in the relase 6.8.1

    I’ve created a class to demonstrate the problem. Does anyone have a similar problem? Does anyone have a solution / workaround?

package com.example.sandbox;


import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;

public class TreetableRefreshProblem extends VerticalLayout implements Component {
	private static final long serialVersionUID = -6743364590479894301L;
	private TreeTable table = new TreeTable();
	private BeanItemContainer<User> container = new BeanItemContainer<User>(User.class);
	
	public TreetableRefreshProblem() {
		table.setContainerDataSource(container);
		table.setPageLength(0);
		addComponent(table);
		Button refresh = new Button( "Add two elements");
		addComponent(refresh);
		refresh.addListener(new ClickListener() {
			private static final long serialVersionUID = -5580147800565195598L;
			
			@Override
			public void buttonClick(ClickEvent event) {
				container.addBean(new User("John", "Doe"));
				container.addBean(new User("Mark", "Twain"));
			}
		});
		
		Button reset = new Button( "Reset");
		addComponent(reset);
		reset.addListener(new ClickListener() {
			private static final long serialVersionUID = -8019796795100623552L;

			@Override
			public void buttonClick(ClickEvent event) {
				container.removeAllItems();
			}
		});
	}

	public static class User {
		private String firstName;
		private String lastName;
		
		public User( String firstName, String lastName) {
			this.firstName = firstName;
			this.lastName = lastName;
		}

		public String getFirstName() {
			return firstName;
		}

		public String getLastName() {
			return lastName;
		}
	}
}

After some exploration of vaadin’s source code, I discovered that this bug was created by the commit [23928]
which fixed the issue #6039.
I created a new bug #9203 and reopened #6039.