Changeset 12900 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-09-26T01:19:15+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #15275 - Download dialog does not remember settings

Location:
trunk/src/org/openstreetmap/josm/gui/download
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r12878 r12900  
    388388        }
    389389
     390        downloadSourcesTab.getAllPanels().forEach(AbstractDownloadSourcePanel::restoreSettings);
    390391        downloadSourcesTab.setSelected(DOWNLOAD_SOURCE_TAB.get());
    391392
     
    486487     */
    487488    protected <T> void addNewDownloadSourceTab(DownloadSource<T> downloadSource) {
    488         downloadSourcesTab.addPanel(downloadSource.createPanel());
     489        downloadSourcesTab.addPanel(downloadSource.createPanel(this));
    489490    }
    490491
     
    586587     * @since 12706
    587588     */
    588     private static class DownloadSourceTabs extends JTabbedPane implements DownloadSourceListener {
     589    private class DownloadSourceTabs extends JTabbedPane implements DownloadSourceListener {
    589590        private final List<AbstractDownloadSourcePanel<?>> allPanels = new ArrayList<>();
    590591
     
    645646        @Override
    646647        public void downloadSourceAdded(DownloadSource<?> source) {
    647             addPanel(source.createPanel());
     648            addPanel(source.createPanel(DownloadDialog.this));
    648649        }
    649650    }
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadSource.java

    r12684 r12900  
    1313    /**
    1414     * Creates a panel with GUI specific for the download source.
     15     * @param dialog the parent download dialog, as {@code DownloadDialog.getInstance()} might not be initialized yet
    1516     * @return Returns {@link AbstractDownloadSourcePanel}.
     17     * @since 12900
    1618     */
    17     AbstractDownloadSourcePanel<T> createPanel();
     19    AbstractDownloadSourcePanel<T> createPanel(DownloadDialog dialog);
    1820
    1921    /**
  • trunk/src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java

    r12846 r12900  
    4949
    5050    @Override
    51     public AbstractDownloadSourcePanel<OSMDownloadData> createPanel() {
    52         return new OSMDownloadSourcePanel(this);
     51    public AbstractDownloadSourcePanel<OSMDownloadData> createPanel(DownloadDialog dialog) {
     52        return new OSMDownloadSourcePanel(this, dialog);
    5353    }
    5454
     
    145145        /**
    146146         * Creates a new {@link OSMDownloadSourcePanel}.
     147         * @param dialog the parent download dialog, as {@code DownloadDialog.getInstance()} might not be initialized yet
    147148         * @param ds The osm download source the panel is for.
     149         * @since 12900
    148150         */
    149         public OSMDownloadSourcePanel(OSMDownloadSource ds) {
     151        public OSMDownloadSourcePanel(OSMDownloadSource ds, DownloadDialog dialog) {
    150152            super(ds);
    151153            setLayout(new GridBagLayout());
     
    153155            // size check depends on selected data source
    154156            final ChangeListener checkboxChangeListener = e ->
    155                     DownloadDialog.getInstance().getSelectedDownloadArea().ifPresent(this::updateSizeCheck);
     157                    dialog.getSelectedDownloadArea().ifPresent(this::updateSizeCheck);
    156158
    157159            // adding the download tasks
  • trunk/src/org/openstreetmap/josm/gui/download/OverpassDownloadSource.java

    r12880 r12900  
    4848
    4949    @Override
    50     public AbstractDownloadSourcePanel<OverpassDownloadData> createPanel() {
     50    public AbstractDownloadSourcePanel<OverpassDownloadData> createPanel(DownloadDialog dialog) {
    5151        return new OverpassDownloadSourcePanel(this);
    5252    }
Note: See TracChangeset for help on using the changeset viewer.