Vertical Layout In Liferay 6 Portlet

Hi.

Something is weird (translate … I don’t understand).

Code Sample:

public void init() {
	buildMainLayout();
}

private void buildMainLayout()
{
	// Create the main window.
	Window mainWindow = new Window("Hello Vaadin Application");
	setMainWindow(mainWindow);

	// Set the root layout (VerticalLayout is actually the default).
	VerticalLayout rootLayout = new VerticalLayout();
	mainWindow.setContent(rootLayout);
	//		rootLayout.setSizeFull();  // something weird -- don't show up in portlet
	rootLayout.addComponent( new Label( "Test Label " ) );
}

If I run as is (with rootLayout.setSizeFull() commented out), the label is visible. If I uncomment the line and run it, the label disappears. I spent days looking at tutorials thinking it was a project issue and stumbled on this.

Can anyone comment on this behavior.

Thanks In Advance.
Bill Carr

Hi,

I don’t know much about Liferay, but it seems like the problem is that when you set rootLayout to be 100% wide and high the window itself (i.e. the div that the vaadin portlet is rendered into) is of undefined size, causing the dreaded 100% of undefined = disappearing components.

Try to inspect the DOM with firebug or the chrome/safari inspector and make sure that the div containing the portlet has a defined size. If there’s a way to get the debugging window visible, you can use this to analyze the layouts for issues such as this. In normal vaadin applications you just append ?debug to the URL, but I’m not sure whether this works in a portal environment.

Hope something gets you on the correct path. It might be that you just have to define a size for your portlet (or rootLayout) or keep the size of rootLayout undefined.

/Jonatan

Old post and old issue, but: on Liferay, 100% height on the top-level layout does indeed cause problems (except perhaps for views/portlet modes where the portlet fills the page). This is related to how the portal layout and the portlet layout define their sizes and interact with each other on the DOM level - there is probably a ticket about this, but it is not that obvious either what 100% height should mean in a portal layout.