Expanding VerticalLayout Height

I have a problem, I have a verticallayout containing two components(Panel, SplitPanel). I am trying to have the containing layout expand to use the full height of the screen. Below is the code and screenshot. Thanks for any help.

public void init() {
Window mainWindow = new Window(“Mymart Application”);

	VerticalLayout layout = new VerticalLayout();
	layout.setSizeFull();
	layout.setSpacing(true);		
	setTheme("mytheme");		
	
	Panel headerPanel = new Panel();
	headerPanel.addStyleName("bkgrnd");
	Label headerLabel = new Label("My Store");
	headerPanel.addComponent(headerLabel);
	
	BaseView baseView = new BaseView();
	baseView.setHeight("100%");
			
	layout.addComponent(headerPanel);
	layout.addComponent(baseView);	
	layout.setExpandRatio(baseView, 1.0f);		
	
	mainWindow.addComponent(layout);		
	setMainWindow(mainWindow);
}

11242.png

Panels and Windows (Windows extend Panels) have automatically a layout in it when you initialize it. This is something that many are not aware of and this may cause problems.

So when you want a component tree like this:


Window (mainWindow)
`- VerticalLayout (layout)

you actually get


Window (mainWindow)
 `- VerticalLayout (with no direct field in your program)
     `- VerticalLayout (layout)

with the code that you have. Use the getContent / setContent on Panel/Window to access and modify this middle layout.

I suggest you change your second last line, mainWindow.addComponent(layout); to mainWindow.setContnet(layout); to get rid of the extra layout. That might solve some of your problems.

If your problems still persists I think the problem is in the BaseView class.

Thanks, I will try that