- Timestamp:
- 2013-12-28T22:46:44+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r6175 r6555 12 12 import java.util.concurrent.CopyOnWriteArrayList; 13 13 14 import org.openstreetmap.josm.data.osm.Node; 14 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 import org.openstreetmap.josm.data.osm.Relation; 17 import org.openstreetmap.josm.data.osm.Way; 15 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 import org.openstreetmap.josm.tools.Predicate; 20 import org.openstreetmap.josm.tools.Utils; 16 21 17 22 /** … … 37 42 private CopyOnWriteArrayList<IConflictListener> listeners; 38 43 44 private static class FilterPredicate implements Predicate<Conflict<? extends OsmPrimitive>> { 45 46 private final Class<? extends OsmPrimitive> c; 47 48 public FilterPredicate(Class<? extends OsmPrimitive> c) { 49 this.c = c; 50 } 51 52 @Override 53 public boolean evaluate(Conflict<? extends OsmPrimitive> conflict) { 54 return conflict != null && c.isInstance(conflict.getMy()); 55 } 56 } 57 58 private static final FilterPredicate NODE_FILTER_PREDICATE = new FilterPredicate(Node.class); 59 private static final FilterPredicate WAY_FILTER_PREDICATE = new FilterPredicate(Way.class); 60 private static final FilterPredicate RELATION_FILTER_PREDICATE = new FilterPredicate(Relation.class); 61 39 62 /** 40 63 * Constructs a new {@code ConflictCollection}. … … 281 304 } 282 305 306 /** 307 * Adds all conflicts from another collection. 308 * @param other The other collection of conflicts to add 309 */ 283 310 public void add(ConflictCollection other) { 284 311 for (Conflict<?> c : other) { … … 329 356 return conflicts.toString(); 330 357 } 358 359 /** 360 * Returns the list of conflicts involving nodes. 361 * @return The list of conflicts involving nodes. 362 * @since 6555 363 */ 364 public final Collection<Conflict<? extends OsmPrimitive>> getNodeConflicts() { 365 return Utils.filter(conflicts, NODE_FILTER_PREDICATE); 366 } 367 368 /** 369 * Returns the list of conflicts involving nodes. 370 * @return The list of conflicts involving nodes. 371 * @since 6555 372 */ 373 public final Collection<Conflict<? extends OsmPrimitive>> getWayConflicts() { 374 return Utils.filter(conflicts, WAY_FILTER_PREDICATE); 375 } 376 377 /** 378 * Returns the list of conflicts involving nodes. 379 * @return The list of conflicts involving nodes. 380 * @since 6555 381 */ 382 public final Collection<Conflict<? extends OsmPrimitive>> getRelationConflicts() { 383 return Utils.filter(conflicts, RELATION_FILTER_PREDICATE); 384 } 331 385 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r6248 r6555 203 203 public void run() { 204 204 model.fireContentChanged(); 205 updateTitle( conflicts.size());205 updateTitle(); 206 206 } 207 207 }); 208 208 } 209 209 210 private void updateTitle(int conflictsCount) { 210 private void updateTitle() { 211 int conflictsCount = conflicts.size(); 211 212 if (conflictsCount > 0) { 212 setTitle(tr("Conflicts: {0} unresolved", conflicts.size())); 213 setTitle(tr("Conflicts: {0} unresolved", conflicts.size()) + 214 " ("+tr("Rel.:{0} / Ways:{1} / Nodes:{2}", 215 conflicts.getRelationConflicts().size(), 216 conflicts.getWayConflicts().size(), 217 conflicts.getNodeConflicts().size())+")"); 213 218 } else { 214 219 setTitle(tr("Conflict"));
Note:
See TracChangeset
for help on using the changeset viewer.