Vaadin 7 - detecting UI (browser window) resize?

Hi,

I am fairly new to Vaadin so I guess I just need a kick into the right direction.

What I like to accomplish is an application that shows a Google Map fullsize (works fine using the
Google Maps Add On
) with overlay windows. One of the windows should always be positioned on the right side of the browser window.

But how do I listen to a resize in my UI? I tried implementing the ResizeListener but it never fires!?

Some Code of my class

public class MyUI extends UI implements ResizeListener {
private MyWindow myWindow;

  init() {
  ...
  myWindow = new MyWindow()
UI.getCurrent().addWindow(myWindow())
}

  @Override
   public void windowResized(final ResizeEvent e) {
   // TODO Auto-generated method stub
    System.out.println("Resize fired");

  ...
  //Position myWindow on the right side
  myWindow.setPositionX(...);
   }
}

I already tried to move it to the right using css but since the shadow of the box is on the same DOM level as the window the window is moved, but the shadow stays.

thanks in advance for any pointers

Juergen

Have you told the Window you want to listen to its resize events? Also, you’ll probably want to set the window to immediate mode to get the events, well, immediately:

myWindow.addResizeListener(this);
myWindow.setImmediate(true);

I added it, but the resize still isn’t triggered

Ah, sorry, I misread. Window.ResizeListener is for listening the resizing of Windows, that is, “sub-windows”. To listen for the browser window resizes, use Page.addBrowserWindowResizeListener.

thanks, this works perfect!