Autoresize Modal Window

Hi everyone,

I want to create a wizzard like modal window, containing contents of different sizes, e.g. small buttons or bigger embedded browsers.
My modal window shall adapt the size of its childs automatically but I’m not able to get this to work. I already read the
forums
and stumpled on the setSizeUndifined() method but still no success.

The relevant code looks like this:

        getWindow().removeAllComponents();
        getWindow().getContent().setSizeUndefined();
        Label label = new  Label("Loooooooooooooooooooooooong Laaaaaaaaaaaabel!");
        label.setSizeUndefined();
        getWindow().addComponent(label);

Any ideas, what I’m doing wrong?

Kind regards!

Try adding to that getWindow().setSizeUndefined. You’d need it for the window, the layout and the label. For the two latter you already have it.

That worked, thanks a lot! :slight_smile:

Is there a way to do the autoresizing stuff on the embedded browser too? A html page has no size like an image file, so it would be hard to get the “size” of the page, I want to embed, right?

What do you mean with the embedded browser? Usually you shouldn’t touch the user’s browser’s size; but it is probably something else that you mean when you said ‘embedded’.

I’m talking about an com.vaadin.ui.Embedded object (Embedded.TYPE_BROWSER) which should display an external page of unknown size.

Ah yes! Yeah if it is plain html page, then I don’t really know where it would fetch a size from, and even if it could, what would the correct size be? plain html is basically viewable in any size, if not some HEIGHT/WIDTH/css parameters override that.