@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); } } }
private void setPrimaryImpl(final WatchableList primary) { _thePrimary = primary; // and inform the listeners if (_myDataListeners != null) { final Iterator<TrackDataListener> iter = _myDataListeners.iterator(); while (iter.hasNext()) { final TrackDataListener list = iter.next(); list.tracksUpdated(_thePrimary, _theSecondaries); } } }