public void refreshDisplay() throws VisADException, RemoteException {
    if (display == null) return;

    synchronized (displayedThings) {
      for (DataReference ref : displayedThings) {
        display.removeReference(ref);
        display.addReference(ref, colorMaps.get(ref));
      }
    }
  }
  public void reorderDataRefsById(final List<String> dataRefIds) {
    if (dataRefIds == null) throw new NullPointerException("");

    synchronized (displayedThings) {
      try {
        displayedThings.clear();
        for (String refId : dataRefIds) {
          DataReference ref = idToRef.get(refId);
          ConstantMap[] color = colorMaps.get(ref);
          display.removeReference(ref);
          display.addReference(ref, color);
        }
      } catch (Exception e) {
      }
    }
  }
    public DragLine(
        final MultiSpectralDisplay msd,
        final String controlId,
        final ConstantMap[] color,
        float[] YRANGE)
        throws Exception {
      if (msd == null)
        throw new NullPointerException("must provide a non-null MultiSpectralDisplay");
      if (controlId == null) throw new NullPointerException("must provide a non-null control ID");
      if (color == null) throw new NullPointerException("must provide a non-null color");

      this.controlId = controlId;
      this.multiSpectralDisplay = msd;
      this.YRANGE = YRANGE;
      lastSelectedValue = multiSpectralDisplay.getWaveNumber();

      for (int i = 0; i < color.length; i++) {
        mappings[i] = (ConstantMap) color[i].clone();
      }
      mappings[4] = new ConstantMap(-0.5, Display.YAxis);

      Gridded1DSet domain = multiSpectralDisplay.getDomainSet();

      domainType = multiSpectralDisplay.getDomainType();
      rangeType = multiSpectralDisplay.getRangeType();
      tupleType = new RealTupleType(domainType, rangeType);

      selector = new DataReferenceImpl(selectorId);
      line = new DataReferenceImpl(lineId);

      display = multiSpectralDisplay.getDisplay();

      display.addReferences(
          new GrabLineRendererJ3D(domain),
          new DataReference[] {selector},
          new ConstantMap[][] {mappings});
      display.addReference(line, cloneMappedColor(color));

      addReference(selector);
    }
  public void addRef(final DataReference thing, final Color color)
      throws VisADException, RemoteException {
    if (display == null) return;

    synchronized (displayedThings) {
      ConstantMap[] colorMap = makeColorMap(color);

      displayedThings.add(thing);
      idToRef.put(thing.getName(), thing);
      ConstantMap[] constMaps;
      if (data.hasBandNames()) {
        constMaps = new ConstantMap[colorMap.length + 2];
        System.arraycopy(colorMap, 0, constMaps, 0, colorMap.length);
        constMaps[colorMap.length] = new ConstantMap(1f, Display.PointMode);
        constMaps[colorMap.length + 1] = new ConstantMap(5f, Display.PointSize);
      } else {
        constMaps = colorMap;
      }
      colorMaps.put(thing, constMaps);

      display.addReference(thing, constMaps);
    }
  }