Content of tabsheet disappears until resizing sub window

Hi guys,

I am using tabsheet in my application where I need to resize the sub window depending on if the tabsheet is visible or not. Something like set the subwindow smaller when tabsheet is invisible and bigger when tabsheet is visible. But if I do below actions, resize subwindow (smaller) + set tabsheet invisible → resize subwindow (bigger) + set tabsheet visible. The content of the tabsheet will disappear, it will re-appear when I resize the subwindow using the bottom-right resize button. Here is the test code. Am I missing something like repaint here? (I have tried to requestRepaint of tabsheet.)

Thanks a lot in advance!

package com.example.vaadingtable643;

import com.vaadin.Application;
import com.vaadin.ui.*;
import com.vaadin.ui.Button.ClickEvent;

public class Vaadingtable643Application extends Application implements Button.ClickListener {
	Button bt;
	TabSheet ts;
	Window subWindow;
	@Override
	public void init() {
		Window mainWindow = new Window("Vaadingtable643 Application");
		
		bt = new Button("Click", this);
		
		subWindow = new Window("test win");
		

		
		setMainWindow(mainWindow);
		this.setTheme("chameleon");
		ts = new TabSheet(); 
		
		Table table = new Table("This is my Table");
		table.setSizeFull();
		table.setSelectable(true);
		/* Define the names and data types of columns.
		 * The "default value" parameter is meaningless here. */
		table.addContainerProperty("First Name", String.class,  null);
		table.addContainerProperty("Last Name",  String.class,  null);
		table.addContainerProperty("Year",       Integer.class, null);
		/* Add a few items in the table. */
		table.addItem(new Object[] {
		    "Nicolaus","Copernicus",new Integer(1473)}, new Integer(1));
		table.addItem(new Object[] {
		    "Tycho",   "Brahe",     new Integer(1546)}, new Integer(2));
		table.addItem(new Object[] {
		    "Giordano","Bruno",     new Integer(1548)}, new Integer(3));
		table.addItem(new Object[] {
		    "Galileo", "Galilei",   new Integer(1564)}, new Integer(4));
		table.addItem(new Object[] {
		    "Johannes","Kepler",    new Integer(1571)}, new Integer(5));
		table.addItem(new Object[] {
		    "Isaac",   "Newton",    new Integer(1643)}, new Integer(6));
		
		ts.addTab(table, "test", null);
		
		VerticalLayout verlay = new VerticalLayout();
		
		verlay.addComponent(bt);
		verlay.addComponent(ts);
		verlay.setSizeFull();
		subWindow.addComponent(verlay);
		subWindow.setWidth("800px");
		subWindow.setHeight("500px");
		
		mainWindow.addWindow(subWindow);
	}

	@Override
	public void buttonClick(ClickEvent event) {
		// TODO Auto-generated method stub
		if(ts.isVisible())
		{
			ts.setVisible(false);
			subWindow.setHeight("100px");
		}
		else
		{
			ts.setVisible(true);
			subWindow.setHeight("500px");
		}
	}

}

The layout of your subwindow is invalid, as can also be seen with “Analyze layouts” after adding the URL parameter ?debug .

Even though you set the verlay size as 100%, it goes inside the implicit layout of the subwindow, which has an undefined size.

You can resolve this either by using subWindow.setContent(verlay) instead of subWindow.addComponent(verlay) or by calling subWindow.getContent().setsizeFull().

Thanks this helped.