Revision 20100 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/LayerCollectionEvent.java
LayerCollectionEvent.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
|
46 | 46 |
/** |
47 |
* Evento sobre las capas. |
|
47 |
* <p>Event produced when a layer is been added or removed, or has been added or |
|
48 |
* removed, or its visibility or activation state has changed from a collection of layers.</p> |
|
48 | 49 |
* |
49 | 50 |
* @author Vicente Caballero Navarro |
50 | 51 |
*/ |
51 | 52 |
public class LayerCollectionEvent extends FMapEvent { |
53 |
/** |
|
54 |
* <p>Identifies this event as a action on a layer that has been added.</p> |
|
55 |
*/ |
|
52 | 56 |
private final static int LAYER_ADDED = 0; |
57 |
|
|
58 |
/** |
|
59 |
* <p>Identifies this event as a action on a layer that has been removed.</p> |
|
60 |
*/ |
|
53 | 61 |
private final static int LAYER_REMOVED = 2; |
62 |
|
|
63 |
/** |
|
64 |
* <p>Identifies this event as a action on a layer that is being added.</p> |
|
65 |
*/ |
|
54 | 66 |
private final static int LAYER_ADDING = 3; |
67 |
|
|
68 |
/** |
|
69 |
* <p>Identifies this event as a action on a layer that is being removed.</p> |
|
70 |
*/ |
|
55 | 71 |
private final static int LAYER_REMOVING = 5; |
72 |
|
|
73 |
/** |
|
74 |
* <p>Identifies this event as a action of change of the activation status of a layer.</p> |
|
75 |
*/ |
|
56 | 76 |
private final static int LAYER_ACTIVATION_CHANGED = 6; |
77 |
|
|
78 |
/** |
|
79 |
* <p>Identifies this event as a action of change of the visibility status of a layer.</p> |
|
80 |
*/ |
|
57 | 81 |
private final static int LAYER_VISIBILITY_CHANGED = 7; |
58 |
|
|
82 |
|
|
83 |
/** |
|
84 |
* <p>Reference to the collection of layers.</p> |
|
85 |
*/ |
|
59 | 86 |
private FLayers layers; |
87 |
|
|
88 |
/** |
|
89 |
* <p>Reference to the layer which this layer notifies.</p> |
|
90 |
*/ |
|
60 | 91 |
private FLayer affected; |
92 |
|
|
93 |
/** |
|
94 |
* <p>Creates a new layer collection event notifying a "layer added" action.</p> |
|
95 |
* |
|
96 |
* @param lyr layer affected by the action |
|
97 |
* |
|
98 |
* @return a new layer collection event |
|
99 |
*/ |
|
61 | 100 |
public static LayerCollectionEvent createLayerAddedEvent(FLayer lyr){ |
62 | 101 |
return new LayerCollectionEvent(lyr, LAYER_ADDED); |
63 | 102 |
} |
64 | 103 |
|
104 |
/** |
|
105 |
* <p>Creates a new layer collection event notifying a "layer removed" action.</p> |
|
106 |
* |
|
107 |
* @param lyr layer affected by the action |
|
108 |
* |
|
109 |
* @return a new layer collection event |
|
110 |
*/ |
|
65 | 111 |
public static LayerCollectionEvent createLayerRemovedEvent(FLayer lyr){ |
66 | 112 |
return new LayerCollectionEvent(lyr, LAYER_REMOVED); |
67 | 113 |
} |
68 | 114 |
|
115 |
/** |
|
116 |
* <p>Creates a new layer collection event notifying a "layer adding" action.</p> |
|
117 |
* |
|
118 |
* @param lyr layer affected by the action |
|
119 |
* |
|
120 |
* @return a new layer collection event |
|
121 |
*/ |
|
69 | 122 |
public static LayerCollectionEvent createLayerAddingEvent(FLayer lyr){ |
70 | 123 |
return new LayerCollectionEvent(lyr, LAYER_ADDING); |
71 | 124 |
} |
72 | 125 |
|
126 |
/** |
|
127 |
* <p>Creates a new layer collection event notifying a "layer removing" action.</p> |
|
128 |
* |
|
129 |
* @param lyr layer affected by the action |
|
130 |
* |
|
131 |
* @return a new layer collection event |
|
132 |
*/ |
|
73 | 133 |
public static LayerCollectionEvent createLayerRemovingEvent(FLayer lyr){ |
74 | 134 |
return new LayerCollectionEvent(lyr, LAYER_REMOVING); |
75 | 135 |
} |
76 | 136 |
|
137 |
/** |
|
138 |
* <p>Creates a new layer collection event notifying a "layer activation changed" action.</p> |
|
139 |
* |
|
140 |
* @param lyr layer affected by the action |
|
141 |
* |
|
142 |
* @return a new layer collection event |
|
143 |
*/ |
|
77 | 144 |
public static LayerCollectionEvent createLayerActivationEvent(FLayer lyr){ |
78 | 145 |
return new LayerCollectionEvent(lyr, LAYER_ACTIVATION_CHANGED); |
79 | 146 |
} |
80 | 147 |
|
148 |
/** |
|
149 |
* <p>Creates a new layer collection event notifying a "layer visibility changed" action.</p> |
|
150 |
* |
|
151 |
* @param lyr layer affected by the action |
|
152 |
* |
|
153 |
* @return a new layer collection event |
|
154 |
*/ |
|
81 | 155 |
public static LayerCollectionEvent createLayerVisibilityEvent(FLayer lyr){ |
82 | 156 |
return new LayerCollectionEvent(lyr, LAYER_VISIBILITY_CHANGED); |
83 | 157 |
} |
84 | 158 |
|
85 | 159 |
/** |
86 |
* Crea un nuevo LayerCollectionEvent. |
|
87 |
* |
|
88 |
* @param lyr FLayers. |
|
160 |
* <p>Creates a new layer collection event of the specified type.</p> |
|
161 |
* |
|
162 |
* @param lyr layer affected by the action |
|
163 |
* @param eventType type of layer collection event |
|
164 |
* |
|
165 |
* @return a new layer collection event |
|
89 | 166 |
*/ |
90 | 167 |
protected LayerCollectionEvent(FLayer lyr, int eventType) { |
91 | 168 |
layers = lyr.getParentLayer(); |
... | ... | |
94 | 171 |
} |
95 | 172 |
|
96 | 173 |
/** |
97 |
* Devuelve las FLayers.
|
|
174 |
* <p>Gets the collection of layers which the layer affected belongs.</p>
|
|
98 | 175 |
* |
99 |
* @return FLayers.
|
|
176 |
* @return the collection of layers affected
|
|
100 | 177 |
*/ |
101 | 178 |
public FLayers getLayers() { |
102 | 179 |
return layers; |
103 | 180 |
} |
104 | 181 |
|
105 | 182 |
/** |
106 |
* Devuelve las FLayers afectadas por el cambio.
|
|
183 |
* <p>Gets the layer that this event references.</p>
|
|
107 | 184 |
* |
108 |
* @return FLayers.
|
|
185 |
* @return the layer that this event references
|
|
109 | 186 |
*/ |
110 | 187 |
public FLayer getAffectedLayer() { |
111 | 188 |
return affected; |
Also available in: Unified diff