Changeset 2327 in josm for trunk/src/org/openstreetmap/josm/actions/DownloadAction.java
- Timestamp:
- 27.10.2009 01:21:32 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DownloadAction.java
r2323 r2327 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 7 7 import java.awt.BorderLayout; … … 15 15 16 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask; 17 import org.openstreetmap.josm.actions.downloadtasks.DownloadGpsTask; 18 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 18 19 import org.openstreetmap.josm.actions.downloadtasks.PostDownloadHandler; 19 20 import org.openstreetmap.josm.gui.ExtendedDialog; … … 31 32 */ 32 33 public class DownloadAction extends JosmAction { 34 33 35 34 36 public DownloadDialog dialog; 37 private ExtendedDialog downloadDialog; 35 38 36 39 public DownloadAction() { … … 45 48 */ 46 49 protected ExtendedDialog createUploadDialog() { 47 dialog = new DownloadDialog(); 50 if (dialog == null) 51 dialog = new DownloadDialog(); 52 dialog.restoreSettings(); 48 53 JPanel downPanel = new JPanel(new BorderLayout()); 49 54 downPanel.add(dialog, BorderLayout.CENTER); … … 53 58 new Dimension(1000,600)); 54 59 55 ExtendedDialog dialog = new ExtendedDialog(Main.parent, 60 if (downloadDialog == null) { 61 downloadDialog= new ExtendedDialog(Main.parent, 56 62 tr("Download"), 57 63 new String[] {tr("OK"), tr("Cancel")}); 58 dialog.setContent(downPanel, false /* don't use a scroll pane inside the dialog */); 59 dialog.setButtonIcons(new String[] {"ok", "cancel"}); 60 dialog.setRememberWindowGeometry(prefName, wg); 61 return dialog; 64 downloadDialog.setContent(downPanel, false /* don't use a scroll pane inside the dialog */); 65 downloadDialog.setButtonIcons(new String[] {"ok", "cancel"}); 66 downloadDialog.setRememberWindowGeometry(prefName, wg); 67 } 68 return downloadDialog; 62 69 } 63 70 … … 65 72 ExtendedDialog dlg = createUploadDialog(); 66 73 boolean finish = false; 67 while (!finish) { 74 while (!finish) { 68 75 dlg.showDialog(); 69 Main.pref.put("download.newlayer", dialog.newLayer.isSelected());70 76 if (dlg.getValue() == 1 /* OK */) { 71 Main.pref.put("download.tab", Integer.toString(dialog.getSelectedTab())); 72 for (DownloadTask task : dialog.downloadTasks) { 73 Main.pref.put("download."+task.getPreferencesSuffix(), task.getCheckBox().isSelected()); 74 if (task.getCheckBox().isSelected()) { 75 // asynchronously launch the download task ... 76 Future<?> future = task.download(this, dialog.minlat, dialog.minlon, dialog.maxlat, dialog.maxlon, null); 77 // ... and the continuation when the download task is finished 78 Main.worker.submit(new PostDownloadHandler(task, future)); 79 finish = true; 80 } 77 dialog.rememberSettings(); 78 if (dialog.isDownloadOsmData()) { 79 DownloadOsmTask task = new DownloadOsmTask(); 80 Future<?> future = task.download(this, dialog.getSelectedDownloadArea(), null); 81 Main.worker.submit(new PostDownloadHandler(task, future)); 82 finish = true; 83 } 84 if (dialog.isDownloadGpxData()) { 85 DownloadGpsTask task = new DownloadGpsTask(); 86 Future<?> future = task.download(this,dialog.getSelectedDownloadArea(), null); 87 Main.worker.submit(new PostDownloadHandler(task, future)); 88 finish = true; 81 89 } 82 90 } else {
Note: See TracChangeset
for help on using the changeset viewer.
