Changeset 14391 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r14215 r14391 67 67 private static final StringProperty DOWNLOAD_SOURCE_TAB = new StringProperty("download.source.tab", OSMDownloadSource.SIMPLE_NAME); 68 68 private static final BooleanProperty DOWNLOAD_AUTORUN = new BooleanProperty("download.autorun", false); 69 private static final BooleanProperty DOWNLOAD_NEWLAYER = new BooleanProperty("download.newlayer", false);70 69 private static final BooleanProperty DOWNLOAD_ZOOMTODATA = new BooleanProperty("download.zoomtodata", true); 71 70 … … 97 96 protected final DownloadSourceTabs downloadSourcesTab = new DownloadSourceTabs(); 98 97 99 protected JCheckBox cbNewLayer;100 98 protected JCheckBox cbStartup; 101 99 protected JCheckBox cbZoomToDownloadedData; … … 113 111 114 112 protected JButton btnDownload; 113 protected JButton btnDownloadNewLayer; 115 114 protected JButton btnCancel; 116 115 protected JButton btnHelp; … … 155 154 mainPanel.add(dialogSplit, GBC.eol().fill()); 156 155 157 cbNewLayer = new JCheckBox(tr("Download as new layer"));158 cbNewLayer.setToolTipText(tr("<html>Select to download data into a new data layer.<br>"159 +"Unselect to download into the currently active data layer.</html>"));160 161 156 cbStartup = new JCheckBox(tr("Open this dialog on startup")); 162 157 cbStartup.setToolTipText( … … 168 163 cbZoomToDownloadedData.setToolTipText(tr("Select to zoom to entire newly downloaded data.")); 169 164 170 mainPanel.add(cbNewLayer, GBC.std().anchor(GBC.WEST).insets(5, 5, 5, 5));171 165 mainPanel.add(cbStartup, GBC.std().anchor(GBC.WEST).insets(15, 5, 5, 5)); 172 166 mainPanel.add(cbZoomToDownloadedData, GBC.std().anchor(GBC.WEST).insets(15, 5, 5, 5)); … … 189 183 */ 190 184 protected final JPanel buildButtonPanel() { 191 btnDownload = new JButton(new DownloadAction()); 185 btnDownload = new JButton(new DownloadAction(false)); 186 btnDownloadNewLayer = new JButton(new DownloadAction(true)); 192 187 btnCancel = new JButton(new CancelAction()); 193 188 btnHelp = new JButton( … … 197 192 198 193 pnl.add(btnDownload); 194 pnl.add(btnDownloadNewLayer); 199 195 pnl.add(btnCancel); 200 196 pnl.add(btnHelp); … … 205 201 InputMapUtils.enableEnter(btnHelp); 206 202 207 InputMapUtils.addEnterActionWhenAncestor(cbNewLayer, btnDownload.getAction());208 203 InputMapUtils.addEnterActionWhenAncestor(cbStartup, btnDownload.getAction()); 209 204 InputMapUtils.addEnterActionWhenAncestor(cbZoomToDownloadedData, btnDownload.getAction()); … … 297 292 298 293 /** 299 * Replies true if the user requires to download into a new layer300 *301 * @return true if the user requires to download into a new layer302 */303 public boolean isNewLayerRequired() {304 return cbNewLayer.isSelected();305 }306 307 /**308 294 * Replies true if the user requires to zoom to new downloaded data 309 295 * … … 368 354 downloadSourcesTab.getAllPanels().forEach(AbstractDownloadSourcePanel::rememberSettings); 369 355 downloadSourcesTab.getSelectedPanel().ifPresent(panel -> DOWNLOAD_SOURCE_TAB.put(panel.getSimpleName())); 370 DOWNLOAD_NEWLAYER.put(cbNewLayer.isSelected());371 356 DOWNLOAD_ZOOMTODATA.put(cbZoomToDownloadedData.isSelected()); 372 357 if (currentBounds != null) { … … 379 364 */ 380 365 public void restoreSettings() { 381 cbNewLayer.setSelected(DOWNLOAD_NEWLAYER.get());382 366 cbStartup.setSelected(isAutorunEnabled()); 383 367 cbZoomToDownloadedData.setSelected(DOWNLOAD_ZOOMTODATA.get()); … … 475 459 * the download dialog. 476 460 */ 477 public DownloadSettings getDownloadSettings( ) {478 return new DownloadSettings(currentBounds, isNewLayerRequired(), isZoomToDownloadedDataRequired());461 public DownloadSettings getDownloadSettings(boolean newLayer) { 462 return new DownloadSettings(currentBounds, newLayer, isZoomToDownloadedDataRequired()); 479 463 } 480 464 … … 543 527 */ 544 528 class DownloadAction extends AbstractAction { 545 DownloadAction() { 546 putValue(NAME, tr("Download")); 547 new ImageProvider("download").getResource().attachImageIcon(this); 548 putValue(SHORT_DESCRIPTION, tr("Click to download the currently selected area")); 529 final boolean newLayer; 530 DownloadAction(boolean newLayer) { 531 this.newLayer = newLayer; 532 if (!newLayer) { 533 putValue(NAME, tr("Download")); 534 putValue(SHORT_DESCRIPTION, tr("Click to download the currently selected area")); 535 new ImageProvider("download").getResource().attachImageIcon(this); 536 } else { 537 putValue(NAME, tr("Download as new layer")); 538 putValue(SHORT_DESCRIPTION, tr("Click to download the currently selected area into a new data layer")); 539 new ImageProvider("download_new_layer").getResource().attachImageIcon(this); 540 } 549 541 setEnabled(!NetworkManager.isOffline(OnlineResource.OSM_API)); 550 542 } … … 557 549 rememberSettings(); 558 550 downloadSourcesTab.getSelectedPanel().ifPresent(panel -> { 559 DownloadSettings downloadSettings = getDownloadSettings( );551 DownloadSettings downloadSettings = getDownloadSettings(newLayer); 560 552 if (panel.checkDownload(downloadSettings)) { 561 553 setCanceled(false);
Note:
See TracChangeset
for help on using the changeset viewer.