Window size problem

Hello everyone,

today I’ve noticed a very strange problem. I have a regular Vaadin Window component and I set the following properties on it:

window.setHeight(“50%”);
window.setWidth(“50%”);
window.setModal(true);
window.setResizeable(true);
window.center();

So far so good - but if I now do this:

VerticalLayout layout = new VerticalLayout();
layout.setWidth(“100%”);
layout.setHeight(“100%”);
layout.addComponent(new Label(“just a test”));
window.setContent(layout);

Then I will get a vertical scroll bar on the window, even if the single label has more than enough space. I think this happens because of the small “footer” that gets added to resizeable windows in Vaadin (it contains the handles to resize the window). It seems to me that the vertical space this footer consumes is
not
subtracted from the total available space within the window. For example, let’s say our window is 200px high and the footer takes up 10px. Then the layouter seems to think that for the vertical layout, 200px are available and it will arrange the components accordingly. But then the footer gets added, reducing the space by 10px, and now suddenly the already layed-out contents do not fit anymore vertically, causing the appearance of a vertical scroll bar which exactly scrolls the height the footer has taken away from the window.

The question is: how to fix this? Unfortunately it does not suffice to set the height of the vertical layout to, say, 95%, because the size of the footer is absolute, not relative, so for some window sizes, it will fit nicely, for larger ones we don’t cover the available space and for smaller ones we get scroll bars again where they would not be necessary.

Am I the only one experiencing this? I’m using the default Reindeer CSS theme.

Kind regards,

Martin

I get no scrollbar with your code using Vaadin 7.1.7 and Firefox 25 or IE10

Hi,

thanks for your response. Hm, it’s interesting that you don’t experience this problem. My window is actually more complex than the code posted above, I tried to remove everything that (I thought) is not participating to the problem. Here’s my actual window:

The outermost layout in this window is a vertical layout with its height set to 100%. So I don’t really know where the outer scrollbar comes from. The inner scrollbar is explained simply by the fact that the displayed tree is too large to fit, and the inner scrollbar is intended. Hm… I need to further investigate this problem. But by the looks of it, the outer scrollbar scrolls the exact amount of space that is covered by the window resize handler at the bottom.

EDIT: Ok, this was just a bad coincidence: if I set the window to be non-resizeable, then the outer scroll bar is still present. My problem seems to be somewhere in my UI component hierarchy.

Did you try the debug window (append ?debug to your url)? It can show problems with your layout. See
https://vaadin.com/wiki/-/wiki/Main/Debugging+Vaadin+applications

Hi Johannes,

thanks for the hint - this debug mode is really useful! I’ve managed to get things under control and fix my layout bug with the help of the debug mode.

Thanks,

Martin