示例#1
0
文件: JSheet.java 项目: karlvr/Quaqua
  /**
   * Uninstalls the sheet on the owner. This method is invoked immediately after the JSheet is
   * hidden.
   */
  protected void uninstallSheet() {
    if (isInstalled) {
      Window owner = getOwner();
      if (owner != null) {
        if (isExperimentalSheet()) {
          owner.removeWindowListener(windowEventHandler);
        } else {
          // Note: We mustn't change the windows focusable state
          // because
          // this also affects the focusable state of the JSheet.
          // owner.setFocusableWindowState(true);
          owner.setEnabled(true);
          // ((JFrame) owner).setResizable(true);
          owner.removeComponentListener(ownerMovementHandler);

          if (shiftBackLocation != null) {
            owner.setLocation(shiftBackLocation);
          }
          if (oldFocusOwner != null) {
            owner.toFront();
            oldFocusOwner.requestFocus();
          }
        }
      }
      isInstalled = false;
    }
  }
  private void resetWindow() {
    if (myWindow != null && getWndManager() != null) {
      getWndManager().resetWindow(myWindow);
      if (myWindowListener != null) {
        myWindow.removeWindowListener(myWindowListener);
      }

      if (myWindow instanceof JWindow) {
        ((JWindow) myWindow).getRootPane().putClientProperty(KEY, null);
      }

      myWindow = null;
      myWindowListener = null;
    }
  }
  public void setPalette(Window newValue) {
    AbstractOSXApplication application = getApplication();
    if (palette != null) {
      palette.removeWindowListener(windowHandler);
    }

    palette = newValue;

    if (palette != null) {
      palette.addWindowListener(windowHandler);
      if (getValue(Actions.SELECTED_KEY) == Boolean.TRUE) {
        application.addPalette(palette);
        palette.setVisible(true);
      } else {
        application.removePalette(palette);
        palette.setVisible(false);
      }
    }
  }
 private void uninstallListeners() {
   if (myWindow != null) {
     myWindow.removeWindowListener(myWindowListener);
     myWindow.removePropertyChangeListener(myPropertyChangeListener);
   }
 }