Changeset 35682 in osm for applications/editors/josm
- Timestamp:
- 2021-01-11T10:02:41+01:00 (4 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java
r35579 r35682 49 49 if (dlg != null && dlg.isVisible()) { 50 50 dlg.doSelectionChanged(selection); 51 } else { 52 dlg = null; 51 53 } 52 54 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
r35476 r35682 35 35 import javax.swing.ListSelectionModel; 36 36 import javax.swing.UIManager; 37 import javax.swing.event.ListSelectionEvent;38 37 import javax.swing.event.ListSelectionListener; 39 38 import javax.swing.table.DefaultTableCellRenderer; … … 138 137 tableModel.updateData(MainApplication.getLayerManager().getEditDataSet().getSelected()); 139 138 }); 140 ImageProvider.get(type);141 139 p.add(jt); 142 140 } … … 170 168 } 171 169 172 /*private OsmPrimitive getSelectedPrimitive() {173 int idx = tbl.getSelectedRow();174 if (idx>= 0) {175 return tableModel.getPrimitiveAt(tbl.convertRowIndexToModel(idx));176 } else {177 return null;178 }179 }*/180 181 170 private final MouseAdapter tableMouseAdapter = new MouseAdapter() { 182 171 @Override … … 189 178 }; 190 179 191 private final ListSelectionListener selectionListener = new ListSelectionListener() { 192 @Override 193 public void valueChanged(ListSelectionEvent e) { 194 currentSelection = getSelectedPrimitives(); 195 if (currentSelection != null && MainApplication.isDisplayingMapView()) { 196 if (highlightHelper.highlightOnly(currentSelection)) { 197 MainApplication.getMap().mapView.repaint(); 198 } 199 } 180 private final ListSelectionListener selectionListener = e -> { 181 currentSelection = getSelectedPrimitives(); 182 if (currentSelection != null && MainApplication.isDisplayingMapView() 183 && highlightHelper.highlightOnly(currentSelection)) { 184 MainApplication.getMap().mapView.repaint(); 200 185 } 201 186 }; … … 297 282 public void actionPerformed(ActionEvent e) { 298 283 String txt = cbTagSet.getText(); 299 System.out.println(txt);284 Logging.debug(txt); 300 285 List<String> history = cbTagSet.getHistory(); 301 286 history.remove(txt); … … 377 362 } 378 363 } 364 365 @Override 366 public void setVisible(boolean visible) { 367 super.setVisible(visible); 368 if (!visible) { 369 tableModel.updateData(Collections.emptyList()); 370 } 371 } 379 372 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java
r35436 r35682 7 7 import java.util.HashSet; 8 8 import java.util.List; 9 import java.util.Locale; 9 10 import java.util.Set; 11 import java.util.stream.Collectors; 10 12 11 13 import javax.swing.JTable; … … 28 30 public class MultiTaggerTableModel extends AbstractTableModel implements DataSelectionListener { 29 31 30 ArrayList<OsmPrimitive> list = new ArrayList<>(50);32 List<OsmPrimitive> list = new ArrayList<>(); 31 33 String[] mainTags = new String[]{}; 32 34 boolean[] isSpecialTag = new boolean[]{}; … … 67 69 String var = mainTags[columnIndex-1]; 68 70 OsmPrimitive p = list.get(rowIndex); 69 if (var.equals("id")) { 71 switch (var) { 72 case "id": 70 73 return String.valueOf(p.getUniqueId()); 71 } else if (var.equals("type")) {72 return OsmPrimitiveType.from(p).getAPIName().substring(0, 1).toUpperCase( );73 } else if (var.equals("area")) {74 if (p.getDisplayType() == OsmPrimitiveType.CLOSEDWAY) {74 case "type": 75 return OsmPrimitiveType.from(p).getAPIName().substring(0, 1).toUpperCase(Locale.ENGLISH); 76 case "area": 77 if (p.getDisplayType() == OsmPrimitiveType.CLOSEDWAY) 75 78 return String.format("%.1f", Geometry.closedWayArea((Way) p)); 76 } else { 77 return ""; 78 } 79 } else if (var.equals("length")) { 80 if (p instanceof Way) { 79 break; 80 case "length": 81 if (p instanceof Way) 81 82 return String.format("%.1f", ((Way) p).getLength()); 82 } 83 break; 84 default: 83 85 } 84 86 return ""; … … 179 181 if (table.isEditing()) table.getCellEditor().stopCellEditing(); 180 182 181 list.clear(); 182 for (OsmPrimitive p : sel) { 183 if (shownTypes.contains(p.getDisplayType())) { 184 list.add(p); 185 } 186 } 183 list = sel.stream().filter(p -> shownTypes.contains(p.getDisplayType())).collect(Collectors.toList()); 187 184 fireTableDataChanged(); 188 185 }
Note:
See TracChangeset
for help on using the changeset viewer.