Revision 36664
branches/v2_0_0_prep/extensions/org.gvsig.app.document.table.app/org.gvsig.app.document.table.app.mainplugin/src/main/java/org/gvsig/app/extension/ShowTable.java | ||
---|---|---|
31 | 31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
32 | 32 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
33 | 33 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
34 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
34 | 35 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent; |
35 | 36 |
import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener; |
36 | 37 |
import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent; |
... | ... | |
172 | 173 |
|
173 | 174 |
public void layerRemoved(LayerCollectionEvent e) { |
174 | 175 |
FLayer layer = e.getAffectedLayer(); |
176 |
// Just in case we where listening to a group of layers being removed |
|
177 |
// remove us from there |
|
178 |
if (layer instanceof FLayers) { |
|
179 |
((FLayers) layer).removeLayerCollectionListener(this); |
|
180 |
} |
|
181 |
// Remove the related table document, if any |
|
175 | 182 |
if (layer instanceof FLyrVect) { |
176 | 183 |
getTableManager().removeTableDocument((FLyrVect) layer); |
184 |
// If the parent layers has not other child layers, for sure there |
|
185 |
// are not related tables opened, don't need to listen |
|
186 |
// LayerCollectionEvents anymore. |
|
187 |
// TODO: remove us also when there are not any child layers with |
|
188 |
// related table documents |
|
189 |
FLayers layers = layer.getParentLayer(); |
|
190 |
if (layers != null && layers.getLayersCount() == 0) { |
|
191 |
layers.removeLayerCollectionListener(this); |
|
192 |
} |
|
177 | 193 |
} |
178 | 194 |
} |
179 | 195 |
|
Also available in: Unified diff