How Page and setBrowserWindowSize should work?

Hi,

I am trying to find out what is the expected behavior of Page.getCurrent().setBrowserWindowSize(int, int). I tried to use it serveral times and nothing happend.

When I run:

public class BrowserInfoUI extends UI {
	@Override
	public void init(WrappedRequest request) {
		Page page = Page.getCurrent();
		int browserWindowHeight = page.getBrowserWindowHeight();
		addComponent(new Label("browserWindowHeight: " + browserWindowHeight));
		int browserWindowWidth = page.getBrowserWindowWidth();
		addComponent(new Label("browserWindowWidth: " + browserWindowWidth));
	}
}

then there is the following output in browser window:

browserWindowHeight: -1
browserWindowWidth: -1

Well, it might be so that -1 means that the content has full size of the page. That is fine.

When I add one line setting the browser window size:

public class BrowserInfoUI extends UI {
	@Override
	public void init(WrappedRequest request) {

		[b]
Page.getCurrent().setBrowserWindowSize(100, 100);
[/b]

		Page page = Page.getCurrent();
		int browserWindowHeight = page.getBrowserWindowHeight();
		addComponent(new Label("browserWindowHeight: " + browserWindowHeight));
		int browserWindowWidth = page.getBrowserWindowWidth();
		addComponent(new Label("browserWindowWidth: " + browserWindowWidth));
	}
}

it prints:

browserWindowHeight: 100
browserWindowWidth: 100

And nothing happens. I thought that… well at least something (browser window, page, content of the page…) should be resized.

Hi,

There is an open issue (http://dev.vaadin.com/ticket/9073) for making browser window size available in UI.init(). Once this is fixed, you will get something else than -1.

Regarding the setter issue, it seems like an unfortunate naming as the setter is only used when receiving an RPC from the client to update the values in the Page class. It does not actually forward the new size to the client and try to resize anything.