Changeset 12014 in josm for trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
- Timestamp:
- 2017-04-28T14:36:21+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r11712 r12014 50 50 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 51 51 import org.openstreetmap.josm.tools.JosmRuntimeException; 52 import org.openstreetmap.josm.tools.ListenerList; 52 53 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 53 54 import org.openstreetmap.josm.tools.Utils; … … 156 157 private Collection<WaySegment> highlightedVirtualNodes = new LinkedList<>(); 157 158 private Collection<WaySegment> highlightedWaySegments = new LinkedList<>(); 159 private final ListenerList<HighlightUpdateListener> highlightUpdateListeners = ListenerList.create(); 158 160 159 161 // Number of open calls to beginUpdate … … 161 163 // Events that occurred while dataset was locked but should be fired after write lock is released 162 164 private final List<AbstractDatasetChangedEvent> cachedEvents = new ArrayList<>(); 163 164 private int highlightUpdateCount;165 165 166 166 private UploadPolicy uploadPolicy; … … 267 267 public Lock getReadLock() { 268 268 return lock.readLock(); 269 }270 271 /**272 * This method can be used to detect changes in highlight state of primitives. If highlighting was changed273 * then the method will return different number.274 * @return the current highlight counter275 */276 public int getHighlightUpdateCount() {277 return highlightUpdateCount;278 269 } 279 270 … … 726 717 public Collection<WaySegment> getHighlightedWaySegments() { 727 718 return Collections.unmodifiableCollection(highlightedWaySegments); 719 } 720 721 /** 722 * Adds a listener that gets notified whenever way segment / virtual nodes highlights change. 723 * @param listener The Listener 724 * @since 12014 725 */ 726 public void addHighlightUpdateListener(HighlightUpdateListener listener) { 727 highlightUpdateListeners.addListener(listener); 728 } 729 730 /** 731 * Removes a listener that was added with {@link #addHighlightUpdateListener(HighlightUpdateListener)} 732 * @param listener The Listener 733 * @since 12014 734 */ 735 public void removeHighlightUpdateListener(HighlightUpdateListener listener) { 736 highlightUpdateListeners.removeListener(listener); 728 737 } 729 738 … … 1335 1344 1336 1345 void fireHighlightingChanged() { 1337 highlightUpdateCount++; 1346 HighlightUpdateListener.HighlightUpdateEvent e = new HighlightUpdateListener.HighlightUpdateEvent(this); 1347 highlightUpdateListeners.fireEvent(l -> l.highlightUpdated(e)); 1338 1348 } 1339 1349
Note:
See TracChangeset
for help on using the changeset viewer.