Revision 42800 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java
LayerChangeSupport.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.mapcontext.layers; |
25 | 25 |
|
26 |
import java.util.ArrayList;
|
|
27 |
import java.util.Iterator;
|
|
26 |
import java.util.HashSet;
|
|
27 |
import java.util.Set;
|
|
28 | 28 |
|
29 | 29 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent; |
30 | 30 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener; |
... | ... | |
34 | 34 |
/** |
35 | 35 |
* <p>Manages all legend listeners of a layer, notifying them any legend change event produced.</p> |
36 | 36 |
* |
37 |
* @author Vicente Caballero Navarro |
|
38 | 37 |
*/ |
39 | 38 |
public class LayerChangeSupport { |
40 | 39 |
/** |
41 | 40 |
* <p>The legend listeners of a layer.</p> |
42 | 41 |
*/ |
43 |
private ArrayList listeners = new ArrayList();
|
|
42 |
private final Set<LegendListener> listeners = new HashSet<>();
|
|
44 | 43 |
|
45 | 44 |
/** |
46 | 45 |
* <p>Registers a <code>LegendListener</code>.</p> |
... | ... | |
66 | 65 |
* @param e a legend event with the new legend and events that compound this one |
67 | 66 |
*/ |
68 | 67 |
public void callLegendChanged(LegendChangedEvent e) { |
69 |
for (Iterator iter = listeners.iterator(); iter.hasNext();) { |
|
70 |
LegendListener listener = (LegendListener) iter.next(); |
|
71 |
|
|
72 |
listener.legendChanged(e); |
|
73 |
} |
|
68 |
for (LegendListener listener : listeners) { |
|
69 |
listener.legendChanged(e); |
|
70 |
} |
|
74 | 71 |
} |
75 | 72 |
} |
Also available in: Unified diff