Changeset 6038 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-06-28T17:39:49+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r6025 r6038 6 6 import java.awt.BorderLayout; 7 7 import java.awt.Color; 8 import java.awt.Component; 8 9 import java.awt.event.ActionEvent; 9 10 import java.awt.event.KeyEvent; … … 20 21 import javax.swing.AbstractListModel; 21 22 import javax.swing.DefaultListSelectionModel; 23 import javax.swing.FocusManager; 22 24 import javax.swing.JComponent; 23 25 import javax.swing.JList; … … 189 191 popupMenuHandler.setPrimitives(sel); 190 192 193 Component focused = FocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); 194 191 195 //update highlights 192 if (Main.isDisplayingMapView()) { 193 highlightHelper.highlightOnly(sel); 194 Main.map.mapView.repaint(); 196 if (focused==displaylist && Main.isDisplayingMapView()) { 197 if (highlightHelper.highlightOnly(sel)) { 198 Main.map.mapView.repaint(); 199 } 195 200 } 196 201 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r6025 r6038 202 202 layer.data.setSelected(Collections.singleton((OsmPrimitive)model.getElementAt(idx))); 203 203 } else if (Main.isDisplayingMapView()) { 204 helper.highlightOnly((OsmPrimitive)model.getElementAt(idx)); 205 Main.map.mapView.repaint(); 204 if (helper.highlightOnly((OsmPrimitive)model.getElementAt(idx))) { 205 Main.map.mapView.repaint(); 206 } 206 207 } 207 208 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r6025 r6038 418 418 int row = membershipTable.rowAtPoint(e.getPoint()); 419 419 if (row>=0) { 420 highlightHelper.highlightOnly((Relation) membershipTable.getValueAt(row, 0)); 421 Main.map.mapView.repaint(); 420 if (highlightHelper.highlightOnly((Relation) membershipTable.getValueAt(row, 0))) { 421 Main.map.mapView.repaint(); 422 } 422 423 } 423 424 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r6024 r6038 609 609 // make sure all registered listeners are unregistered 610 610 // 611 memberTable.stopHighlighting(); 611 612 selectionTableModel.unregister(); 612 613 memberTableModel.unregister(); … … 1358 1359 public void run() { 1359 1360 Main.pref.put("relation.editor.generic.lastrole", tfRole.getText()); 1361 memberTable.stopHighlighting(); 1360 1362 if (getRelation() == null) { 1361 1363 applyNewRelation(); … … 1398 1400 @Override 1399 1401 public void actionPerformed(ActionEvent e) { 1402 memberTable.stopHighlighting(); 1400 1403 if (!memberTableModel.hasSameMembersAs(getRelationSnapshot()) || tagEditorPanel.getModel().isDirty()) { 1401 1404 //give the user a chance to save the changes -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r6036 r6038 21 21 import javax.swing.KeyStroke; 22 22 import javax.swing.ListSelectionModel; 23 import javax.swing.SwingUtilities; 23 24 import javax.swing.event.ListSelectionEvent; 24 25 import javax.swing.event.ListSelectionListener; … … 118 119 } 119 120 120 private void initHighlighting() { 121 getMemberTableModel().getSelectionModel().addListSelectionListener(new ListSelectionListener() { 121 ListSelectionListener highlighterListener = new ListSelectionListener() { 122 122 @Override 123 123 public void valueChanged(ListSelectionEvent lse) { 124 124 if (Main.isDisplayingMapView()) { 125 125 Collection<RelationMember> sel = getMemberTableModel().getSelectedMembers(); 126 ArrayList<OsmPrimitive> toHighlight = new ArrayList<OsmPrimitive>();126 final ArrayList<OsmPrimitive> toHighlight = new ArrayList<OsmPrimitive>(); 127 127 for (RelationMember r: sel) { 128 128 if (r.getMember().isUsable()) { … … 130 130 } 131 131 } 132 if (highlightHelper.highlightOnly(toHighlight)) { 133 Main.map.mapView.repaint(); 134 } 132 SwingUtilities.invokeLater(new Runnable() { 133 @Override 134 public void run() { 135 if (highlightHelper.highlightOnly(toHighlight)) { 136 Main.map.mapView.repaint(); 137 } 138 } 139 }); 135 140 } 136 }}); 141 }}; 142 143 private void initHighlighting() { 144 getMemberTableModel().getSelectionModel().addListSelectionListener(highlighterListener); 137 145 if (Main.isDisplayingMapView()) { 138 146 HighlightHelper.clearAllHighlighted(); … … 200 208 super.unlinkAsListener(); 201 209 MapView.removeLayerChangeListener(zoomToGap); 202 highlightHelper.clear(); 210 } 211 212 public void stopHighlighting() { 213 if (highlighterListener == null) return; 214 getMemberTableModel().getSelectionModel().removeListSelectionListener(highlighterListener); 215 highlighterListener = null; 216 if (Main.isDisplayingMapView()) { 217 HighlightHelper.clearAllHighlighted(); 218 Main.map.mapView.repaint(); 219 } 203 220 } 204 221 -
trunk/src/org/openstreetmap/josm/gui/util/HighlightHelper.java
r6026 r6038 48 48 needsRepaint |= setHighlight(p, true); 49 49 } 50 //return true; 50 51 51 return needsRepaint; 52 52 }
Note:
See TracChangeset
for help on using the changeset viewer.