/** * Remove the given view manager from the list. * * @param viewManager The view manager to be removed. */ public void removeViewManager(ViewManager viewManager) { if (lastActiveViewManager == viewManager) { setLastActiveViewManager(null); } synchronized (viewManagers) { viewManagers.remove(viewManager); } transectViewsChanged(); }
// 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 }
/** * Add the new view manager into the list if we don't have one with the {@link ViewDescriptor} of * the new view manager already. * * @param newViewManager The new view manager */ public void addViewManager(ViewManager newViewManager) { ViewManager vm = findViewManagerInList(newViewManager.getViewDescriptor()); if (vm == null) { synchronized (viewManagers) { viewManagers.add(newViewManager); } try { Trace.call1("VMManager calling ViewManager.init"); newViewManager.init(); Trace.call2("VMManager calling ViewManager.init"); } catch (Exception exc) { logException("Adding view manager", exc); } setLastActiveViewManager(newViewManager); } getIdvUIManager().viewManagerAdded(newViewManager); }