code: public static void keepWindowInScreen(Window window) {
  		window.setKeepInParentRect(true);
  		if (null != window.getHeightAsString()) {
  			int screenHeight = com.google.gwt.user.client.Window.getClientHeight();
  			int windowHeight = window.getViewportHeight();
  			window.setMaxHeight(screenHeight - WidgetLayout.windowOffset * 2);
  			if (windowHeight + window.getAbsoluteTop() > screenHeight) {
  				int top = screenHeight - windowHeight;
  				if (top >= 0) {
  					window.setPageTop(top);
  				} else {
  					window.setHeight(screenHeight - WidgetLayout.windowOffset);
  					window.setPageTop(WidgetLayout.windowOffset);
  				}
  			}
  		}
  		if (null != window.getWidthAsString()) {
  			int screenWidth = com.google.gwt.user.client.Window.getClientWidth();
  			int windowWidth = window.getViewportWidth();
  			window.setMaxWidth(screenWidth - WidgetLayout.windowOffset * 2);
  			if (windowWidth + window.getAbsoluteLeft() > screenWidth) {
  				int left = screenWidth - windowWidth;
  				if (left >= 0) {
  					window.setPageLeft(left);
  				} else {
  					window.setWidth(screenWidth - WidgetLayout.windowOffset);
  					window.setPageLeft(WidgetLayout.windowOffset);
  				}
  			}
  		}
  	}
docs: Try to force a window to stay within the screen bounds.
  
  @param window window to affect