- Timestamp:
- 2010-02-01T21:56:31+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java
r2879 r2920 142 142 if (consolidatedEvent != null && dataSet != event.getDataset()) { 143 143 fireConsolidatedEvents(inEDTListeners, consolidatedEvent); 144 dataSet = event.getDataset();145 144 consolidatedEvent = null; 146 145 } 147 146 147 dataSet = event.getDataset(); 148 148 149 // Build consolidated event 149 if (consolidatedEvent == null) { 150 consolidatedEvent = event; 151 dataSet = event.getDataset(); 152 } else if (consolidatedEvent instanceof DataChangedEvent) { 153 ((DataChangedEvent)consolidatedEvent).getEvents().add(event); 150 if (event instanceof DataChangedEvent) { 151 // DataChangeEvent can contains other events, so it gets special handling 152 DataChangedEvent dataEvent = (DataChangedEvent) event; 153 if (dataEvent.getEvents() == null) { 154 consolidatedEvent = dataEvent; // Dataset was completely changed, we can ignore older events 155 } else { 156 if (consolidatedEvent == null) { 157 consolidatedEvent = new DataChangedEvent(dataSet, dataEvent.getEvents()); 158 } else if (consolidatedEvent instanceof DataChangedEvent) { 159 List<AbstractDatasetChangedEvent> evts = ((DataChangedEvent) consolidatedEvent).getEvents(); 160 if (evts != null) { 161 evts.addAll(dataEvent.getEvents()); 162 } 163 } else { 164 AbstractDatasetChangedEvent oldConsolidateEvent = consolidatedEvent; 165 consolidatedEvent = new DataChangedEvent(dataSet, dataEvent.getEvents()); 166 ((DataChangedEvent) consolidatedEvent).getEvents().add(oldConsolidateEvent); 167 } 168 } 154 169 } else { 155 consolidatedEvent = new DataChangedEvent(dataSet, 156 new ArrayList<AbstractDatasetChangedEvent>(Arrays.asList(consolidatedEvent))); 170 // Normal events 171 if (consolidatedEvent == null) { 172 consolidatedEvent = event; 173 } else if (consolidatedEvent instanceof DataChangedEvent) { 174 List<AbstractDatasetChangedEvent> evs = ((DataChangedEvent) consolidatedEvent).getEvents(); 175 if (evs != null) { 176 evs.add(event); 177 } 178 } else { 179 consolidatedEvent = new DataChangedEvent(dataSet, 180 new ArrayList<AbstractDatasetChangedEvent>(Arrays.asList(consolidatedEvent))); 181 } 182 157 183 } 158 184 }
Note:
See TracChangeset
for help on using the changeset viewer.