Exemplo n.º 1
0
  /**
   * Makes this the active window by showing its shadow, or deactivates it by hiding its shadow.
   * This method also fires the activate or deactivate event depending on which action occurred.
   */
  public void setActive(boolean active) {
    if (active) {
      if (rendered && !maximized && layer != null) {
        if (getShadow()) {
          layer.enableShadow();
        }
        layer.sync(true);
      }
      if (isVisible()) {
        eventPreview.push();

        if (modal && modalPanel == null) {
          modalPanel = ModalPanel.pop();
          modalPanel.setBlink(blinkModal);
          modalPanel.show(this);
        }
      }

      fireEvent(Events.Activate, new WindowEvent(this));
    } else {
      if (modalPanel != null) {
        ModalPanel.push(modalPanel);
        modalPanel = null;
      }
      hideShadow();
      fireEvent(Events.Deactivate, new WindowEvent(this));
    }
  }
Exemplo n.º 2
0
 @Override
 public void setZIndex(int zIndex) {
   super.setZIndex(zIndex);
   if (ghost != null) {
     ghost.setZIndex(zIndex);
   }
   if (modalPanel != null && modalPanel.rendered) {
     modalPanel.el().setZIndex(zIndex - 9);
   }
 }
Exemplo n.º 3
0
  /**
   * Hides the window.
   *
   * @param buttonPressed the button that was pressed or null
   */
  public void hide(Button buttonPressed) {
    if (hidden || !fireEvent(Events.BeforeHide, new WindowEvent(this, buttonPressed))) {
      return;
    }

    if (dragger != null) {
      dragger.cancelDrag();
    }

    hidden = true;

    if (!maximized) {
      restoreSize = getSize();
      restorePos = getPosition(true);
    }

    if (modalPreview != null) {
      modalPreview.removeHandler();
      modalPreview = null;
    }

    onHide();
    manager.unregister(this);
    if (removeFromParentOnHide) {
      removeFromParent();
    }

    if (modalPanel != null) {
      ModalPanel.push(modalPanel);
      modalPanel = null;
    }

    eventPreview.remove();
    notifyHide();

    if (restoreWindowScrolling != null) {
      com.google.gwt.dom.client.Document.get()
          .enableScrolling(restoreWindowScrolling.booleanValue());
    }

    fireEvent(Events.Hide, new WindowEvent(this, buttonPressed));
  }
Exemplo n.º 4
0
 /**
  * True to blink the window when the user clicks outside of the windows bounds (defaults to
  * false). Only applies window model = true.
  *
  * @param blinkModal true to blink
  */
 public void setBlinkModal(boolean blinkModal) {
   this.blinkModal = blinkModal;
   if (modalPanel != null) {
     modalPanel.setBlink(blinkModal);
   }
 }