Changeset 18338 in josm
- Timestamp:
- 2021-12-20T16:50:08+01:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/changeset
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java
r17371 r18338 110 110 111 111 private ChangesetCacheManagerModel model; 112 private ChangesetCacheTableRowSorter sorter; 112 113 private JSplitPane spContent; 113 114 private boolean needsSplitPaneAdjustment; … … 272 273 model.getSelectionModel() 273 274 ); 274 tblChangesets.setRowSorter( new ChangesetCacheTableRowSorter(model));275 tblChangesets.setRowSorter(sorter); 275 276 tblChangesets.addMouseListener(new MouseEventHandler()); 276 277 InputMapUtils.addEnterAction(tblChangesets, new ShowDetailAction(model)); … … 304 305 305 306 model = buildModel(); 307 sorter = new ChangesetCacheTableRowSorter(model); 308 model.setChangesetCacheTableRowSorter(sorter); 306 309 actRemoveFromCacheAction = new RemoveFromCacheAction(model); 307 310 actCloseSelectedChangesetsAction = new CloseSelectedChangesetsAction(model); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerModel.java
r17093 r18338 5 5 import java.beans.PropertyChangeSupport; 6 6 import java.util.ArrayList; 7 import java.util.Arrays; 7 8 import java.util.Collection; 8 9 import java.util.Comparator; … … 32 33 private final transient List<Changeset> data = new ArrayList<>(); 33 34 private final DefaultListSelectionModel selectionModel; 35 private transient ChangesetCacheTableRowSorter sorter; 34 36 private transient Changeset changesetInDetailView; 35 37 private final PropertyChangeSupport support = new PropertyChangeSupport(this); … … 88 90 */ 89 91 public List<Changeset> getSelectedChangesets() { 90 List<Changeset> ret = new ArrayList<>(); 91 for (int i = 0; i < data.size(); i++) { 92 Changeset cs = data.get(i); 93 if (selectionModel.isSelectedIndex(i)) { 94 ret.add(cs); 95 } 96 } 97 return ret; 92 return Arrays.stream(TableHelper.getSelectedIndices(selectionModel)) 93 .map(sorter::convertRowIndexToModel).mapToObj(data::get).collect(Collectors.toList()); 98 94 } 99 95 … … 166 162 } 167 163 164 void setChangesetCacheTableRowSorter(ChangesetCacheTableRowSorter sorter) { 165 this.sorter = sorter; 166 } 167 168 168 /* ------------------------------------------------------------------------------ */ 169 169 /* interface ChangesetCacheListener */
Note:
See TracChangeset
for help on using the changeset viewer.