Changeset 1345 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-01-27T19:59:33+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 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) { -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r1339 r1345 46 46 import org.openstreetmap.josm.tools.ImageProvider; 47 47 import org.openstreetmap.josm.tools.OpenBrowser; 48 import org.openstreetmap.josm.tools.UrlLabel; 48 49 import org.openstreetmap.josm.tools.XmlObjectParser; 49 50 import org.xml.sax.SAXException; … … 375 376 @Override public void addToPanel(JPanel p, Collection<OsmPrimitive> sel) { 376 377 if(locale_text == null) 377 locale_text = text == null ? tr(" Open map features in browser") : tr(text);378 locale_text = text == null ? tr("More information about this feature") : tr(text); 378 379 JButton b = new JButton(locale_text); 379 380 b.addActionListener(new ActionListener(){ … … 382 383 } 383 384 }); 384 p.add( b, GBC.eol().anchor(GBC.EAST));385 p.add(new UrlLabel(locale_href, locale_text), GBC.eol().anchor(GBC.WEST)); 385 386 } 386 387 @Override public void addCommands(Collection<OsmPrimitive> sel, List<Command> cmds) {} … … 567 568 return null; 568 569 JPanel p = new JPanel(new GridBagLayout()); 570 LinkedList<Item> l = new LinkedList<Item>(); 569 571 570 572 for (Item i : data) 571 i.addToPanel(p, selected); 573 { 574 if(i instanceof Link) 575 l.add(i); 576 else 577 i.addToPanel(p, selected); 578 } 579 for(Item link : l) 580 link.addToPanel(p, selected); 572 581 return p; 573 582 }
Note:
See TracChangeset
for help on using the changeset viewer.