Changeset 2961 in josm for trunk/src/org/openstreetmap/josm/data/osm/history
- Timestamp:
- 2010-02-10T15:23:17+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm/history
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
r2936 r2961 7 7 import java.util.concurrent.CopyOnWriteArrayList; 8 8 9 import org.openstreetmap.josm.Main; 9 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 10 11 import org.openstreetmap.josm.data.osm.PrimitiveId; 11 12 import org.openstreetmap.josm.data.osm.SimplePrimitiveId; 13 import org.openstreetmap.josm.gui.MapView; 14 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 15 import org.openstreetmap.josm.gui.layer.Layer; 12 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 17 … … 17 21 * 18 22 */ 19 public class HistoryDataSet {23 public class HistoryDataSet implements LayerChangeListener{ 20 24 //private final static Logger logger = Logger.getLogger(HistoryDataSet.class.getName()); 21 25 … … 31 35 if (historyDataSet == null) { 32 36 historyDataSet = new HistoryDataSet(); 37 MapView.addLayerChangeListener(historyDataSet); 33 38 } 34 39 return historyDataSet; … … 57 62 for (HistoryDataSetListener l : listeners) { 58 63 l.historyUpdated(this, id); 64 } 65 } 66 67 protected void fireCacheCleared() { 68 for (HistoryDataSetListener l : listeners) { 69 l.historyDataSetCleared(this); 59 70 } 60 71 } … … 151 162 fireHistoryUpdated(null); 152 163 } 164 165 /* ------------------------------------------------------------------------------ */ 166 /* interface LayerChangeListener */ 167 /* ------------------------------------------------------------------------------ */ 168 public void activeLayerChange(Layer oldLayer, Layer newLayer) {/* irrelevant in this context */} 169 public void layerAdded(Layer newLayer) {/* irrelevant in this context */} 170 public void layerRemoved(Layer oldLayer) { 171 if (Main.map == null || Main.map.mapView == null) return; 172 if (Main.map.mapView.getNumLayers() == 0) { 173 data.clear(); 174 fireCacheCleared(); 175 } 176 } 153 177 } -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSetListener.java
r2512 r2961 5 5 6 6 public interface HistoryDataSetListener { 7 /** 8 * Fired by a {@see HistoryDataSet} if the cached history of an OSM primitive with 9 * id <code>id</code> is updated 10 * 11 * @param source the data set firing the event 12 * @param id the id of the updated primitive 13 */ 7 14 void historyUpdated(HistoryDataSet source, PrimitiveId id); 15 16 /** 17 * Fired by a {@see HistoryDataSet} if the history cached is cleared. 18 * 19 * @param source the history data set firing the event 20 */ 21 void historyDataSetCleared(HistoryDataSet source); 8 22 }
Note:
See TracChangeset
for help on using the changeset viewer.