Changeset 13839 in josm for trunk/src/org


Ignore:
Timestamp:
2018-05-26T09:08:02+02:00 (6 years ago)
Author:
wiktorn
Message:

Sonar fixes and javadoc

  • AddImageryLayerAction - do not use {{ }} initialization as it may be source of leaks
  • AbstractTileSourceLayer - do not expose partially initialized object, first set all the values, then set the class field
  • WMTSCapabilities - add javadocs
Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r13830 r13839  
    177177            formats.setToolTipText(tr("Select image format for WMS layer"));
    178178
    179             if (!GraphicsEnvironment.isHeadless() &&
    180                 1 != new ExtendedDialog(Main.parent, tr("Select WMS layers"), tr("Add layers"), tr("Cancel")) { {
    181                     final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
    182                     scrollPane.setPreferredSize(new Dimension(400, 400));
    183                     final JPanel panel = new JPanel(new GridBagLayout());
    184                     panel.add(scrollPane, GBC.eol().fill());
    185                     panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
    186                     setContent(panel);
    187             } }.showDialog().getValue()) {
    188                 return null;
     179            if (!GraphicsEnvironment.isHeadless()) {
     180                ExtendedDialog dialog = new ExtendedDialog(Main.parent, tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));
     181                final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree());
     182                scrollPane.setPreferredSize(new Dimension(400, 400));
     183                final JPanel panel = new JPanel(new GridBagLayout());
     184                panel.add(scrollPane, GBC.eol().fill());
     185                panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL));
     186                dialog.setContent(panel);
     187
     188                if (dialog.showDialog().getValue() != 1) {
     189                    return null;
     190                }
    189191            }
    190192
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSCapabilities.java

    r13824 r13839  
    1919
    2020    /**
     21     * Constructor for the class
    2122     *
    2223     * @param baseUrl of this service
     
    2930
    3031    /**
    31      *
     32     * Adds layers to this WMTS service response
    3233     * @param layers layers to add to this document
    3334     */
     
    3738
    3839    /**
    39      *
     40     * Layers of this WMTS service
    4041     * @return layers defined by this service
    4142     */
     
    4546
    4647    /**
    47      *
     48     * base URL of this WMTS service
    4849     * @return base url for this service
    4950     */
     
    5354
    5455    /**
    55      *
     56     * TransferMode for this service
    5657     * @return transfer mode (KVP or RESTful) for this service
    5758     */
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r13733 r13839  
    13581358                    if (info == null) {
    13591359                        List<Tile> allTiles = this.allExistingTiles();
    1360                         info = new TileSetInfo();
    1361                         info.hasLoadingTiles = allTiles.size() < this.size();
    1362                         info.hasAllLoadedTiles = true;
     1360                        TileSetInfo newInfo = new TileSetInfo();
     1361                        newInfo.hasLoadingTiles = allTiles.size() < this.size();
     1362                        newInfo.hasAllLoadedTiles = true;
    13631363                        for (Tile t : allTiles) {
    13641364                            if ("no-tile".equals(t.getValue("tile-info"))) {
    1365                                 info.hasOverzoomedTiles = true;
     1365                                newInfo.hasOverzoomedTiles = true;
    13661366                            }
    13671367                            if (t.isLoaded()) {
    13681368                                if (!t.hasError()) {
    1369                                     info.hasVisibleTiles = true;
     1369                                    newInfo.hasVisibleTiles = true;
    13701370                                }
    13711371                            } else {
    1372                                 info.hasAllLoadedTiles = false;
     1372                                newInfo.hasAllLoadedTiles = false;
    13731373                                if (t.isLoading()) {
    1374                                     info.hasLoadingTiles = true;
     1374                                    newInfo.hasLoadingTiles = true;
    13751375                                }
    13761376                            }
    13771377                        }
     1378                        info = newInfo;
    13781379                    }
    13791380                }
Note: See TracChangeset for help on using the changeset viewer.