Ignore:
Timestamp:
2015-06-20T23:42:21+02:00 (9 years ago)
Author:
Don-vip
Message:

checkstyle: enable relevant whitespace checks and fix them

File:
1 edited

Legend:

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

    r8444 r8510  
    5757    protected void buildDownloadAreaInputFields() {
    5858        latlon = new JosmTextField[4];
    59         for(int i=0; i< 4; i++) {
     59        for (int i = 0; i < 4; i++) {
    6060            latlon[i] = new JosmTextField(11);
    61             latlon[i].setMinimumSize(new Dimension(100,new JosmTextField().getMinimumSize().height));
     61            latlon[i].setMinimumSize(new Dimension(100, new JosmTextField().getMinimumSize().height));
    6262            latlon[i].addFocusListener(new SelectAllOnFocusHandler(latlon[i]));
    6363        }
     
    9595        tfOsmUrl.setBorder(latlon[0].getBorder());
    9696
    97         dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10,20,5,0));
    98         dlg.add(latlon[0], GBC.std().insets(0,20,0,0));
    99         dlg.add(new JLabel(tr("min lon")), GBC.std().insets(10,20,5,0));
    100         dlg.add(latlon[1], GBC.eol().insets(0,20,0,0));
    101         dlg.add(new JLabel(tr("max lat")), GBC.std().insets(10,0,5,0));
     97        dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10, 20, 5, 0));
     98        dlg.add(latlon[0], GBC.std().insets(0, 20, 0, 0));
     99        dlg.add(new JLabel(tr("min lon")), GBC.std().insets(10, 20, 5, 0));
     100        dlg.add(latlon[1], GBC.eol().insets(0, 20, 0, 0));
     101        dlg.add(new JLabel(tr("max lat")), GBC.std().insets(10, 0, 5, 0));
    102102        dlg.add(latlon[2], GBC.std());
    103         dlg.add(new JLabel(tr("max lon")), GBC.std().insets(10,0,5,0));
     103        dlg.add(new JLabel(tr("max lon")), GBC.std().insets(10, 0, 5, 0));
    104104        dlg.add(latlon[3], GBC.eol());
    105105
     
    111111            }
    112112        });
    113         dlg.add(btnClear, GBC.eol().insets(10,20,0,0));
    114 
    115         dlg.add(new JLabel(tr("URL from www.openstreetmap.org (you can paste an URL here to download the area)")), GBC.eol().insets(10,5,5,0));
    116         dlg.add(tfOsmUrl, GBC.eop().insets(10,0,5,0).fill());
    117         dlg.add(showUrl, GBC.eop().insets(10,0,5,5));
     113        dlg.add(btnClear, GBC.eol().insets(10, 20, 0, 0));
     114
     115        dlg.add(new JLabel(tr("URL from www.openstreetmap.org (you can paste an URL here to download the area)")),
     116                GBC.eol().insets(10, 5, 5, 0));
     117        dlg.add(tfOsmUrl, GBC.eop().insets(10, 0, 5, 0).fill());
     118        dlg.add(showUrl, GBC.eop().insets(10, 0, 5, 5));
    118119        showUrl.setEditable(false);
    119120        showUrl.setBackground(dlg.getBackground());
     
    136137    public Bounds getDownloadArea() {
    137138        double[] values = new double[4];
    138         for (int i=0; i < 4; i++) {
     139        for (int i = 0; i < 4; i++) {
    139140            try {
    140141                values[i] = Double.parseDouble(latlon[i].getText());
    141             } catch(NumberFormatException x) {
     142            } catch (NumberFormatException x) {
    142143                return null;
    143144            }
     
    152153    private boolean parseURL(DownloadDialog gui) {
    153154        Bounds b = OsmUrlToBounds.parse(tfOsmUrl.getText());
    154         if(b == null) return false;
    155         gui.boundingBoxChanged(b,BoundingBoxSelection.this);
     155        if (b == null) return false;
     156        gui.boundingBoxChanged(b, BoundingBoxSelection.this);
    156157        updateBboxFields(b);
    157158        updateUrl(b);
     
    198199            try {
    199200                value = Double.parseDouble(tfLatValue.getText());
    200             } catch(NumberFormatException ex) {
    201                 setErrorMessage(tfLatValue,tr("The string ''{0}'' is not a valid double value.", tfLatValue.getText()));
     201            } catch (NumberFormatException ex) {
     202                setErrorMessage(tfLatValue, tr("The string ''{0}'' is not a valid double value.", tfLatValue.getText()));
    202203                return;
    203204            }
    204205            if (!LatLon.isValidLat(value)) {
    205                 setErrorMessage(tfLatValue,tr("Value for latitude in range [-90,90] required.", tfLatValue.getText()));
     206                setErrorMessage(tfLatValue, tr("Value for latitude in range [-90,90] required.", tfLatValue.getText()));
    206207                return;
    207208            }
     
    231232            try {
    232233                value = Double.parseDouble(tfLonValue.getText());
    233             } catch(NumberFormatException ex) {
    234                 setErrorMessage(tfLonValue,tr("The string ''{0}'' is not a valid double value.", tfLonValue.getText()));
     234            } catch (NumberFormatException ex) {
     235                setErrorMessage(tfLonValue, tr("The string ''{0}'' is not a valid double value.", tfLonValue.getText()));
    235236                return;
    236237            }
    237238            if (!LatLon.isValidLon(value)) {
    238                 setErrorMessage(tfLonValue,tr("Value for longitude in range [-180,180] required.", tfLonValue.getText()));
     239                setErrorMessage(tfLonValue, tr("Value for longitude in range [-180,180] required.", tfLonValue.getText()));
    239240                return;
    240241            }
     
    255256    static class SelectAllOnFocusHandler extends FocusAdapter {
    256257        private JTextComponent tfTarget;
     258
    257259        public SelectAllOnFocusHandler(JTextComponent tfTarget) {
    258260            this.tfTarget = tfTarget;
     
    267269    class OsmUrlRefresher implements DocumentListener {
    268270        @Override
    269         public void changedUpdate(DocumentEvent e) { parseURL(parent); }
    270         @Override
    271         public void insertUpdate(DocumentEvent e) { parseURL(parent); }
    272         @Override
    273         public void removeUpdate(DocumentEvent e) { parseURL(parent); }
     271        public void changedUpdate(DocumentEvent e) {
     272            parseURL(parent);
     273        }
     274
     275        @Override
     276        public void insertUpdate(DocumentEvent e) {
     277            parseURL(parent);
     278        }
     279
     280        @Override
     281        public void removeUpdate(DocumentEvent e) {
     282            parseURL(parent);
     283        }
    274284    }
    275285
    276286    class BoundingBoxBuilder extends FocusAdapter implements ActionListener {
    277287        protected Bounds build() {
    278             double minlon, minlat, maxlon,maxlat;
     288            double minlon, minlat, maxlon, maxlat;
    279289            try {
    280290                minlat = Double.parseDouble(latlon[0].getText().trim());
     
    282292                maxlat = Double.parseDouble(latlon[2].getText().trim());
    283293                maxlon = Double.parseDouble(latlon[3].getText().trim());
    284             } catch(NumberFormatException e) {
     294            } catch (NumberFormatException e) {
    285295                return null;
    286296            }
     
    292302            if (minlat > maxlat)
    293303                return null;
    294             return new Bounds(minlat,minlon,maxlat,maxlon);
     304            return new Bounds(minlat, minlon, maxlat, maxlon);
    295305        }
    296306
Note: See TracChangeset for help on using the changeset viewer.