Changeset 2619 in josm for trunk


Ignore:
Timestamp:
2009-12-12T16:48:14+01:00 (12 years ago)
Author:
Gubaer
Message:

Global public list of layer change listeners is @deprecated

File:
1 edited

Legend:

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

    r2512 r2619  
    6161     * The listener of the active layer changes. You may register/deregister yourself
    6262     * while an LayerChangeListener - action is executed.
    63      */
     63     *
     64     * @deprecated use {@see #addLayerChangeListener(LayerChangeListener)}
     65     * and {@see #removeLayerChangeListener(LayerChangeListener)}
     66     */
     67    @Deprecated
    6468    public static final Collection<LayerChangeListener> listeners = new CopyOnWriteArrayList<LayerChangeListener>();
     69
     70    /**
     71     * Adds a layer change listener
     72     *
     73     * @param listener the listener. Ignored if null or already registered.
     74     */
     75    public static void addLayerChangeListener(LayerChangeListener listener) {
     76        if (listener != null && ! listeners.contains(listener)) {
     77            listeners.add(listener);
     78        }
     79    }
     80
     81    /**
     82     * Removes a layer change listener
     83     *
     84     * @param listener the listener. Ignored if null or already registered.
     85     */
     86    public static void removeLayerChangeListener(LayerChangeListener listener) {
     87        if (listener != null && listeners.contains(listener)) {
     88            listeners.remove(listener);
     89        }
     90    }
    6591
    6692    /**
Note: See TracChangeset for help on using the changeset viewer.