Changeset 13171 in josm
- Timestamp:
- 2017-11-27T20:19:15+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs/relation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r13130 r13171 10 10 import java.awt.FlowLayout; 11 11 import java.awt.event.ActionEvent; 12 import java.awt.event.MouseAdapter; 13 import java.awt.event.MouseEvent; 12 14 import java.io.IOException; 13 15 import java.net.HttpURLConnection; … … 66 68 private transient OsmDataLayer layer; 67 69 70 /** the editAction used in the bottom panel and for doubleClick */ 71 private EditAction editAction; 72 68 73 /** 69 74 * Replies the {@link OsmDataLayer} this editor is related to … … 85 90 86 91 add(buildButtonPanel(), BorderLayout.SOUTH); 92 childTree.setToggleClickCount(0); 93 childTree.addMouseListener(new MouseAdapter() { 94 @Override 95 public void mouseClicked(MouseEvent e) { 96 if (e.getClickCount() == 2 97 && !e.isAltDown() && !e.isAltGraphDown() && !e.isControlDown() && !e.isMetaDown() && !e.isShiftDown() 98 && childTree.getRowForLocation(e.getX(), e.getY()) == childTree.getMinSelectionRow()) { 99 Relation r = (Relation) childTree.getLastSelectedPathComponent(); 100 if (r.isIncomplete()) { 101 childTree.expandPath(childTree.getSelectionPath()); 102 } else { 103 editAction.actionPerformed(new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null)); 104 } 105 } 106 } 107 }); 87 108 } 88 109 … … 105 126 106 127 // --- 107 EditActioneditAction = new EditAction();128 editAction = new EditAction(); 108 129 childTree.addTreeSelectionListener(editAction); 109 130 pnl.add(new JButton(editAction)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java
r12675 r13171 45 45 * Constructs a new {@code ReferringRelationsBrowser}. 46 46 * @param layer OSM data layer 47 * @param model referrin frelations browser model47 * @param model referring relations browser model 48 48 */ 49 49 public ReferringRelationsBrowser(OsmDataLayer layer, ReferringRelationsBrowserModel model) { … … 62 62 add(new JScrollPane(referrers), BorderLayout.CENTER); 63 63 referrers.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 64 referrers.addMouseListener(new DblClickMouseAdapter()); 64 referrers.addMouseListener(new MouseAdapter() { 65 @Override 66 public void mouseClicked(MouseEvent e) { 67 if (e.getClickCount() == 2 68 && !e.isAltDown() && !e.isAltGraphDown() && !e.isControlDown() && !e.isMetaDown() && !e.isShiftDown() 69 && referrers.getCellBounds(referrers.getSelectedIndex(), referrers.getSelectedIndex()).contains(e.getPoint())) { 70 editAction.actionPerformed(new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null)); 71 } 72 } 73 }); 65 74 66 75 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); … … 171 180 } 172 181 } 173 174 class DblClickMouseAdapter extends MouseAdapter {175 @Override176 public void mouseClicked(MouseEvent e) {177 if (e.getClickCount() == 2) {178 editAction.run();179 }180 }181 }182 182 }
Note:
See TracChangeset
for help on using the changeset viewer.