/**
   * Closes the given <code>PageComponent</code>. This method disposes the <code>PageComponent
   * </code>, triggers all necessary events ("focus lost" and "closed"), and will activate another
   * <code>PageComponent</code> (if there is one).
   *
   * <p>Does nothing if this <code>ApplicationPage</code> doesn't contain the given <code>
   * PageComponent</code>.
   *
   * @param pageComponent the <code>PageComponent</code>
   */
  @Override
  public void close(PageComponent pageComponent) {
    if (!pageComponentMap.containsValue(pageComponent)) {
      return;
    }

    if (pageComponent == activeComponent) {
      fireFocusLost(pageComponent);
      activeComponent = null;
    }

    pageComponentMap.remove(pageComponent.getId());
    if (pageComponent instanceof ToolView) {
      ToolView toolView = (ToolView) pageComponent;
      doRemoveToolView(toolView);
    } else if (pageComponent instanceof DocView) {
      // todo - DocView docView = (DocView) pageComponent;
      // todo - doRemoveDocView(docView);
    }

    pageComponent.removePropertyChangeListener(pageComponentUpdater);

    fireHidden(pageComponent);
    fireClosed(pageComponent);

    pageComponent.dispose();

    if (activeComponent == null) {
      setActiveComponent();
    }
  }
 protected void fireFocusLost(PageComponent component) {
   Debug.trace("AbstractApplicationPage.fireFocusLost [" + component + "]");
   component.componentFocusLost();
   for (PageComponentListener listener : pageComponentListeners) {
     listener.componentFocusLost(component);
   }
 }
 private void setActiveSelectionContext() {
   if (activeComponent != null) {
     getSelectionManager().setSelectionContext(activeComponent.getSelectionContext());
   } else {
     getSelectionManager().setSelectionContext(null);
   }
 }
 protected void fireClosed(PageComponent component) {
   Debug.trace("AbstractApplicationPage.fireClosed [" + component + "]");
   component.componentClosed();
   for (PageComponentListener listener : pageComponentListeners) {
     listener.componentClosed(component);
   }
 }