Changeset 10277 in josm


Ignore:
Timestamp:
2016-05-25T08:48:50+02:00 (3 years ago)
Author:
Don-vip
Message:

GSOC core rework - LayerManager, see #12863, fix checkstyle violations

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

Legend:

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

    r10271 r10277  
    9595     * Interface to notify listeners of a layer change.
    9696     * <p>
    97      * To be removed: end of 2016. Use {@link org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener} instead.
     97     * To be removed: end of 2016.
     98     * @deprecated Use {@link org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener} instead.
    9899     * @author imi
    99100     */
     
    124125     * An interface that needs to be implemented in order to listen for changes to the active edit layer.
    125126     * <p>
    126      * To be removed: end of 2016. Use {@link ActiveLayerChangeListener} instead.
     127     * To be removed: end of 2016.
     128     * @deprecated Use {@link ActiveLayerChangeListener} instead.
    127129     */
    128130    @Deprecated
     
    319321     * Removes a layer change listener
    320322     * <p>
    321      * You should register the listener on {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     323     * To be removed: end of 2016.
    322324     *
    323325     * @param listener the listener. Ignored if null or not registered.
     326     * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.
    324327     */
    325328    @Deprecated
     
    330333        } catch (IllegalArgumentException e) {
    331334            // Ignored in old implementation
     335            if (Main.isDebugEnabled()) {
     336                Main.debug(e.getMessage());
     337            }
    332338        }
    333339        try {
     
    335341        } catch (IllegalArgumentException e) {
    336342            // Ignored in old implementation
     343            if (Main.isDebugEnabled()) {
     344                Main.debug(e.getMessage());
     345            }
    337346        }
    338347    }
     
    341350     * Removes an edit layer change listener
    342351     * <p>
    343      * You should register the listener on {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     352     * To be removed: end of 2016.
    344353     *
    345354     * @param listener the listener. Ignored if null or not registered.
     355     * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.
    346356     */
    347357    @Deprecated
     
    351361        } catch (IllegalArgumentException e) {
    352362            // Ignored in old implementation
     363            if (Main.isDebugEnabled()) {
     364                Main.debug(e.getMessage());
     365            }
    353366        }
    354367    }
     
    357370     * Adds a layer change listener
    358371     * <p>
    359      * You should register the listener on {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     372     * To be removed: end of 2016.
    360373     *
    361374     * @param listener the listener. Ignored if null or already registered.
     375     * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.
    362376     */
    363377    @Deprecated
     
    369383     * Adds a layer change listener
    370384     * <p>
    371      * You should register the listener on {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     385     * To be removed: end of 2016.
    372386     *
    373387     * @param listener the listener. Ignored if null or already registered.
    374388     * @param initialFire fire an active-layer-changed-event right after adding
    375389     * the listener in case there is a layer present (should be)
     390     * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.
    376391     */
    377392    @Deprecated
     
    390405     * Adds an edit layer change listener
    391406     * <p>
    392      * You should register the listener on {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     407     * To be removed: end of 2016.
    393408     *
    394409     * @param listener the listener. Ignored if null or already registered.
    395410     * @param initialFire fire an edit-layer-changed-event right after adding
    396411     * the listener in case there is an edit layer present
     412     * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.
    397413     */
    398414    @Deprecated
    399415    public static void addEditLayerChangeListener(EditLayerChangeListener listener, boolean initialFire) {
    400416        if (listener != null) {
    401             Main.getLayerManager().addActiveLayerChangeListener(new EditLayerChangeAdapter(listener), initialFire && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() != null);
     417            Main.getLayerManager().addActiveLayerChangeListener(new EditLayerChangeAdapter(listener),
     418                    initialFire && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() != null);
    402419        }
    403420    }
     
    406423     * Adds an edit layer change listener
    407424     * <p>
    408      * You should register the listener on {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     425     * To be removed: end of 2016.
    409426     *
    410427     * @param listener the listener. Ignored if null or already registered.
     428     * @deprecated You should register the listener on {@link Main#getLayerManager()} instead.
    411429     */
    412430    @Deprecated
     
    545563     * Add a layer to the current MapView.
    546564     * <p>
    547      * Use {@link Main#getLayerManager()}.addLayer() instead. To be removed: end of 2016.
     565     * To be removed: end of 2016.
    548566     * @param layer The layer to add
     567     * @deprecated Use {@link Main#getLayerManager()}.addLayer() instead.
    549568     */
    550569    @Deprecated
     
    574593
    575594    /**
    576      * Use {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     595     * Returns current data set. To be removed: end of 2016.
     596     * @deprecated Use {@link Main#getLayerManager()} instead.
    577597     */
    578598    @Override
     
    602622
    603623    /**
    604      * Determines the next active data layer according to the following
    605      * rules:
     624     * Determines the next active data layer according to the following rules:
    606625     * <ul>
    607626     *   <li>if there is at least one {@link OsmDataLayer} the first one
     
    609628     *   <li>otherwise, the top most layer of any type becomes active</li>
    610629     * </ul>
    611      * To be removed: end of 2016 (now handled by {@link LayerManagerWithActive}
     630     * To be removed: end of 2016.
    612631     * @param layersList lit of layers
    613632     *
    614633     * @return the next active data layer
     634     * @deprecated now handled by {@link LayerManagerWithActive}
    615635     */
    616636    @Deprecated
     
    634654     * an LayerChange event is fired.
    635655     * <p>
    636      * Use {@link Main#getLayerManager()}.removeLayer() instead. To be removed: end of 2016.
     656     * To be removed: end of 2016.
    637657     * @param layer The layer to remove
     658     * @deprecated Use {@link Main#getLayerManager()}.removeLayer() instead.
    638659     */
    639660    @Deprecated
     
    696717     * Gets the index of the layer in the layer list.
    697718     * <p>
    698      * Access the layer list using {@link Main#getLayerManager()} instead. To be removed: end of 2016.
     719     * To be removed: end of 2016.
    699720     * @param layer The layer to search for.
    700721     * @return The index in the list.
    701722     * @throws IllegalArgumentException if that layer does not belong to this view.
     723     * @deprecated Access the layer list using {@link Main#getLayerManager()} instead.
    702724     */
    703725    @Deprecated
     
    919941
    920942    /**
    921      * Use {@link LayerManager#getLayers()} instead. To be removed: end of 2016.
     943     * Returns all layers. To be removed: end of 2016.
    922944     *
    923945     * @return An unmodifiable collection of all layers
     946     * @deprecated Use {@link LayerManager#getLayers()} instead.
    924947     */
    925948    @Deprecated
     
    929952
    930953    /**
    931      * Use {@link LayerManager#getLayers()} instead. To be removed: end of 2016.
     954     * Returns all layers as list. To be removed: end of 2016.
    932955     *
    933956     * @return An unmodifiable ordered list of all layers
     957     * @deprecated Use {@link LayerManager#getLayers()} instead.
    934958     */
    935959    @Deprecated
     
    945969     *     List&lt;WMSLayer&gt; wmsLayers = getLayersOfType(WMSLayer.class);
    946970     * </pre>
    947      * Use {@link LayerManager#getLayersOfType(Class)} instead.
    948971     *
    949972     * @param <T> layer type
     
    951974     * @param ofType The layer type.
    952975     * @return an unmodifiable list of layers of a certain type.
     976     * @deprecated Use {@link LayerManager#getLayersOfType(Class)} instead.
    953977     */
    954978    @Deprecated
     
    960984     * Replies the number of layers managed by this map view. To be removed: end of 2016.
    961985     * <p>
    962      * You can use {@link Main#getLayerManager()}.getLayers().size() instead.
    963986     *
    964987     * @return the number of layers managed by this map view
     988     * @deprecated Use {@link Main#getLayerManager()}.getLayers().size() instead.
    965989     */
    966990    @Deprecated
     
    972996     * Replies true if there is at least one layer in this map view
    973997     * <p>
    974      * You can use !{@link Main#getLayerManager()}.getLayers().isEmpty() instead.
    975998     *
    976999     * @return true if there is at least one layer in this map view
     1000     * @deprecated Use !{@link Main#getLayerManager()}.getLayers().isEmpty() instead.
    9771001     */
    9781002    @Deprecated
     
    9851009     * of {@link OsmDataLayer} also sets editLayer to <code>layer</code>.
    9861010     * <p>
    987      * You can use !{@link Main#getLayerManager()}.setActiveLayer() instead.
    9881011     *
    9891012     * @param layer the layer to be activate; must be one of the layers in the list of layers
    9901013     * @throws IllegalArgumentException if layer is not in the list of layers
     1014     * @deprecated Use !{@link Main#getLayerManager()}.setActiveLayer() instead.
    9911015     */
    9921016    @Deprecated
    9931017    public void setActiveLayer(Layer layer) {
    994         layerManager.setActiveLayer(layer);
    995     }
     1018        layerManager.setActiveLayer(layer);
     1019    }
     1020
    9961021    /**
    9971022     * Replies the currently active layer
    9981023     * <p>
    999      * You can use !{@link Main#getLayerManager()}.getActiveLayer() instead.
    10001024     *
    10011025     * @return the currently active layer (may be null)
     1026     * @deprecated Use !{@link Main#getLayerManager()}.getActiveLayer() instead.
    10021027     */
    10031028    @Deprecated
     
    10341059     * Replies the current edit layer, if any
    10351060     * <p>
    1036      * You can use !{@link Main#getLayerManager()}.getEditLayer() instead. To be made private: end of 2016.
    10371061     *
    10381062     * @return the current edit layer. May be null.
     1063     * @deprecated Use !{@link Main#getLayerManager()}.getEditLayer() instead. To be made private: end of 2016.
    10391064     */
    10401065    @Deprecated
     
    10461071     * replies true if the list of layers managed by this map view contain layer
    10471072     * <p>
    1048      * You can use !{@link Main#getLayerManager()}.containsLayer() instead.
    10491073     *
    10501074     * @param layer the layer
    10511075     * @return true if the list of layers managed by this map view contain layer
     1076     * @deprecated Use !{@link Main#getLayerManager()}.containsLayer() instead.
    10521077     */
    10531078    @Deprecated
  • trunk/src/org/openstreetmap/josm/gui/layer/LayerManager.java

    r10274 r10277  
    1515 * This manager handles a list of layers with the first layer being the front layer.
    1616 * <h1>Threading</h1>
    17  * Methods of this manager may be called from any thread in any order. Listeners are called while this layer manager is locked, so they should not block.
     17 * Methods of this manager may be called from any thread in any order.
     18 * Listeners are called while this layer manager is locked, so they should not block.
    1819 *
    1920 * @author Michael Zangl
  • trunk/src/org/openstreetmap/josm/gui/layer/LayerManagerWithActive.java

    r10271 r10277  
    3434         * @param e The change event.
    3535         */
    36         public void activeOrEditLayerChanged(ActiveLayerChangeEvent e);
     36        void activeOrEditLayerChanged(ActiveLayerChangeEvent e);
    3737    }
    3838
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r10271 r10277  
    134134     * <a href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html">Event Dispatch Thread</a>.
    135135     * <p>
    136      * Passes on the exception that was thrown to the thread calling this. The exception is wrapped in a {@link RuntimeException} if it was a normal {@link Throwable}.
     136     * Passes on the exception that was thrown to the thread calling this.
     137     * The exception is wrapped in a {@link RuntimeException} if it was a normal {@link Throwable}.
    137138     * @param task The runnable to execute
    138139     * @see SwingUtilities#invokeAndWait
Note: See TracChangeset for help on using the changeset viewer.