Changeset 15768 in josm
- Timestamp:
- 2020-01-26T15:43:40+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/TagInfoViewer.java
r15581 r15768 4 4 import java.awt.event.FocusEvent; 5 5 import java.awt.event.FocusListener; 6 import java.util.Arrays;7 6 import java.util.Collection; 8 import java.util. HashMap;7 import java.util.Collections; 9 8 import java.util.Map; 10 9 import java.util.function.IntFunction; … … 16 15 17 16 import org.openstreetmap.josm.data.osm.Tagged; 18 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive;19 17 import org.openstreetmap.josm.gui.dialogs.properties.CopyAllKeyValueAction; 20 18 import org.openstreetmap.josm.gui.dialogs.properties.CopyKeyValueAction; … … 62 60 @Override 63 61 protected JTable buildReferenceTable() { 64 return buildTable(PointInTimeType.REFERENCE_POINT_IN_TIME , "table.referencetagtable", model::getReferencePointInTime);62 return buildTable(PointInTimeType.REFERENCE_POINT_IN_TIME); 65 63 } 66 64 67 65 @Override 68 66 protected JTable buildCurrentTable() { 69 return buildTable(PointInTimeType.CURRENT_POINT_IN_TIME , "table.currenttagtable", model::getCurrentPointInTime);67 return buildTable(PointInTimeType.CURRENT_POINT_IN_TIME); 70 68 } 71 69 72 private JTable buildTable(PointInTimeType pointInTime , String name, Supplier<HistoryOsmPrimitive> histoSp) {70 private JTable buildTable(PointInTimeType pointInTime) { 73 71 TagTableModel tagTableModel = model.getTagTableModel(pointInTime); 74 72 JTable table = new JTable(tagTableModel, new TagTableColumnModel()); 75 table.setName(name);76 73 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 77 74 selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel()); … … 82 79 IntFunction<String> tagKeyFn = x -> (String) table.getValueAt(x, 0); 83 80 IntFunction<Map<String, Integer>> tagValuesFn = x -> { 84 Map<String, Integer> map = new HashMap<>();85 81 String key = tagTableModel.getValue((String) table.getValueAt(x, 0)); 86 82 if (key != null) { 87 map.put(key, 1);83 return Collections.singletonMap(key, 1); 88 84 } 89 return map;85 return Collections.emptyMap(); 90 86 }; 91 Supplier<Collection<? extends Tagged>> objectSp = () -> Arrays.asList(histoSp.get());87 Supplier<Collection<? extends Tagged>> objectSp = () -> Collections.singletonList(model.getPointInTime(pointInTime)); 92 88 93 89 tagMenu.add(trackJosmAction(new CopyValueAction(table, tagKeyFn, objectSp)));
Note:
See TracChangeset
for help on using the changeset viewer.