Revision 36469

View differences:

branches/v2_0_0_prep/extensions/extWFS2/src/org/gvsig/wfs/gui/toc/WFSProperties.java
40 40
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
41 41
import org.gvsig.fmap.mapcontext.layers.FLayer;
42 42
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
43
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
44
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
43 45
import org.gvsig.gui.beans.panelGroup.PanelGroupManager;
44 46
import org.gvsig.wfs.gui.panels.WFSParamsPanel;
45 47
import org.gvsig.wfs.gui.panels.model.WFSSelectedFeatureManager;
......
75 77
	public void applyAction() {
76 78
		if (panel != null){			
77 79
		    try{
80
		        ILegend legend = layer.getLegend();
78 81
		        FLyrVect newLayer = (FLyrVect)panel.createLayer();
79
		        if (newLayer != null){
80
		            layer.getMapContext().getLayers().replaceLayer(layer.getName(), newLayer);
82
		        if (newLayer != null){		      
83
		            layer.getMapContext().getLayers().replaceLayer(layer, newLayer);
81 84
		            layer = newLayer;
85
		            layer.setLegend((IVectorLegend)legend);
82 86
		        }
83 87
		    } catch (LoadLayerException e) {
84 88
		        LOG.error("Error loading the new layer", e);

Also available in: Unified diff