HorizontalSplitPanel does not consider rigth component for the size


Problem

HorizontalSplitPanel does not consider right component for the size

If you put two component a left component (ListSelect) an right component (TreeTable) in an HorizontalSplitPanel: The size of the right component is not considered.

Suggestions ?



Vaadin Version
6.7.6



Here is an example:


package com.release5.torvis.application;

import java.util.Arrays;
import java.util.List;

import com.vaadin.Application;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.Window;

public class ResizeVerticalPanel extends Application {

	private TreeTable treetable = new TreeTable();

	private TabSheet panel = new TabSheet();

	private HorizontalSplitPanel horizontalLayout = new HorizontalSplitPanel();

	private static final String[] NAMES = new String[]
 { "Lehtinen", "Sara",
			"Koivuviita", "Grönroos", "Jansson", "Tahven", "Englund",
			"Anonymous", "Ekblad", "Kronqvist", "Leppänen", "Kerola", "Clerc",
			"Muurimaa", "Ahlroos", "Pöntelin", "Raneti", "Laakso", "Schild",
			"Kurki" };

	private static final List<String> cities = Arrays.asList(new String[] {
			"Berlin", "Brussels", "Helsinki", "Montreal", "Oslo", "Paris",
			"Stockholm" });

	@Override
	public void init() {
		Window window = new Window();

		setMainWindow(window);
		window.addComponent(panel);
		panel.setSizeFull();

		panel.addTab(horizontalLayout, "MyTab");
		horizontalLayout.setHeight("100%");

		// column 1
		addColumn1();

		// column 2
		addColumn2();
	}

	private void addColumn1() {

		ListSelect citySelect = new ListSelect("Please select a city", cities);
		horizontalLayout.addComponent(citySelect);

	}

	private void addColumn2() {
		horizontalLayout.addComponent(treetable);
		treetable.setPageLength(0);
		treetable.setHeight("100%");
		treetable.addContainerProperty("name", String.class, "AA");
		for (String name : NAMES) {
			treetable.addItem(new Object[] { name });
		}
	}

}

I am also having the same problem. All I can come up with is to define a height for horizontal split panel.

Hi, this seems to be still the case in Vaadin 7.1.13… =(

With the code given in the earlier post (with setHeight(“100%”) for the right hand component), the second component shouldn’t affect the height of the splitpane, so I believe Vaadin behaves as it should as far as I can understand the description of the problem. I didn’t test the code, though, and the post does not give a screenshot on what is wrong.

If with a valid layout there is a problem with the latest stable release (currently 7.3.0), please
create a ticket
with a minimal UI class that permits reproducing the problem.

I just might be to studip to login to trac or to register.
But here is what I’ve found out about this problem:
With Valo and Vaadin 7.3 the HorizontalSplitPanel looks fine.
With Reindeer and Vaadin 7.3 it doesn’t, see attachment.
What to see here: there should be two Labels on the right side and the HorizontalSplitPanel should be high enough to display these.

Here the minimal code:

package com.example.testsplitpanel;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings("serial")
@Theme("reindeer")
public class TestsplitpanelUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = TestsplitpanelUI.class)
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
        
        VerticalLayout labelsLayout = new VerticalLayout(new Label("Label one"), new Label("Label two"));
        
        
        HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
        hsplit.setWidth("100%");
        
        hsplit.addComponent(new Label("I'm just a Label"));
        hsplit.addComponent(labelsLayout);
        
        Panel panel = new Panel();
        panel.setWidth("100%");
        panel.setContent(hsplit);
        
        layout.addComponent(panel);
    }

}

16421.png

It looks like the outer Panel is redundant, it is enough to have one outer container with undefined height. The left hand side of the split panel affects the height of an undefined height HorizontalSplitPanel, the right hand side doesn’t when using reindeer but does with valo. I don’t know if VerticalSplitPanel has similar issues with respect to its width.

The registration link for the issue tracker is on the top right of
http://dev.vaadin.com/newticket
.