Changeset 6036 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-06-27T11:49:16+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r5891 r6036 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.awt.event.MouseAdapter; 11 import java.awt.event.MouseEvent; 12 import java.util.ArrayList; 10 13 import java.util.Arrays; 11 14 import java.util.Collection; … … 24 27 import org.openstreetmap.josm.actions.AutoScaleAction; 25 28 import org.openstreetmap.josm.actions.ZoomToAction; 29 import org.openstreetmap.josm.data.osm.OsmPrimitive; 30 import org.openstreetmap.josm.data.osm.RelationMember; 26 31 import org.openstreetmap.josm.data.osm.Way; 27 32 import org.openstreetmap.josm.gui.MapView; … … 31 36 import org.openstreetmap.josm.gui.layer.Layer; 32 37 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 38 import org.openstreetmap.josm.gui.util.HighlightHelper; 33 39 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTable; 34 40 … … 37 43 /** the additional actions in popup menu */ 38 44 private ZoomToGapAction zoomToGap; 45 private HighlightHelper highlightHelper = new HighlightHelper(); 39 46 40 47 /** … … 66 73 KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "selectNextColumnCell"); 67 74 75 initHighlighting(); 76 68 77 // install custom navigation actions 69 78 // … … 89 98 return menu; 90 99 } 91 100 92 101 @Override 93 102 public Dimension getPreferredSize(){ … … 104 113 } 105 114 115 @Override 106 116 public void makeMemberVisible(int index) { 107 117 scrollRectToVisible(getCellRect(index, 0, true)); 118 } 119 120 private void initHighlighting() { 121 getMemberTableModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() { 122 @Override 123 public void valueChanged(ListSelectionEvent lse) { 124 if (Main.isDisplayingMapView()) { 125 Collection<RelationMember> sel = getMemberTableModel().getSelectedMembers(); 126 ArrayList<OsmPrimitive> toHighlight = new ArrayList<OsmPrimitive>(); 127 for (RelationMember r: sel) { 128 if (r.getMember().isUsable()) { 129 toHighlight.add(r.getMember()); 130 } 131 } 132 if (highlightHelper.highlightOnly(toHighlight)) { 133 Main.map.mapView.repaint(); 134 } 135 } 136 }}); 137 if (Main.isDisplayingMapView()) { 138 HighlightHelper.clearAllHighlighted(); 139 Main.map.mapView.repaint(); 140 } 108 141 } 109 142 … … 145 178 private class SelectPreviousColumnCellAction extends AbstractAction { 146 179 180 @Override 147 181 public void actionPerformed(ActionEvent e) { 148 182 int col = getSelectedColumn(); … … 166 200 super.unlinkAsListener(); 167 201 MapView.removeLayerChangeListener(zoomToGap); 202 highlightHelper.clear(); 168 203 } 169 204
Note:
See TracChangeset
for help on using the changeset viewer.