Example #1
0
 @Override
 public void hide(boolean autoClosed) {
   VConsole.log("Hiding popupview");
   syncChildren();
   clearPopupComponentConnector();
   hasHadMouseOver = false;
   shortcutActionHandler = null;
   super.hide(autoClosed);
 }
Example #2
0
  /**
   * Called when the window or parent div might have been resized.
   *
   * <p>This immediately checks the sizes of the window and the parent div (if monitoring it) and
   * triggers layout recalculation if they have changed.
   *
   * @param newWindowWidth The new width of the window
   * @param newWindowHeight The new height of the window
   * @deprecated use {@link #performSizeCheck()}
   */
  @Deprecated
  protected void windowSizeMaybeChanged(int newWindowWidth, int newWindowHeight) {
    if (connection == null) {
      // Connection is null if the timer fires before the first UIDL
      // update
      return;
    }

    boolean changed = false;
    ComponentConnector connector = ConnectorMap.get(connection).getConnector(this);
    if (windowWidth != newWindowWidth) {
      windowWidth = newWindowWidth;
      changed = true;
      connector.getLayoutManager().reportOuterWidth(connector, newWindowWidth);
      VConsole.log("New window width: " + windowWidth);
    }
    if (windowHeight != newWindowHeight) {
      windowHeight = newWindowHeight;
      changed = true;
      connector.getLayoutManager().reportOuterHeight(connector, newWindowHeight);
      VConsole.log("New window height: " + windowHeight);
    }
    Element parentElement = getElement().getParentElement();
    if (isMonitoringParentSize() && parentElement != null) {
      // check also for parent size changes
      int newParentWidth = parentElement.getClientWidth();
      int newParentHeight = parentElement.getClientHeight();
      if (parentWidth != newParentWidth) {
        parentWidth = newParentWidth;
        changed = true;
        VConsole.log("New parent width: " + parentWidth);
      }
      if (parentHeight != newParentHeight) {
        parentHeight = newParentHeight;
        changed = true;
        VConsole.log("New parent height: " + parentHeight);
      }
    }
    if (changed) {
      /*
       * If the window size has changed, layout the VView again and send
       * new size to the server if the size changed. (Just checking VView
       * size would cause us to ignore cases when a relatively sized VView
       * should shrink as the content's size is fixed and would thus not
       * automatically shrink.)
       */
      VConsole.log("Running layout functions due to window or parent resize");

      // update size to avoid (most) redundant re-layout passes
      // there can still be an extra layout recalculation if webkit
      // overflow fix updates the size in a deferred block
      if (isMonitoringParentSize() && parentElement != null) {
        parentWidth = parentElement.getClientWidth();
        parentHeight = parentElement.getClientHeight();
      }

      sendClientResized();

      LayoutManager layoutManager = connector.getLayoutManager();
      if (layoutManager.isLayoutRunning()) {
        layoutManager.layoutLater();
      } else {
        layoutManager.layoutNow();
      }
    }
  }