Hi,
it seems today is a rich day for layout questions
In 5.2, when a new Window constructed with the only embedded component inside, which is referencing external image, this window was automatically adjusted it’s size once image is loaded - both width and height was adjusted to image dimensions.
In 5.3 the height is autoset to image height, but the width seems to be equal to window caption and does not adjust when image is loaded, so image looks truncated.
I tried to setWidth(null) for the window but this did not help.
The layout (VerticalLayout) has 100% width by default making it respect the caption width. Use window.getLayout().setSizeUndefined() and it should work.
100% for windows layout is a good default in case one defines the width, but usually this is not the case.
It is a know know inconvenience in our current layout system. To get rid of this we’d need to split Windows and sub windows to be different classes and add some logic to detect default layout, but I’m afraid we have to live this this for a moment now.
Still cannot get autoresize working properly with 5.3, maybe something will make a fresh look and give me glue what is wrong in the following code ?
Actually, I want to open a new modal window with a small image to preview. The window size should be automatically expanded to fit image size. It was working properly in 5.2 but no luck with 5.3 - window’s width is fixed to width of window’s caption, while the height is correctly adjusted by the height of an image:
I tested this myself, and I can confirm the issue. The window width is not affected by the embedded as expected, even if you insert
Window.getLayout().setSizeUndefined() in there.
The size is calculated correctly if you use a long Label instead of an image. So I think the bug is caused by a faulty onload-event handler on the Embedded.
Dimitri, could you file in a bug report for this? Thanks!
Works for me with Vaadin 6.4, at least. Note that the example above is missing the line “zoom.getContent().setSizeUndefined();”.
If you can reproduce this with that correction, please post sample code demonstrating the issue, and indicate with which browser versions you see the issue.