Behaviour of a Window opened from a PopupView


I’m experiencing a weird behaviour of a Window opened from a PopupView.
I got Link-Buttons in a PopupView that open a Window on click.
I want to hide the PopupView while the Window is opened and the Window is supposed to be centered.

But this is what happens:
The PopupView is always in the front.
I can either hide the PopupView or center the Window.
Apparently when I call either popupView.setVisible(false) or popupView.setPopupVisible(false), the Window ignores the center() call and the top-left corner of the Window is in the center.

Here is what I’m doing:
Content of the ClickListener:

PopupView parentPopup = (PopupView) root.getParent().getParent().getParent(); parentPopup.setPopupVisible(false); Image img = (Image)event.getButton().getData(); Window win = new ImageWindow(img); UI.getCurrent().addWindow(win); Constructor of ImageWindow:


CssLayout root = new CssLayout();

If I comment out the line parentPopup.setPopupVisible(false); the Window is centered.

Any ideas what I’m doing wrong?

I managed to fix this by setting a constant size for the Image.
Still a bit weird in my oppinion…