vertical layout and set expand ratio problem

I have following code in project. I want to distribute excessive space to only tabView and i dont want to change topMenu’s size. Now problem is that if i set expand ratio to only tabView Component then topMenu is not visible. I played with size of all these components but nothing worked. However in horizontal layout this code is working.

VerticalLayout layout = new VerticalLayout();
tabView = new TabSheet();

HorizontalLayout topMenu = createMainMenu();
tabView.addTab(tabSheet,"Address Management",null);




layout.setComponentAlignment(tabView, Alignment.TOP_LEFT);
layout.setExpandRatio(tabView, 1.0f);
layout.setComponentAlignment(topMenu, Alignment.TOP_LEFT);


So for now i am using following code, its working fine but with large screen menu is taking too much space.

layout.setExpandRatio(topMenu, 1);
layout.setComponentAlignment(tabView, Alignment.TOP_LEFT);
layout.setExpandRatio(tabView, 10.0f);
layout.setComponentAlignment(topMenu, Alignment.TOP_LEFT);

here i want to expand only second component i.e. tabView.

Can you guys let me know what i am missing here?


Your topMenu height is probably 100%, which means it shrinks to zero height when the tabView expands. Try setting its height as undefined (“-1px”).

Please could someone explain why tabView is able to make topMenu shrink to zero height when it expands? I thought that setting the expand ratio for a component meant it would expand to take up the remaining available space? Surely the space taken up by topMenu shouldn’t be regarded as available?

When vertical layout contains expanded components, the vertical layout tries to ‘wrap’ its unexpanded children as tightly as it can. Yet, the child (topMenu in this case) says it will fill any space allotted by the vertical layout. This resembles the fill-parent/wrap-content paradox, as described here:

However, in this case the algorithm, instead of reverting the child size to undefined, will shrink the child to zero size instead.
I’m not sure but perhaps this behavour should be harmonised with the fill-parent/wrap-content paradox, that is, it should ‘revert’ the unexpanded component sizes to undefined?