Changeset 13660 in josm
- Timestamp:
- 2018-04-23T01:12:25+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java
r13564 r13660 7 7 import java.awt.GridBagConstraints; 8 8 import java.awt.GridBagLayout; 9 import java.awt.event.MouseAdapter; 10 import java.awt.event.MouseEvent; 9 11 import java.util.ArrayList; 12 import java.util.Collections; 10 13 import java.util.List; 11 14 import java.util.Optional; … … 17 20 import javax.swing.JScrollPane; 18 21 22 import org.openstreetmap.josm.actions.AutoScaleAction; 19 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 24 import org.openstreetmap.josm.gui.PrimitiveRenderer; … … 53 57 setLayout(new GridBagLayout()); 54 58 PrimitiveRenderer renderer = new PrimitiveRenderer(); 59 MouseAdapter mouseListener = new MouseAdapter() { 60 @Override 61 public void mouseClicked(MouseEvent evt) { 62 if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { 63 PrimitiveList list = (PrimitiveList) evt.getSource(); 64 int index = list.locationToIndex(evt.getPoint()); 65 AutoScaleAction.zoomTo(Collections.singleton(list.getModel().getElementAt(index))); 66 } 67 } 68 }; 55 69 // initialize the three lists for uploaded primitives, but don't add them to the dialog yet, see setUploadedPrimitives() 56 70 // 57 71 lstAdd = new PrimitiveList(); 58 72 lstAdd.setCellRenderer(renderer); 73 lstAdd.addMouseListener(mouseListener); 59 74 lstAdd.setVisibleRowCount(Math.min(lstAdd.getModel().getSize(), 10)); 60 75 spAdd = new JScrollPane(lstAdd); … … 64 79 lstUpdate = new PrimitiveList(); 65 80 lstUpdate.setCellRenderer(renderer); 81 lstUpdate.addMouseListener(mouseListener); 66 82 lstUpdate.setVisibleRowCount(Math.min(lstUpdate.getModel().getSize(), 10)); 67 83 spUpdate = new JScrollPane(lstUpdate); … … 71 87 lstDelete = new PrimitiveList(); 72 88 lstDelete.setCellRenderer(renderer); 89 lstDelete.addMouseListener(mouseListener); 73 90 lstDelete.setVisibleRowCount(Math.min(lstDelete.getModel().getSize(), 10)); 74 91 spDelete = new JScrollPane(lstDelete);
Note:
See TracChangeset
for help on using the changeset viewer.