- Timestamp:
- 2009-09-15T21:16:43+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/download
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r2017 r2142 45 45 46 46 bookmarks = new BookmarkList(); 47 48 /* add a handler for "double click" mouse events */49 MouseListener mouseListener = new MouseAdapter() {50 @Override public void mouseClicked(MouseEvent e) {51 if (e.getClickCount() == 2) {52 //int index = bookmarks.locationToIndex(e.getPoint());53 gui.closeDownloadDialog(true);54 }55 }56 };57 bookmarks.addMouseListener(mouseListener);58 59 47 bookmarks.getSelectionModel().addListSelectionListener(new ListSelectionListener() { 60 48 public void valueChanged(ListSelectionEvent e) { -
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r2017 r2142 81 81 } 82 82 83 KeyListener osmUrlKeyListener = new KeyListener() {84 public void keyPressed(KeyEvent keyEvent) {}85 public void keyReleased(KeyEvent keyEvent) {86 if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER && parseURL(gui))87 gui.closeDownloadDialog(true);88 }89 public void keyTyped(KeyEvent keyEvent) {}90 };91 92 osmUrl.addKeyListener(osmUrlKeyListener);93 83 osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 94 84 … … 99 89 @Override public void focusGained(FocusEvent e) { 100 90 SwingUtilities.invokeLater(new Runnable() { 101 102 103 91 public void run() { 92 osmUrl.selectAll(); 93 } 104 94 }); 105 95 } … … 123 113 showUrl.setBackground(dlg.getBackground()); 124 114 showUrl.addFocusListener(new FocusAdapter(){ 125 @Override115 @Override 126 116 public void focusGained(FocusEvent e) { 127 117 showUrl.selectAll(); … … 158 148 latlon[2].setText(Double.toString(gui.maxlat)); 159 149 latlon[3].setText(Double.toString(gui.maxlon)); 160 for (JTextField f : latlon) 150 for (JTextField f : latlon) { 161 151 f.setCaretPosition(0); 152 } 162 153 } 163 154 164 155 private void updateUrl(DownloadDialog gui) { 165 156 showUrl.setText(OsmUrlToBounds.getURL(new Bounds( 166 new LatLon(gui.minlat, gui.minlon), new LatLon(gui.maxlat, gui.maxlon))));157 new LatLon(gui.minlat, gui.minlon), new LatLon(gui.maxlat, gui.maxlon)))); 167 158 } 168 159 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r1811 r2142 19 19 import javax.swing.JCheckBox; 20 20 import javax.swing.JLabel; 21 import javax.swing.JOptionPane;22 21 import javax.swing.JPanel; 23 22 import javax.swing.JTabbedPane; … … 47 46 public class DownloadDialog extends JPanel { 48 47 49 // the JOptionPane that contains this dialog. required for the closeDialog() method.50 private JOptionPane optionPane;51 52 48 public interface DownloadTask { 53 49 /** … … 179 175 180 176 getInputMap(WHEN_IN_FOCUSED_WINDOW).put( 181 KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), "checkClipboardContents");177 KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK), "checkClipboardContents"); 182 178 183 179 getActionMap().put("checkClipboardContents", new AbstractAction() { … … 231 227 public void boundingBoxChanged(DownloadSelection eventSource) { 232 228 for (DownloadSelection s : downloadSelections) { 233 if (s != eventSource) s.boundingBoxChanged(this); 229 if (s != eventSource) { 230 s.boundingBoxChanged(this); 231 } 234 232 } 235 233 updateSizeCheck(); … … 242 240 return tabpane.getSelectedIndex(); 243 241 } 244 245 /**246 * Closes the download dialog. This is intended to be called by one of247 * the various download area selection "plugins".248 *249 * @param download true to download selected data, false to cancel download250 */251 public void closeDownloadDialog(boolean download) {252 optionPane.setValue(download ? JOptionPane.OK_OPTION : JOptionPane.CANCEL_OPTION);253 }254 255 /**256 * Has to be called after this dialog has been added to a JOptionPane.257 * @param optionPane258 */259 public void setOptionPane(JOptionPane optionPane) {260 this.optionPane = optionPane;261 }262 242 }
Note:
See TracChangeset
for help on using the changeset viewer.