Changeset 1345 in josm for trunk/src/org/openstreetmap/josm/gui/download
- Timestamp:
- 2009-01-27T19:59:33+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r1336 r1345 20 20 import javax.swing.JTextField; 21 21 import javax.swing.SwingUtilities; 22 import javax.swing.event.DocumentListener; 23 import javax.swing.event.DocumentEvent; 22 24 23 25 import org.openstreetmap.josm.data.Bounds; … … 76 78 } 77 79 80 class osmUrlRefresher implements DocumentListener { 81 public void changedUpdate(DocumentEvent e) { parseURL(gui); } 82 public void insertUpdate(DocumentEvent e) { parseURL(gui); } 83 public void removeUpdate(DocumentEvent e) { parseURL(gui); } 84 } 85 78 86 KeyListener osmUrlKeyListener = new KeyListener() { 79 public void keyPressed(KeyEvent keyEvent) {} 80 81 public void keyReleased(KeyEvent keyEvent) { 82 Bounds b = OsmUrlToBounds.parse(osmUrl.getText()); 83 if (b != null) { 84 gui.minlon = b.min.lon(); 85 gui.minlat = b.min.lat(); 86 gui.maxlon = b.max.lon(); 87 gui.maxlat = b.max.lat(); 88 gui.boundingBoxChanged(BoundingBoxSelection.this); 89 updateBboxFields(gui); 90 updateUrl(gui); 91 if(keyEvent.getKeyCode() == keyEvent.VK_ENTER) 92 gui.closeDownloadDialog(true); 93 } 94 } 95 96 public void keyTyped(KeyEvent keyEvent) {} 87 public void keyPressed(KeyEvent keyEvent) {} 88 public void keyReleased(KeyEvent keyEvent) { 89 if (keyEvent.getKeyCode() == keyEvent.VK_ENTER && parseURL(gui)) 90 gui.closeDownloadDialog(true); 91 } 92 public void keyTyped(KeyEvent keyEvent) {} 97 93 }; 98 94 99 95 osmUrl.addKeyListener(osmUrlKeyListener); 96 osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 100 97 101 98 // select content on receiving focus. this seems to be the default in the … … 145 142 updateUrl(gui); 146 143 } 144 145 private boolean parseURL(DownloadDialog gui) { 146 Bounds b = OsmUrlToBounds.parse(osmUrl.getText()); 147 if(b == null) return false; 148 gui.minlon = b.min.lon(); 149 gui.minlat = b.min.lat(); 150 gui.maxlon = b.max.lon(); 151 gui.maxlat = b.max.lat(); 152 gui.boundingBoxChanged(BoundingBoxSelection.this); 153 updateBboxFields(gui); 154 updateUrl(gui); 155 return true; 156 } 147 157 148 158 private void updateBboxFields(DownloadDialog gui) {
Note:
See TracChangeset
for help on using the changeset viewer.