- Timestamp:
- 2019-09-19T11:46:51+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java
r15158 r15357 24 24 import java.util.Set; 25 25 import java.util.function.BiConsumer; 26 import java.util.function.Consumer; 26 27 import java.util.function.Function; 27 28 … … 348 349 // Only process complete (final) selection events 349 350 for (int i = e.getFirstIndex(); i <= e.getLastIndex(); i++) { 350 updateBoundsAndShapes(defaultTable.convertRowIndexToModel(i)); 351 } 351 if (i < defaultTable.getRowCount()) { 352 updateBoundsAndShapes(defaultTable.convertRowIndexToModel(i)); 353 } 354 } 355 // Cleanup residual selected bounds which may have disappeared after a filter 356 cleanupResidualBounds(); 352 357 // If needed, adjust map to show all map rectangles and polygons 353 358 if (!mapRectangles.isEmpty() || !mapPolygons.isEmpty()) { … … 405 410 } 406 411 } 412 413 private <T> void doCleanupResidualBounds(Map<Integer, T> map, Consumer<T> removalEffect) { 414 for (Integer i : map.keySet()) { 415 int viewIndex = defaultTable.convertRowIndexToView(i); 416 if (!defaultTable.getSelectionModel().isSelectedIndex(viewIndex)) { 417 removalEffect.accept(map.remove(i)); 418 } 419 } 420 } 421 422 private void cleanupResidualBounds() { 423 doCleanupResidualBounds(mapPolygons, l -> l.forEach(defaultMap::removeMapPolygon)); 424 doCleanupResidualBounds(mapRectangles, defaultMap::removeMapRectangle); 425 } 407 426 } 408 427
Note:
See TracChangeset
for help on using the changeset viewer.