Changeset 13261 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-12-30T00:17:44+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r13206 r13261 43 43 import org.openstreetmap.josm.gui.MainApplication; 44 44 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; 45 import org.openstreetmap.josm.gui.util.WindowGeometry; 45 46 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 46 47 import org.openstreetmap.josm.spi.preferences.Config; … … 59 60 * true if the URL needs to be opened in a new layer, false otherwise 60 61 */ 61 private static final BooleanProperty USE_NEW_LAYER = new BooleanProperty("download.newlayer", false); 62 private static final BooleanProperty USE_NEW_LAYER = new BooleanProperty("download.location.newlayer", false); 63 /** 64 * true to zoom to entire newly downloaded data, false otherwise 65 */ 66 private static final BooleanProperty DOWNLOAD_ZOOMTODATA = new BooleanProperty("download.location.zoomtodata", true); 62 67 /** 63 68 * the list of download tasks … … 139 144 all.add(layer, GBC.eop().fill(GBC.BOTH)); 140 145 146 // zoom to downloaded data 147 JCheckBox zoom = new JCheckBox(tr("Zoom to downloaded data")); 148 zoom.setToolTipText(tr("Select to zoom to entire newly downloaded data.")); 149 zoom.setSelected(DOWNLOAD_ZOOMTODATA.get()); 150 all.add(zoom, GBC.eop().fill(GBC.BOTH)); 151 152 ExpertToggleAction.addVisibilitySwitcher(zoom); 153 141 154 ExtendedDialog dialog = new ExtendedDialog(Main.parent, 142 155 tr("Download Location"), … … 148 161 tr("Close dialog and cancel downloading")) 149 162 .configureContextsensitiveHelp("/Action/OpenLocation", true /* show help button */); 163 dialog.setupDialog(); 164 dialog.pack(); 165 dialog.setRememberWindowGeometry(getClass().getName() + ".geometry", 166 WindowGeometry.centerInWindow(Main.parent, dialog.getPreferredSize())); 150 167 if (dialog.showDialog().getValue() == 1) { 151 168 USE_NEW_LAYER.put(layer.isSelected()); 169 DOWNLOAD_ZOOMTODATA.put(zoom.isSelected()); 152 170 remindUploadAddressHistory(uploadAddresses); 153 171 openUrl(Utils.strip(uploadAddresses.getText())); … … 207 225 */ 208 226 public List<Future<?>> openUrl(boolean newLayer, String url) { 209 return realOpenUrl(newLayer, url);227 return openUrl(newLayer, DOWNLOAD_ZOOMTODATA.get(), url); 210 228 } 211 229 … … 217 235 */ 218 236 public List<Future<?>> openUrl(String url) { 219 return realOpenUrl(USE_NEW_LAYER.get(), url); 220 } 221 222 private List<Future<?>> realOpenUrl(boolean newLayer, String url) { 237 return openUrl(USE_NEW_LAYER.get(), DOWNLOAD_ZOOMTODATA.get(), url); 238 } 239 240 /** 241 * Open the given URL. 242 * @param newLayer true if the URL needs to be opened in a new layer, false otherwise 243 * @param zoomToData true to zoom to entire newly downloaded data, false otherwise 244 * @param url The URL to open 245 * @return the list of tasks that have been started successfully (can be empty). 246 * @since 13261 247 */ 248 public List<Future<?>> openUrl(boolean newLayer, boolean zoomToData, String url) { 223 249 Collection<DownloadTask> tasks = findDownloadTasks(url, false); 224 250 … … 235 261 for (final DownloadTask task : tasks) { 236 262 try { 263 task.setZoomAfterDownload(zoomToData); 237 264 result.add(MainApplication.worker.submit(new PostDownloadHandler(task, task.loadUrl(newLayer, url, monitor)))); 238 265 } catch (IllegalArgumentException e) { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractDownloadTask.java
r11774 r13261 79 79 } 80 80 81 /** 82 * Sets whether the map view will zoom to download area after download 83 * @param zoomAfterDownload if true, the map view will zoom to download area after download 84 * @since 11658 85 */ 81 @Override 86 82 public final void setZoomAfterDownload(boolean zoomAfterDownload) { 87 83 this.zoomAfterDownload = zoomAfterDownload; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTask.java
r12634 r13261 128 128 */ 129 129 String getConfirmationMessage(URL url); 130 131 /** 132 * Sets whether the map view will zoom to download area after download 133 * @param zoomAfterDownload if true, the map view will zoom to download area after download 134 * @since 13261 135 */ 136 void setZoomAfterDownload(boolean zoomAfterDownload); 130 137 }
Note:
See TracChangeset
for help on using the changeset viewer.