Changeset 104 in josm for src/org/openstreetmap/josm/actions/DownloadAction.java
- Timestamp:
- 2006-07-03T00:31:24+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/actions/DownloadAction.java
r103 r104 1 1 package org.openstreetmap.josm.actions; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import java.awt.Dimension; … … 42 44 import org.openstreetmap.josm.gui.layer.RawGpsLayer; 43 45 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint; 44 import org.openstreetmap.josm.io. OsmServerReader;46 import org.openstreetmap.josm.io.BoundingBoxDownloader; 45 47 import org.openstreetmap.josm.tools.GBC; 46 48 import org.xml.sax.SAXException; … … 55 57 */ 56 58 public class DownloadAction extends JosmAction { 57 58 59 /** 59 60 * Open the download dialog and download the data. … … 61 62 */ 62 63 private final class DownloadOsmTask extends PleaseWaitRunnable { 63 private final OsmServerReader reader;64 private final BoundingBoxDownloader reader; 64 65 private DataSet dataSet; 65 66 66 private DownloadOsmTask( OsmServerReader reader) {67 super( "Downloading data");67 private DownloadOsmTask(BoundingBoxDownloader reader) { 68 super(tr("Downloading data")); 68 69 this.reader = reader; 69 70 reader.setProgressInformation(currentAction, progress); … … 77 78 if (dataSet == null) 78 79 return; // user cancelled download or error occoured 79 if (dataSet. nodes.isEmpty())80 errorMessage = "No data imported.";81 Main.main.addLayer(new OsmDataLayer(dataSet, "Data Layer", false));80 if (dataSet.allPrimitives().isEmpty()) 81 errorMessage = tr("No data imported."); 82 Main.main.addLayer(new OsmDataLayer(dataSet, tr("Data Layer"), false)); 82 83 } 83 84 … … 89 90 90 91 private final class DownloadGpsTask extends PleaseWaitRunnable { 91 private final OsmServerReader reader;92 private final BoundingBoxDownloader reader; 92 93 private Collection<Collection<GpsPoint>> rawData; 93 94 94 private DownloadGpsTask( OsmServerReader reader) {95 super( "Downloading GPS data");95 private DownloadGpsTask(BoundingBoxDownloader reader) { 96 super(tr("Downloading GPS data")); 96 97 this.reader = reader; 97 98 reader.setProgressInformation(currentAction, progress); … … 123 124 new JTextField(9), 124 125 new JTextField(9)}; 125 JCheckBox rawGps = new JCheckBox( "Open as raw gps data", false);126 JCheckBox rawGps = new JCheckBox(tr("Open as raw gps data"), false); 126 127 127 128 public DownloadAction() { 128 super( "Download from OSM", "download", "Download map data from the OSM server.", "Ctrl-Shift-D",129 super(tr("Download from OSM"), "download", tr("Download map data from the OSM server."), tr("Ctrl-Shift-D"), 129 130 KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); 130 131 // TODO remove when bug in Java6 is fixed … … 139 140 WorldChooser wc = new WorldChooser(); 140 141 dlg.add(wc, GBC.eop()); 141 wc.setToolTipText( "Move and zoom the image like the main map. Select an area to download by dragging.");142 wc.setToolTipText(tr("Move and zoom the image like the main map. Select an area to download by dragging.")); 142 143 143 144 // Bounding box edits 144 dlg.add(new JLabel( "Bounding box"), GBC.eol());145 dlg.add(new JLabel( "min lat"), GBC.std().insets(10,0,5,0));145 dlg.add(new JLabel(tr("Bounding box")), GBC.eol()); 146 dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10,0,5,0)); 146 147 dlg.add(latlon[0], GBC.std()); 147 dlg.add(new JLabel( "min lon"), GBC.std().insets(10,0,5,0));148 dlg.add(new JLabel(tr("min lon")), GBC.std().insets(10,0,5,0)); 148 149 dlg.add(latlon[1], GBC.eol()); 149 dlg.add(new JLabel( "max lat"), GBC.std().insets(10,0,5,0));150 dlg.add(new JLabel(tr("max lat")), GBC.std().insets(10,0,5,0)); 150 151 dlg.add(latlon[2], GBC.std()); 151 dlg.add(new JLabel( "max lon"), GBC.std().insets(10,0,5,0));152 dlg.add(new JLabel(tr("max lon")), GBC.std().insets(10,0,5,0)); 152 153 dlg.add(latlon[3], GBC.eol()); 153 154 if (Main.map != null) { … … 161 162 162 163 // OSM url edit 163 dlg.add(new JLabel( "URL from www.openstreetmap.org"), GBC.eol());164 dlg.add(new JLabel(tr("URL from www.openstreetmap.org")), GBC.eol()); 164 165 final JTextField osmUrl = new JTextField(); 165 166 dlg.add(osmUrl, GBC.eop().fill(GBC.HORIZONTAL)); … … 214 215 215 216 // Bookmarks 216 dlg.add(new JLabel( "Bookmarks"), GBC.eol());217 dlg.add(new JLabel(tr("Bookmarks")), GBC.eol()); 217 218 final BookmarkList bookmarks = new BookmarkList(); 218 219 bookmarks.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ … … 231 232 232 233 JPanel buttons = new JPanel(new GridLayout(1,2)); 233 JButton add = new JButton( "Add");234 JButton add = new JButton(tr("Add")); 234 235 add.addActionListener(new ActionListener(){ 235 236 public void actionPerformed(ActionEvent e) { 236 237 Bookmark b = readBookmark(); 237 238 if (b == null) { 238 JOptionPane.showMessageDialog(Main.parent, "Please enter the desired coordinates first.");239 JOptionPane.showMessageDialog(Main.parent, tr("Please enter the desired coordinates first.")); 239 240 return; 240 241 } 241 b.name = JOptionPane.showInputDialog(Main.parent, "Please enter a name for the location.");242 b.name = JOptionPane.showInputDialog(Main.parent,tr("Please enter a name for the location.")); 242 243 if (b.name != null && !b.name.equals("")) { 243 244 ((DefaultListModel)bookmarks.getModel()).addElement(b); … … 247 248 }); 248 249 buttons.add(add); 249 JButton remove = new JButton( "Remove");250 JButton remove = new JButton(tr("Remove")); 250 251 remove.addActionListener(new ActionListener(){ 251 252 public void actionPerformed(ActionEvent e) { 252 253 Object sel = bookmarks.getSelectedValue(); 253 254 if (sel == null) { 254 JOptionPane.showMessageDialog(Main.parent, "Select a bookmark first.");255 JOptionPane.showMessageDialog(Main.parent,tr("Select a bookmark first.")); 255 256 return; 256 257 } … … 270 271 do { 271 272 final JOptionPane pane = new JOptionPane(dlg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 272 final JDialog panedlg = pane.createDialog(Main.parent, "Choose an area");273 final JDialog panedlg = pane.createDialog(Main.parent, tr("Choose an area")); 273 274 bookmarks.addMouseListener(new MouseAdapter(){ 274 275 @Override public void mouseClicked(MouseEvent e) { … … 285 286 b = readBookmark(); 286 287 if (b == null) 287 JOptionPane.showMessageDialog(Main.parent, "Please enter the desired coordinates or click on a bookmark.");288 JOptionPane.showMessageDialog(Main.parent,tr("Please enter the desired coordinates or click on a bookmark.")); 288 289 } while (b == null); 289 290 … … 365 366 */ 366 367 public void download(boolean rawGps, double minlat, double minlon, double maxlat, double maxlon) { 367 OsmServerReader reader = new OsmServerReader(minlat, minlon, maxlat, maxlon);368 BoundingBoxDownloader reader = new BoundingBoxDownloader(minlat, minlon, maxlat, maxlon); 368 369 PleaseWaitRunnable task = rawGps ? new DownloadGpsTask(reader) : new DownloadOsmTask(reader); 369 370 Main.worker.execute(task);
Note:
See TracChangeset
for help on using the changeset viewer.