Empty tree too small for drag-n-drops

I’m having problems drag and dropping items from a populated table to an empty tree. I’m running Vaadin 6.8.2. The code looks like this:


		mainLayout = new VerticalLayout();
		mainLayout.setWidth("50%");
		mainLayout.setHeight("800px");
		mainLayout.setMargin(false, false, false, true);
		mainLayout.setSpacing(true);
		setCompositionRoot(mainLayout);
		
		Panel treePanel = new Panel();
		treePanel.setHeight("220px");
		treePanel.setScrollable(true);
		mainLayout.add(treePanel);
		
		tree = new Tree("Example tree");
		tree.setSizeFull();
		treePanel.add(tree);

However, in the browser the tree is invisible save for the caption, and the ?debug “Analyze layout” option highlights the tree as a thin 2-3 pixel line with the error message “VTree id: PID59 / Height problem: Component with relative height inside a VerticalLayout with no height defined.”

How can I make the tree higher without losing scrollbar capability (which, according to this
thread
is dependent on the tree having an undefined or 100% height?

I managed to solve the overly small tree using the following code:


		VerticalLayout treePanelLayout = new VerticalLayout();
		treePanelLayout.setHeight("200px");
		treePanelLayout.addComponent(tree);
		treePanelLayout.setExpandRatio(tree, 1);
		treePanel.setContent(treePanelLayout);
		mainLayout.addComponent(treePanel);

but I’m still not getting a vertical scrollbar…

Sigh… Right now, it seems we are forced to choose between either having fixed size empty trees without scrollbar capabilities or relative-sized but non-empty trees.

The above code enables drops to empty trees
only because
they are of fixed size (and thus provide a large enough space to drop nodes into). At the same time, this breaks vertical scrollbars.

The below code, on the other hand:


		tree = new Tree("Sökgrupp");
		tree.setSizeUndefined();

		final VerticalLayout treePanelLayout = new VerticalLayout();
		treePanelLayout.addComponent(tree);
		final Panel treePanel = new Panel();
		treePanel.setScrollable(true);
		treePanel.setHeight("100%");
		treePanel.setContent(treePanelLayout);
		
		HorizontalLayout testLayout = new HorizontalLayout();
		testLayout.setWidth("100%");
		testLayout.setHeight("200px");
		testLayout.addComponent(treePanel);

		mainLayout.addComponent(testLayout);

…enables scrollbars but won’t work for drag-n-drop without at least one node in the tree (which provides the necessary space for targetting drops). In my app I want to be able to drag rows from a populated table to an empty tree.

So what do I do now? File a bug or a feature request?

My ugly solution to this was to add an empty String to the container with no children for preventing the tree to dissapear:

sourceContainer.addItem("");
sourceContainer.setChildrenAllowed("", false);

I remove it when some node is dragged onto the tree and add it if nodes are dragged outside tree and tree becomes empty. Ugly but works! What Im trying to accomplish now is to prevent the user from trying to drag it, but couldnt find a way so far.