Changeset 12654 in josm


Ignore:
Timestamp:
2017-08-26T00:08:24+02:00 (7 years ago)
Author:
michael2402
Message:

See #15167: Fix generics.

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

Legend:

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

    r12652 r12654  
    22package org.openstreetmap.josm.gui.download;
    33
    4 import org.openstreetmap.josm.data.Bounds;
     4import java.util.Objects;
    55
    66import javax.swing.Icon;
    77import javax.swing.JPanel;
    8 import java.util.Objects;
     8
     9import org.openstreetmap.josm.data.Bounds;
    910
    1011/**
     
    8384        // override this if the panel must react on bbox changes
    8485    }
     86
     87    /**
     88     * Tells the {@link DownloadSource} to start downloading
     89     * @param currentBounds The bounds to download for
     90     * @param downloadSettings The remaining download settings
     91     */
     92    public void triggerDownload(Bounds currentBounds, DownloadSettings downloadSettings) {
     93        getDownloadSource().doDownload(currentBounds, getData(), downloadSettings);
     94    }
    8595}
  • trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java

    r12653 r12654  
    8484    }
    8585
    86     protected final transient List<DownloadSource> downloadSources = new ArrayList<>();
     86    protected final transient List<DownloadSource<?>> downloadSources = new ArrayList<>();
    8787    protected final transient List<DownloadSelection> downloadSelections = new ArrayList<>();
    8888    protected final JTabbedPane tpDownloadAreaSelectors = new JTabbedPane();
     
    273273        for (Component ds : downloadSourcesTab.getComponents()) {
    274274            if (ds instanceof AbstractDownloadSourcePanel) {
    275                 ((AbstractDownloadSourcePanel) ds).boudingBoxChanged(b);
     275                ((AbstractDownloadSourcePanel<?>) ds).boudingBoxChanged(b);
    276276            }
    277277        }
     
    379379            tpDownloadAreaSelectors.setSelectedIndex(DOWNLOAD_TAB.get());
    380380        } catch (IndexOutOfBoundsException e) {
    381             Main.trace(e);
     381            Logging.trace(e);
    382382            tpDownloadAreaSelectors.setSelectedIndex(0);
    383383        }
     
    386386            downloadSourcesTab.setSelectedIndex(DOWNLOAD_SOURCE_TAB.get());
    387387        } catch (IndexOutOfBoundsException e) {
    388             Main.trace(e);
     388            Logging.trace(e);
    389389            downloadSourcesTab.setSelectedIndex(0);
    390390        }
     
    485485     * @return The index of the download source, or -1 if it not in the pane.
    486486     */
    487     protected int getDownloadSourceIndex(DownloadSource downloadSource) {
     487    protected int getDownloadSourceIndex(DownloadSource<?> downloadSource) {
    488488        return Arrays.stream(downloadSourcesTab.getComponents())
    489489                .filter(it -> it instanceof AbstractDownloadSourcePanel)
    490                 .map(it -> (AbstractDownloadSourcePanel) it)
     490                .map(it -> (AbstractDownloadSourcePanel<?>) it)
    491491                .filter(it -> it.getDownloadSource().equals(downloadSource))
    492492                .findAny()
     
    528528                        .mapToObj(downloadSourcesTab::getComponentAt)
    529529                        .filter(it -> it instanceof AbstractDownloadSourcePanel)
    530                         .map(it -> (AbstractDownloadSourcePanel) it)
     530                        .map(it -> (AbstractDownloadSourcePanel<?>) it)
    531531                        .filter(it -> it.getDownloadSource().onlyExpert())
    532532                        .forEach(downloadSourcesTab::remove);
     
    552552        @Override
    553553        public void actionPerformed(ActionEvent e) {
    554             AbstractDownloadSourcePanel pnl = (AbstractDownloadSourcePanel) downloadSourcesTab.getSelectedComponent();
     554            AbstractDownloadSourcePanel<?> pnl = (AbstractDownloadSourcePanel<?>) downloadSourcesTab.getSelectedComponent();
    555555            run();
    556556            pnl.checkCancel();
     
    572572            Component panel = downloadSourcesTab.getSelectedComponent();
    573573            if (panel instanceof AbstractDownloadSourcePanel) {
    574                 AbstractDownloadSourcePanel pnl = (AbstractDownloadSourcePanel) panel;
     574                AbstractDownloadSourcePanel<?> pnl = (AbstractDownloadSourcePanel<?>) panel;
    575575                DownloadSettings downloadSettings = getDownloadSettings();
    576576                if (pnl.checkDownload(currentBounds, downloadSettings)) {
     
    578578                    setCanceled(false);
    579579                    setVisible(false);
    580                     pnl.getDownloadSource().doDownload(currentBounds, pnl.getData(), downloadSettings);
     580                    pnl.triggerDownload(currentBounds, downloadSettings);
    581581                }
    582582            }
Note: See TracChangeset for help on using the changeset viewer.