Ticket #21886: josm_21886.patch

File josm_21886.patch, 2.9 KB (added by gaben, 3 years ago)
  • src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java

     
    211211            setLayout(new GridBagLayout());
    212212
    213213            // size check depends on selected data source
    214             checkboxChangeListener = e ->
    215                     dialog.getSelectedDownloadArea().ifPresent(this::updateSizeCheck);
     214            checkboxChangeListener = e -> {
     215                rememberSettings();
     216                dialog.getSelectedDownloadArea().ifPresent(OSMDownloadSourcePanel.this::boundingBoxChanged);
     217            };
    216218
    217219            downloadSourcesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    218220            add(downloadSourcesPanel, GBC.eol().fill(GBC.HORIZONTAL));
     
    324326
    325327        @Override
    326328        public void boundingBoxChanged(Bounds bbox) {
    327             updateSizeCheck(bbox);
    328         }
    329 
    330         @Override
    331         public String getSimpleName() {
    332             return SIMPLE_NAME;
    333         }
    334 
    335         private void updateSizeCheck(Bounds bbox) {
    336329            if (bbox == null) {
    337330                sizeCheck.setText(tr("No area selected yet"));
    338331                sizeCheck.setForeground(Color.darkGray);
     
    340333            }
    341334
    342335            displaySizeCheckResult(DOWNLOAD_SOURCES.stream()
     336                    .filter(IDownloadSourceType::isEnabled)
    343337                    .anyMatch(type -> type.isDownloadAreaTooLarge(bbox)));
    344338        }
    345339
     340        @Override
     341        public String getSimpleName() {
     342            return SIMPLE_NAME;
     343        }
     344
    346345        private void displaySizeCheckResult(boolean isAreaTooLarge) {
    347346            if (isAreaTooLarge) {
    348347                sizeCheck.setText(tr("Download area too large; will probably be rejected by server"));
     
    414413        @Override
    415414        public boolean isDownloadAreaTooLarge(Bounds bound) {
    416415            // see max_request_area in
    417             // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml
     416            // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml
    418417            return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area", 0.25);
    419418        }
    420419    }
     
    492491        @Override
    493492        public boolean isDownloadAreaTooLarge(Bounds bound) {
    494493            // see max_note_request_area in
    495             // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/example.application.yml
     494            // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml
    496495            return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area-notes", 25);
    497496        }
    498497    }