TreeTable repaint and style

Hi,

  1. When i try to run the code below I have to push the button twice to get any results in the treetable.
    Is there something I am missing?

  2. The style on the last button in the tree is not set to BaseTheme.BUTTON_LINK.
    Is that a bug?

Jan Erik.


import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.themes.BaseTheme;

public class TestTreeTable extends AbsoluteLayout {

	private TreeTable treeTable = new TreeTable();

	public TestTreeTable() {
		
		treeTable.setWidth("500px");
		treeTable.setHeight("500px");
		treeTable.addContainerProperty("Name", String.class , null);
		treeTable.addContainerProperty("Button", Button.class , null);
		treeTable.setImmediate(true);

		Button buttonLoad = new Button("Load");
		buttonLoad.addListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				load();	
			}});
	
		setWidth("600px");
		setHeight("600px");
		addComponent(buttonLoad, "top:0px;left:0px");
		addComponent(treeTable, "top:30px;left:0px");
		
	}
		
	void load() {	
		addToTree("TOPNODE", null);
		addToTree("SUBNODE", "TOPNODE");
		addToTree("SUBNODE2", "TOPNODE");	
		treeTable.requestRepaint();
	}
	
	void addToTree(final String node, String parent) {
		Button btnAdd = new Button("Add"); 
		btnAdd.setStyleName(BaseTheme.BUTTON_LINK);
		
		treeTable.addItem(new Object[] { node, btnAdd } , node);
		treeTable.setCollapsed(node, false);

		if (parent != null) { treeTable.setParent(node, parent); }
	}
	
}

Looks like there is a repaint bug in the tree table component.
There has been the same one on the forum
not long ago
.

I think you should open a new bug ticket if there is none already or vote for that bug.

…but first test with the latest 6.7 nightly build. Some TreeTable issues were fixed last week, so this might already be resolved.