示例#1
0
  /**
   * Handles the removal of a ViewManager. McV needs to override this so that the stack of
   * previously active ViewManagers is ordered properly. McV uses this method to make the ViewPanel
   * respond immediately to the change.
   *
   * @param viewManager The ViewManager being removed.
   */
  @Override
  public void removeViewManager(ViewManager viewManager) {
    // the ordering of the stack must be preserved! this is the only chance
    // to ensure the ordering if the incoming VM is inactive.
    if (getLastActiveViewManager() != viewManager) {
      previousVMs.remove(viewManager);
      inspectStack("removing inactive vm");
    }

    // now just sit back and let the IDV and setLastActiveViewManager work
    // their magic.
    super.removeViewManager(viewManager);

    // inform UIManager that the VM needs to be dissociated from its
    // ComponentHolder.
    uiManager.removeViewManagerHolder(viewManager);

    // force the layer controls tabs to layout the remaining components,
    // but we don't want to bring it to the front!
    uiManager.getViewPanel().getContents().validate();
  }
示例#2
0
  // TODO: when you start removing the debug stuff, just convert the messages
  // to comments.
  @Override
  public void setLastActiveViewManager(ViewManager vm) {
    String debugMsg = "created new vm";
    if (vm != null) {
      if (previousVMs.search(vm) >= 0) {
        debugMsg = "reset active vm";
        previousVMs.remove(vm);
        focusLayerControlsOn(vm, false);
      }
      previousVMs.push(vm);
    } else {
      debugMsg = "removed active vm";

      ViewManager lastActive = getLastActiveViewManager();
      if (lastActive == null) return;

      lastActive.setLastActive(false);

      previousVMs.pop();

      // if there are no more VMs, make sure the IDV code knows about it
      // by setting the last active VM to null.
      if (previousVMs.isEmpty()) {
        super.setLastActiveViewManager(null);
        return;
      }

      lastActive = previousVMs.peek();
      lastActive.setLastActive(true);

      focusLayerControlsOn(lastActive, false);
    }

    inspectStack(debugMsg);
    super.setLastActiveViewManager(previousVMs.peek());

    // start active tab testing
    ComponentHolder holder = uiManager.getViewManagerHolder(previousVMs.peek());
    if ((holder != null) && (holder instanceof McvComponentHolder)) {
      ((McvComponentHolder) holder).setAsActiveTab();
    }
    // stop active tab testing
  }