/**
   * 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();
  }