/** close the form */
  public void doClose() {
    // remove ourselves from the properties panel
    getPanel().remove(this);

    // remove the layer painter
    final BaseLayer editorLayer = (BaseLayer) getChart().getLayers().findLayer(editorName);
    editorLayer.removeElement(_myPlotter);

    // are there any items remaining in the editors layer?
    if (editorLayer.size() == 0) {
      // yes, delete the editors layer
      getChart().getLayers().removeThisLayer(editorLayer);
    }

    // trigger a redraw of the plot
    getChart().getLayers().fireExtended();

    // get rid of the drag button processing
    _dragger.setSelected(false);
    _dragger.doClose();

    // ditch our local data
    _myPath = null;
    _safePath = null;
    _myPlotter = null;
    _myList = null;
    _editor = null;
    _subPanel = null;
    _theParent = null;

    // and close the parent
    super.doClose();
  }
示例#2
0
  @Override
  public void fireTracksChanged() {
    // bugger, just double-check that our layers are still in there...

    // do we have a primary?
    if (_thePrimary != null) {
      Layer found = _theLayers.findLayer(_thePrimary.getName());

      // did we find it?
      if (found == null) {
        // aah, what if it's an annotation in a base layer?
        final Enumeration<Editable> enumer = _theLayers.elements();
        while (enumer.hasMoreElements() && (found == null)) {
          final Layer thisL = (Layer) enumer.nextElement();
          if (thisL instanceof BaseLayer) {
            final BaseLayer base = (BaseLayer) thisL;
            final Enumeration<Editable> enumer2 = base.elements();
            while (enumer2.hasMoreElements()) {
              final Editable thisE = enumer2.nextElement();
              if (thisE.getName().equals(_thePrimary.getName())) {
                found = base;
                break;
              }
            }
          }
        }

        // did it work?
        if (found == null) {
          // nope, better ditch the primary
          _thePrimary = null;
        }
      }
    }

    // now the secondaries!!!
    if (_theSecondaries != null) {
      final Vector<WatchableList> secsFound = new Vector<WatchableList>(0, 1);
      for (int i = 0; i < _theSecondaries.length; i++) {
        final WatchableList thisSec = _theSecondaries[i];
        secsFound.add(thisSec);
      }

      // and store the new secs list
      final WatchableList[] demo = new WatchableList[] {};
      _theSecondaries = secsFound.toArray(demo);
    }

    if (_myDataListeners != null) {
      final Iterator<TrackDataListener> iter = _myDataListeners.iterator();
      while (iter.hasNext()) {
        final TrackDataListener list = iter.next();
        list.tracksUpdated(_thePrimary, _theSecondaries);
      }
    }
  }