center window only horizontally

Hi All

I have this window which I used to center like

[code]

public class View extends Window {

public View() {
setModal(true);
setWidth(“50%”);
center();

}

}

[/code]Works great. However, now I would like to set the
Y
(vertical) position of this window, and keep it centered horizontally. If I add, for example,

this.setPositionY(10);

the horizontal position is lost.

Any suggestions how to do this ?

cheers

I guess there center-mode is somehow handled differently in Window, but for me this sound like a bug. Setting Y position should not affect the X position at all.

If you cannot find a solution I suggest to file a bug at
dev.vaadin.com

had the same issue with a difference in that the width of my sub windows was fixed (to 700px)

Thanks to Henri kerola here is how it was solved:

In window there is a getBrowserWindowWidth() which helps in this situation since then you can do something like :

int browserWindowWidth = mainWindow.getBrowserWindowWidth();
subWindow.setPositionX((browserWindowWidth - 700) / 2);
subWindow.setPositionY(190);

hope this may help.