Ejemplo n.º 1
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
  }
Ejemplo n.º 2
0
 /**
  * Add to the properties list
  *
  * @param comps List of label/widgets
  * @param compMap Optional mapping to hold components for later access
  */
 protected void getPropertiesComponents(List comps, Hashtable compMap) {
   super.getPropertiesComponents(comps, compMap);
   startTextFld = new JTextField(startText, 5);
   endTextFld = new JTextField(endText, 5);
   comps.add(GuiUtils.rLabel("Start Label:"));
   comps.add(GuiUtils.left(startTextFld));
   comps.add(GuiUtils.rLabel("End Label:"));
   comps.add(GuiUtils.left(endTextFld));
   maxDistanceFld = null;
   tvm = null;
   if (viewDescriptor != null) {
     VMManager vmManager = control.getControlContext().getIdv().getVMManager();
     List vms = vmManager.getViewManagers(TransectViewManager.class);
     tvm = (TransectViewManager) VMManager.findViewManagerInList(viewDescriptor, vms);
     if ((tvm != null) && (maxDataDistance != null)) {
       maxDistanceFld =
           new JTextField(maxDataDistance.getValue() + " [" + maxDataDistance.getUnit() + "]", 15);
       maxDistanceFld.setToolTipText("Maximum distance shown. e.g.: value[unit]");
       comps.add(GuiUtils.rLabel("Max distance:"));
       comps.add(GuiUtils.left(maxDistanceFld));
     }
   }
 }
Ejemplo n.º 3
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();
  }
Ejemplo n.º 4
0
 /**
  * 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
  */
 @Override
 public void addViewManager(ViewManager newViewManager) {
   super.addViewManager(newViewManager);
   focusLayerControlsOn(newViewManager, false);
 }