Changeset 16915 in josm


Ignore:
Timestamp:
2020-08-23T17:23:28+02:00 (4 years ago)
Author:
simon04
Message:

fix #19699 - Download dialog: add icons to source checkboxes

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

Legend:

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

    r16553 r16915  
    22package org.openstreetmap.josm.gui.download;
    33
     4import javax.swing.Icon;
    45import javax.swing.JCheckBox;
    56import javax.swing.event.ChangeListener;
     
    3435
    3536    /**
     37     * Returns the icon to be added to the UI.
     38     * @return The icon to be added to the UI
     39     */
     40    default Icon getIcon() {
     41        return null;
     42    }
     43
     44    /**
    3645     * Returns the download task class which will be getting the data.
    3746     * @return The {@link DownloadTask} class which will be getting the data
  • trunk/src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java

    r16914 r16915  
    1818import java.util.concurrent.Future;
    1919
     20import javax.swing.Box;
    2021import javax.swing.Icon;
    2122import javax.swing.JCheckBox;
     
    232233            downloadSourcesPanel.removeAll();
    233234            downloadSourcesPanel.add(new JLabel(tr(DATA_SOURCES_AND_TYPES)));
    234             DOWNLOAD_SOURCES
    235                 .forEach(obj -> downloadSourcesPanel.add(obj.getCheckBox(checkboxChangeListener)));
     235            DOWNLOAD_SOURCES.forEach(obj -> {
     236                final Icon icon = obj.getIcon();
     237                if (icon != null) {
     238                    downloadSourcesPanel.add(Box.createHorizontalStrut(6));
     239                    downloadSourcesPanel.add(new JLabel(icon));
     240                }
     241                downloadSourcesPanel.add(obj.getCheckBox(checkboxChangeListener));
     242            });
    236243        }
    237244
     
    424431
    425432        @Override
     433        public Icon getIcon() {
     434            return ImageProvider.get("layer/osmdata_small", ImageProvider.ImageSizes.SMALLICON);
     435        }
     436
     437        @Override
    426438        public Class<? extends AbstractDownloadTask<DataSet>> getDownloadClass() {
    427439            return DownloadOsmTask.class;
     
    459471
    460472        @Override
     473        public Icon getIcon() {
     474            return ImageProvider.get("layer/gpx_small", ImageProvider.ImageSizes.SMALLICON);
     475        }
     476
     477        @Override
    461478        public Class<? extends AbstractDownloadTask<GpxData>> getDownloadClass() {
    462479            return DownloadGpsTask.class;
     
    492509
    493510        @Override
     511        public Icon getIcon() {
     512            return ImageProvider.get("layer/marker_small", ImageProvider.ImageSizes.SMALLICON);
     513        }
     514
     515        @Override
    494516        public Class<? extends AbstractDownloadTask<NoteData>> getDownloadClass() {
    495517            return DownloadNotesTask.class;
Note: See TracChangeset for help on using the changeset viewer.