Changeset 9606 in josm for trunk/src


Ignore:
Timestamp:
2016-01-24T03:50:35+01:00 (8 years ago)
Author:
Don-vip
Message:

add more unit tests

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

Legend:

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

    r9543 r9606  
    105105    public void addGui(final DownloadDialog gui) {
    106106        JPanel dlg = new JPanel(new GridBagLayout());
    107         gui.addDownloadAreaSelector(dlg, tr("Bookmarks"));
     107        if (gui != null)
     108            gui.addDownloadAreaSelector(dlg, tr("Bookmarks"));
    108109        GridBagConstraints gc = new GridBagConstraints();
    109110
     
    113114            public void valueChanged(ListSelectionEvent e) {
    114115                Bookmark b = bookmarks.getSelectedValue();
    115                 if (b != null) {
     116                if (b != null && gui != null) {
    116117                    gui.boundingBoxChanged(b.getArea(), BookmarkSelection.this);
    117118                }
  • trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java

    r9078 r9606  
    121121        showUrl.addFocusListener(new SelectAllOnFocusHandler(showUrl));
    122122
    123         gui.addDownloadAreaSelector(dlg, tr("Bounding Box"));
     123        if (gui != null)
     124            gui.addDownloadAreaSelector(dlg, tr("Bounding Box"));
    124125        this.parent = gui;
    125126    }
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r9543 r9606  
    6262import org.xml.sax.helpers.DefaultHandler;
    6363
     64/**
     65 * Place selector.
     66 * @since 1329
     67 */
    6468public class PlaceSelection implements DownloadSelection {
    6569    private static final String HISTORY_KEY = "download.places.history";
     
    145149        panel.add(scrollPane, BorderLayout.CENTER);
    146150
    147         gui.addDownloadAreaSelector(panel, tr("Areas around places"));
     151        if (gui != null)
     152            gui.addDownloadAreaSelector(panel, tr("Areas around places"));
    148153
    149154        scrollPane.setPreferredSize(scrollPane.getPreferredSize());
     
    151156        tblSearchResults.getSelectionModel().addListSelectionListener(new ListSelectionHandler());
    152157        tblSearchResults.addMouseListener(new MouseAdapter() {
    153             @Override public void mouseClicked(MouseEvent e) {
     158            @Override
     159            public void mouseClicked(MouseEvent e) {
    154160                if (e.getClickCount() > 1) {
    155161                    SearchResult sr = model.getSelectedSearchResult();
    156                     if (sr == null) return;
    157                     parent.startDownload(sr.getDownloadArea());
     162                    if (sr != null) {
     163                        parent.startDownload(sr.getDownloadArea());
     164                    }
    158165                }
    159166            }
     
    410417        @Override
    411418        public int getRowCount() {
    412             if (data == null) return 0;
    413             return data.size();
     419            return data != null ? data.size() : 0;
    414420        }
    415421
    416422        @Override
    417423        public Object getValueAt(int row, int column) {
    418             if (data == null) return null;
    419             return data.get(row);
     424            return data != null ? data.get(row) : null;
    420425        }
    421426
     
    444449        private TableColumn col3;
    445450        private TableColumn col4;
     451
     452        NamedResultTableColumnModel() {
     453            createColumns();
     454        }
     455
    446456        protected final void createColumns() {
    447             TableColumn col = null;
     457            TableColumn col;
    448458            NamedResultCellRenderer renderer = new NamedResultCellRenderer();
    449459
     
    485495            col4.setHeaderValue(fourth);
    486496            fireColumnMarginChanged();
    487         }
    488 
    489         NamedResultTableColumnModel() {
    490             createColumns();
    491497        }
    492498    }
     
    555561            renderColor(isSelected);
    556562
    557             if (value == null) return this;
     563            if (value == null)
     564                return this;
    558565            SearchResult sr = (SearchResult) value;
    559566            switch(column) {
  • trunk/src/org/openstreetmap/josm/gui/download/TileSelection.java

    r8510 r9606  
    3737    @Override
    3838    public void addGui(final DownloadDialog gui) {
    39         gui.addDownloadAreaSelector(chooser, tr("Tile Numbers"));
     39        if (gui != null)
     40            gui.addDownloadAreaSelector(chooser, tr("Tile Numbers"));
    4041        parent = gui;
    4142    }
Note: See TracChangeset for help on using the changeset viewer.