Index: BasePieChartLegend.java
===================================================================
--- BasePieChartLegend.java	(revision 570)
+++ BasePieChartLegend.java	(revision 571)
@@ -31,13 +31,9 @@
 import org.gvsig.symbology.SymbologyLocator;
 import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend;
 import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.ISimpleFillSymbol;
-import org.gvsig.tools.ToolsLocator;
-import org.gvsig.tools.dynobject.DynStruct;
-import org.gvsig.tools.persistence.PersistenceManager;
 import org.gvsig.tools.persistence.PersistentState;
 import org.gvsig.tools.persistence.exception.PersistenceException;
 import org.gvsig.tools.task.Cancellable;
-import org.gvsig.tools.util.Callable;
 
 /**
  * @author Fjp
@@ -46,499 +42,508 @@
  * ESTA SE USA PARA TODO TIPO DE CHARTS. (BarsChartLegend no se usa, borrarla)
  */
 public class BasePieChartLegend extends VectorialUniqueValueLegend {
+
     final static private Logger LOG = LoggerFactory.getLogger(BasePieChartLegend.class);
 
-	public static final String PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME = "PieChartLegend";
+    public static final String BASE_PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME = "BasePieChartLegend";
 
-	private static final String FIELD_NAMES = "FieldLegendNames";
-	private static final String FIELD_LABEL_NAMES = "FieldLabelNames";
-	private static final String FIELD_LABEL_COLOR = "FieldLabelColor";
+    private static final String FIELD_NAMES = "FieldLegendNames";
+    private static final String FIELD_LABEL_NAMES = "FieldLabelNames";
+    private static final String FIELD_LABEL_COLOR = "FieldLabelColor";
 
-	protected ISymbol backgroundSymbol;
-	protected String[] fields;
-	protected String[] labels;
-	protected int size=150;
-	protected boolean is3D;
+    protected ISymbol backgroundSymbol;
+    protected String[] fields;
+    protected String[] labels;
+    protected int size = 150;
+    protected boolean is3D;
 
-	protected boolean isOutlineShow;
-	protected Color outlineColor;
-	protected int outlineWidth;
-	protected boolean onlySelection=false;
-	protected int referenceSystem=0;
-	protected String fieldSize;
-	protected String fieldNormalize="---";
-	protected int sizeFrom=10;
-	protected int sizeTo=1000;
-	protected int unit=-1;
-	protected int sizeOption = IChartSymbol.SIZEFIXED;
-	protected ZSort zSort = null;
-	protected boolean isActiveLimits;
-	protected double minFeature;
-	protected double maxFeature;
-	protected Color[] colors= null;
-	protected IChartSymbol symbol;
-	private double maxField;
-	protected FeatureSelection featSelection;
+    protected boolean isOutlineShow;
+    protected Color outlineColor;
+    protected int outlineWidth;
+    protected boolean onlySelection = false;
+    protected int referenceSystem = 0;
+    protected String fieldSize;
+    protected String fieldNormalize = "---";
+    protected int sizeFrom = 10;
+    protected int sizeTo = 1000;
+    protected int unit = -1;
+    protected int sizeOption = IChartSymbol.SIZEFIXED;
+    protected ZSort zSort = null;
+    protected boolean isActiveLimits;
+    protected double minFeature;
+    protected double maxFeature;
+    protected Color[] colors = null;
+    protected IChartSymbol symbol;
+    private double maxField;
+    protected FeatureSelection featSelection;
 
-	public BasePieChartLegend() {
-	}
+    public BasePieChartLegend() {
+    }
 
-	public BasePieChartLegend(int shapeType) {
-		super(shapeType);
-	}
+    public BasePieChartLegend(int shapeType) {
+        super(shapeType);
+    }
 
+    @Override
+    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+            Cancellable cancel, double scale, Map queryParameters,
+            ICoordTrans coordTrans, FeatureStore featureStore,
+            FeatureQuery featureQuery) throws LegendException {
+        try {
+            this.featSelection = featureStore.getFeatureSelection();
+            System.out.println("CHARTLEGEND: " + featSelection.getSelectedCount() + " seleccionados.");
+        } catch (DataException e) {
+            e.printStackTrace();
+        }
 
-	@Override
-	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
-			Cancellable cancel, double scale, Map queryParameters,
-			ICoordTrans coordTrans, FeatureStore featureStore,
-			FeatureQuery featureQuery) throws LegendException {
-		try {
-			this.featSelection = featureStore.getFeatureSelection();
-			System.out.println("CHARTLEGEND: " + featSelection.getSelectedCount() + " seleccionados.");
-		} catch (DataException e) {
-			e.printStackTrace();
-		}
+        super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
+                featureStore, featureQuery);
+    }
 
-		super.draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
-				featureStore, featureQuery);
-	}
-
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#is3D()
-	 */
-	public boolean is3D() {
-		return is3D;
-	}
+     */
+    public boolean is3D() {
+        return is3D;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#setIs3D(boolean)
-	 */
-	public void setIs3D(boolean b){
-		is3D=b;
-	}
+     */
+    public void setIs3D(boolean b) {
+        is3D = b;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#getSize()
-	 */
-	public int getSize() {
-		return size;
-	}
+     */
+    public int getSize() {
+        return size;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#setSize(int)
-	 */
-	public void setSize(int size) {
-		this.size = size;
-	}
+     */
+    public void setSize(int size) {
+        this.size = size;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#isOutlineShow()
-	 */
-	public boolean isOutlineShow() {
-		return isOutlineShow;
-	}
+     */
+    public boolean isOutlineShow() {
+        return isOutlineShow;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#setOutlineShow(boolean)
-	 */
-	public void setOutlineShow(boolean isOutlineShow) {
-		this.isOutlineShow = isOutlineShow;
-	}
+     */
+    public void setOutlineShow(boolean isOutlineShow) {
+        this.isOutlineShow = isOutlineShow;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#getOutlineColor()
-	 */
-	public Color getOutlineColor() {
-		return outlineColor;
-	}
+     */
+    public Color getOutlineColor() {
+        return outlineColor;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#setOutlineColor(java.awt.Color)
-	 */
-	public void setOutlineColor(Color outlineColor) {
-		this.outlineColor = outlineColor;
-	}
+     */
+    public void setOutlineColor(Color outlineColor) {
+        this.outlineColor = outlineColor;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#getOutlineWidth()
-	 */
-	public int getOutlineWidth() {
-		return outlineWidth;
-	}
+     */
+    public int getOutlineWidth() {
+        return outlineWidth;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#setOutlineWidth(int)
-	 */
-	public void setOutlineWidth(int outlineWidth) {
-		this.outlineWidth = outlineWidth;
-	}
-	/* (non-Javadoc)
+     */
+    public void setOutlineWidth(int outlineWidth) {
+        this.outlineWidth = outlineWidth;
+    }
+
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#setOnlySelection(boolean)
-	 */
-	public void setOnlySelection(boolean onlySelection) {
-		this.onlySelection=onlySelection;
-	}
+     */
+    public void setOnlySelection(boolean onlySelection) {
+        this.onlySelection = onlySelection;
+    }
 
-	/* (non-Javadoc)
+    /* (non-Javadoc)
 	 * @see org.gvsig.symbology.fmap.mapcontext.rendering.legend.IChartLegend#isOnlySelection()
-	 */
-	public boolean isOnlySelection() {
-		return onlySelection;
-	}
+     */
+    public boolean isOnlySelection() {
+        return onlySelection;
+    }
 
-	public ISymbol getBackgroundSymbol() {
-		return backgroundSymbol;
-	}
+    public ISymbol getBackgroundSymbol() {
+        return backgroundSymbol;
+    }
 
-	public void setBackgroundSymbol(ISymbol backgroundSymbol) {
-		this.backgroundSymbol = backgroundSymbol;
-	}
+    public void setBackgroundSymbol(ISymbol backgroundSymbol) {
+        this.backgroundSymbol = backgroundSymbol;
+    }
 
-	public int getSizeOption() {
-		return this.sizeOption;
-	}
+    public int getSizeOption() {
+        return this.sizeOption;
+    }
 
-	public String getFieldSize() {
-		return this.fieldSize;
-	}
+    public String getFieldSize() {
+        return this.fieldSize;
+    }
 
-	public String getFieldNormalize() {
-		return this.fieldNormalize;
-	}
+    public String getFieldNormalize() {
+        return this.fieldNormalize;
+    }
 
-	public int getSizeFrom() {
-		return this.sizeFrom;
-	}
+    public int getSizeFrom() {
+        return this.sizeFrom;
+    }
 
-	public int getSizeTo() {
-		return this.sizeTo;
-	}
+    public int getSizeTo() {
+        return this.sizeTo;
+    }
 
-	public int getUnit() {
-		return unit;
-	}
+    public int getUnit() {
+        return unit;
+    }
 
-	public void setSizeFrom(int s) {
-		this.sizeFrom = s;
-	}
+    public void setSizeFrom(int s) {
+        this.sizeFrom = s;
+    }
 
-	public void setSizeTo(int s) {
-		this.sizeTo = s;
-	}
+    public void setSizeTo(int s) {
+        this.sizeTo = s;
+    }
 
-	public void setUnit(int unit) {
-		this.unit = unit;
-	}
+    public void setUnit(int unit) {
+        this.unit = unit;
+    }
 
-	public void setFieldSize(String f) {
-		this.fieldSize = f;
-	}
+    public void setFieldSize(String f) {
+        this.fieldSize = f;
+    }
 
-	public void setFieldNormalize(String f) {
-		this.fieldNormalize = f;
-	}
+    public void setFieldNormalize(String f) {
+        this.fieldNormalize = f;
+    }
 
-	public void setSizeOption(int option) {
-		this.sizeOption = option;
-	}
+    public void setSizeOption(int option) {
+        this.sizeOption = option;
+    }
 
-	public boolean isActiveLimits() {
-		return isActiveLimits;
-	}
+    public boolean isActiveLimits() {
+        return isActiveLimits;
+    }
 
-	public void setActiveLimits(boolean b) {
-		this.isActiveLimits = b;
-	}
+    public void setActiveLimits(boolean b) {
+        this.isActiveLimits = b;
+    }
 
-	public Color[] getColors() {
-		return colors;
-	}
+    public Color[] getColors() {
+        return colors;
+    }
 
-	public void setColors(Color[] colors) {
-		this.colors = colors;
-		updateSymbols();
-	}
+    public void setColors(Color[] colors) {
+        this.colors = colors;
+        updateSymbols();
+    }
 
-	public int getReferenceSystem() {
-		return referenceSystem;
-	}
+    public int getReferenceSystem() {
+        return referenceSystem;
+    }
 
-	public void setReferenceSystem(int rs) {
-		this.referenceSystem = rs;
-	}
+    public void setReferenceSystem(int rs) {
+        this.referenceSystem = rs;
+    }
 
-	public void setMinFeature(double min) {
-		this.minFeature = min;
-	}
+    public void setMinFeature(double min) {
+        this.minFeature = min;
+    }
 
-	public void setMaxFeature(double max) {
-		this.maxFeature = max;
-	}
+    public void setMaxFeature(double max) {
+        this.maxFeature = max;
+    }
 
-	@Override
-	public ISymbol getSymbolByFeature(Feature feat) throws MapContextException {
+    @Override
+    public ISymbol getSymbolByFeature(Feature feat) throws MapContextException {
 
-		if (this.onlySelection)
-			if (!featSelection.isSelected(feat))
-				return null;
+        if (this.onlySelection) {
+            if (!featSelection.isSelected(feat)) {
+                return null;
+            }
+        }
 
-		// TODO: AQUÍ PRODRÍAMOS RECUPERAR VARIOS SIMBOLOS. POR AHORA, SUPONEMOS QUE EL DEFAULTSYMBOL ES EL QUE TIENE EL CHARTSYMBOL
-		symbol = (IChartSymbol) getDefaultSymbol();
-		if (symbol==null){
-			symbol = (IChartSymbol) MapContextLocator
-				.getSymbolManager().createSymbol(IChartSymbol.SYMBOL_NAME);
+        // TODO: AQUÍ PRODRÍAMOS RECUPERAR VARIOS SIMBOLOS. POR AHORA, SUPONEMOS QUE EL DEFAULTSYMBOL ES EL QUE TIENE EL CHARTSYMBOL
+        symbol = (IChartSymbol) getDefaultSymbol();
+        if (symbol == null) {
+            symbol = (IChartSymbol) MapContextLocator
+                    .getSymbolManager().createSymbol(IChartSymbol.SYMBOL_NAME);
 
-		}
-		symbol.setOnlySelection(onlySelection);
-		double size=0;
+        }
+        symbol.setOnlySelection(onlySelection);
+        double size = 0;
 
-			ChartDataSet dataSet = ChartLocator.getServiceManager()
-				.getChartManager().createChartDataSet();
+        ChartDataSet dataSet = ChartLocator.getServiceManager()
+                .getChartManager().createChartDataSet();
 
-		String[] names=getFieldNames();
-		String[] labels=getFieldLabels();
-		if (names!=null && labels != null && labels.length == names.length){
+        String[] names = getFieldNames();
+        String[] labels = getFieldLabels();
+        if (names != null && labels != null && labels.length == names.length) {
 
-			ArrayList serie = new ArrayList();
-			ArrayList category = new ArrayList();
-			for (int i = 0; i < names.length; i++) {
-				double val = feat.getDouble(names[i]);
-				if (sizeOption==IChartSymbol.SIZESUM){
-					size+=val;
-				}
-				if(!this.onlySelection || featSelection.isSelected(feat)){
-					serie.add(labels[i]);
-					category.add(val);
-				}
-			}
-			dataSet.addData("series", serie);
-			dataSet.addData("categories", category);
+            ArrayList serie = new ArrayList();
+            ArrayList category = new ArrayList();
+            for (int i = 0; i < names.length; i++) {
+                double val = feat.getDouble(names[i]);
+                if (sizeOption == IChartSymbol.SIZESUM) {
+                    size += val;
+                }
+                if (!this.onlySelection || featSelection.isSelected(feat)) {
+                    serie.add(labels[i]);
+                    category.add(val);
+                }
+            }
+            dataSet.addData("series", serie);
+            dataSet.addData("categories", category);
 
-			if(!this.onlySelection || featSelection.isSelected(feat)){
-				symbol.getChart().setChartDataSet(dataSet);
-			}
-			ChartService cs = symbol.getChart();
-//			cs.createChartLegendItems();
-			List<ChartSerieEntity> lst  = cs.getChartLegendItems();
+            if (!this.onlySelection || featSelection.isSelected(feat)) {
+                symbol.getChart().setChartDataSet(dataSet);
+            }
+            ChartService cs = symbol.getChart();
 
-			for (int j=0; j < names.length; j++) {
-				LegendItem item = new LegendItem(names[j], getSymbolByValue(names[j]).getColor());
-				item.setSeriesKey(names[j]);
-				ChartSerieEntity e = cs.createNewChartSerieEntity(item);
-				if(e!=null)
-					lst.add(e);
-			}
-		}
-		double separation = sizeTo-sizeFrom;
+            List<ChartSerieEntity> lst = cs.getChartLegendItems();
 
-		if (sizeOption==IChartSymbol.SIZESUM){
-			if (isActiveLimits()){
-				double difFeat = maxFeature - minFeature;
-				double step = difFeat/separation;
-				size = sizeFrom + ((size - minFeature)/step);
-			}
-			symbol.setSize(size);
-		}else if (sizeOption==IChartSymbol.SIZEFIELD){
-			if(separation == 0)
-				separation = 1;
-			double value=feat.getDouble(getFieldSize());
+            for (int j = 0; j < names.length; j++) {
+                LegendItem item = new LegendItem(names[j], getSymbolByValue(names[j]).getColor());
+                item.setSeriesKey(names[j]);
+                ChartSerieEntity e = cs.createNewChartSerieEntity(item);
+                if (e != null) {
+                    lst.add(e);
+                }
+            }
+        }
+        double separation = sizeTo - sizeFrom;
 
-			if (!getFieldNormalize().equals("---")){
-				double normalize=feat.getDouble(getFieldNormalize());
-				if (normalize!=0){
-					value= value/normalize;
-				}
-				if (isActiveLimits())
-					size = sizeFrom + (value * separation) ;
-				else
-					size=value;
-			}else{
-				if (isActiveLimits()){
-					double difFeat = maxFeature - minFeature;
-					double step = difFeat/separation;
-					size = sizeFrom + ((value - minFeature)/step);
-				}else{
-					size=value;
-				}
-			}
+        switch (sizeOption) {
+            case IChartSymbol.SIZESUM:
+                if (isActiveLimits()) {
+                    double difFeat = maxFeature - minFeature;
+                    double step = difFeat / separation;
+                    size = sizeFrom + ((size - minFeature) / step);
+                }
+                symbol.setSize(size);
+                break;
+            case IChartSymbol.SIZEFIELD:
+                if (separation == 0) {
+                    separation = 1;
+                }
+                double value = feat.getDouble(getFieldSize());
+                if (!getFieldNormalize().equals("---")) {
+                    double normalize = feat.getDouble(getFieldNormalize());
+                    if (normalize != 0) {
+                        value = value / normalize;
+                    }
+                    if (isActiveLimits()) {
+                        size = sizeFrom + (value * separation);
+                    } else {
+                        size = value;
+                    }
+                } else {
+                    if (isActiveLimits()) {
+                        double difFeat = maxFeature - minFeature;
+                        double step = difFeat / separation;
+                        size = sizeFrom + ((value - minFeature) / step);
+                    } else {
+                        size = value;
+                    }
+                }
+                symbol.setSize(size);
+                break;
+            default:
+                symbol.setSize(getSize());
+                break;
+        }
+        return symbol;
 
-		}else{
-				symbol.setSize(getSize());
-		}
-		return symbol;
+    }
 
-	}
+    public String[] getFieldNames() {
+        return fields;
+    }
 
-	public String[] getFieldNames() {
-		return fields;
-	}
+    public String[] getFieldLabels() {
+        if (labels == null) {
+            return new String[0];
+        }
+        return labels;
+    }
 
-	public String[] getFieldLabels() {
-		if(labels==null)
-			return new String[0];
-		return labels;
-	}
+    public void setFields(String[] fields) {
+        this.fields = fields;
+        updateSymbols();
+    }
 
-	public void setFields(String[] fields) {
-		this.fields = fields;
-		updateSymbols();
-	}
+    public void setLabels(String[] fields) {
+        this.labels = fields;
+        updateSymbols();
+    }
 
-	public void setLabels(String[] fields) {
-		this.labels = fields;
-		updateSymbols();
-	}
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public void loadFromState(PersistentState state)
+            throws PersistenceException {
+        // Set parent properties
+        super.loadFromState(state);
 
-	@SuppressWarnings({ "unchecked", "rawtypes" })
-	public void loadFromState(PersistentState state)
-			throws PersistenceException {
-		// Set parent properties
-		super.loadFromState(state);
+        this.fields = state.getStringArray(FIELD_NAMES);
+        this.labels = state.getStringArray(FIELD_LABEL_NAMES);
+        this.colors = (Color[]) state.getArray(FIELD_LABEL_COLOR, Color.class);
+        // Set own properties
+        this.backgroundSymbol = (ISymbol) state.get("backgroundSymbol");
+        this.size = state.getInt("size");
+        this.is3D = state.getBoolean("is3D");
 
-		this.fields = state.getStringArray(FIELD_NAMES);
-		this.labels = state.getStringArray(FIELD_LABEL_NAMES);
-		this.colors = (Color[]) state.getArray(FIELD_LABEL_COLOR,Color.class);
-		// Set own properties
-		this.backgroundSymbol = (ISymbol) state.get("backgroundSymbol");
-		this.size = state.getInt("size");
-		this.is3D = state.getBoolean("is3D");
+        this.isOutlineShow = state.getBoolean("isOutlineShow");
+        this.onlySelection = state.getBoolean("onlySelection");
+        this.isActiveLimits = state.getBoolean("isActiveLimits");
 
-		this.isOutlineShow = state.getBoolean("isOutlineShow");
-		this.onlySelection = state.getBoolean("onlySelection");
-		this.isActiveLimits = state.getBoolean("isActiveLimits");
+        this.outlineWidth = state.getInt("outlineWidth");
+        this.referenceSystem = state.getInt("referenceSystem");
+        this.sizeFrom = state.getInt("sizeFrom");
+        this.sizeTo = state.getInt("sizeTo");
+        this.unit = state.getInt("unit");
+        this.sizeOption = state.getInt("sizeOption");
 
-		this.outlineWidth = state.getInt("outlineWidth");
-		this.referenceSystem = state.getInt("referenceSystem");
-		this.sizeFrom = state.getInt("sizeFrom");
-		this.sizeTo = state.getInt("sizeTo");
-		this.unit = state.getInt("unit");
-		this.sizeOption = state.getInt("sizeOption");
+        this.outlineColor = (Color) state.get("outlineColor");
+        this.symbol = (IChartSymbol) state.get("symbol");
+        this.featSelection = (FeatureSelection) state.get("featSelection");
 
-		this.outlineColor = (Color) state.get("outlineColor");
-		this.symbol = (IChartSymbol) state.get("symbol");
-		this.featSelection = (FeatureSelection) state.get("featSelection");
+        this.fieldSize = state.getString("fieldSize");
+        this.fieldNormalize = state.getString("fieldNormalize");
 
-		this.fieldSize = state.getString("fieldSize");
-		this.fieldNormalize = state.getString("fieldNormalize");
+        this.minFeature = state.getDouble("minFeature");
+        this.maxFeature = state.getDouble("maxFeature");
+        this.maxField = state.getDouble("maxField");
+    }
 
-		this.minFeature = state.getDouble("minFeature");
-		this.maxFeature = state.getDouble("maxFeature");
-		this.maxField = state.getDouble("maxField");
-	}
+    public void saveToState(PersistentState state) throws PersistenceException {
+        // Save parent properties
+        super.saveToState(state);
+        // Save own properties
+        state.set(FIELD_NAMES, this.fields);
+        state.set(FIELD_LABEL_NAMES, this.labels);
+        state.set(FIELD_LABEL_COLOR, this.colors);
 
-	public void saveToState(PersistentState state) throws PersistenceException {
-		// Save parent properties
-		super.saveToState(state);
-		// Save own properties
-		state.set(FIELD_NAMES, this.fields);
-		state.set(FIELD_LABEL_NAMES, this.labels);
-		state.set(FIELD_LABEL_COLOR, this.colors);
+        state.set("backgroundSymbol", this.backgroundSymbol);
+        state.set("size", this.size);
+        state.set("is3D", this.is3D);
 
-		state.set("backgroundSymbol", this.backgroundSymbol);
-		state.set("size", this.size);
-		state.set("is3D", this.is3D);
+        state.set("isOutlineShow", this.isOutlineShow);
+        state.set("onlySelection", this.onlySelection);
+        state.set("isActiveLimits", this.isActiveLimits);
 
-		state.set("isOutlineShow", this.isOutlineShow);
-		state.set("onlySelection", this.onlySelection);
-		state.set("isActiveLimits", this.isActiveLimits);
+        state.set("outlineWidth", this.outlineWidth);
+        state.set("referenceSystem", this.referenceSystem);
+        state.set("sizeFrom", this.sizeFrom);
+        state.set("sizeTo", this.sizeTo);
+        state.set("unit", this.unit);
+        state.set("sizeOption", this.sizeOption);
 
-		state.set("outlineWidth", this.outlineWidth);
-		state.set("referenceSystem", this.referenceSystem);
-		state.set("sizeFrom", this.sizeFrom);
-		state.set("sizeTo", this.sizeTo);
-		state.set("unit", this.unit);
-		state.set("sizeOption", this.sizeOption);
+        state.set("outlineColor", this.outlineColor);
+        state.set("symbol", this.symbol);
+        state.set("featSelection", this.featSelection);
 
-		state.set("outlineColor", this.outlineColor);
-		state.set("symbol", this.symbol);
-		state.set("featSelection", this.featSelection);
+        state.set("fieldSize", this.fieldSize);
+        state.set("fieldNormalize", this.fieldNormalize);
 
-		state.set("fieldSize", this.fieldSize);
-		state.set("fieldNormalize", this.fieldNormalize);
+        state.set("minFeature", this.minFeature);
+        state.set("maxFeature", this.maxFeature);
+        state.set("maxField", this.maxField);
 
-		state.set("minFeature", this.minFeature);
-		state.set("maxFeature", this.maxFeature);
-		state.set("maxField", this.maxField);
+    }
 
-	}
-
-	public static class RegisterPersistence implements Callable {
-
-		public Object call() throws Exception {
-			PersistenceManager manager = ToolsLocator.getPersistenceManager();
-			if( manager.getDefinition(PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME)==null ) {
-				DynStruct definition = manager.addDefinition(
-						BasePieChartLegend.class,
-						PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME,
-						PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
-						null,
-						null
-				);
-				// Extend the Classified Vector Legend base definition
-				definition.extend(manager.getDefinition(VECTORIAL_UNIQUE_VALUE_LEGEND_PERSISTENCE_DEFINITION_NAME));
-
-				// Field names
-				definition.addDynFieldArray(FIELD_NAMES)
-				.setClassOfItems(String.class);
-				definition.addDynFieldArray(FIELD_LABEL_NAMES)
-					.setClassOfItems(String.class);
-				definition.addDynFieldArray(FIELD_LABEL_COLOR)
-				.setClassOfItems(Color.class);
-
-				definition.addDynField("backgroundSymbol").setClassOfValue(ISymbol.class);
-				definition.addDynFieldInt("size");
-				definition.addDynFieldBoolean("is3D");
-
-				definition.addDynFieldBoolean("isOutlineShow");
-				definition.addDynFieldBoolean("onlySelection");
-				definition.addDynFieldBoolean("isActiveLimits");
-
-				definition.addDynFieldInt("outlineWidth");
-				definition.addDynFieldInt("referenceSystem");
-				definition.addDynFieldInt("sizeFrom");
-				definition.addDynFieldInt("sizeTo");
-				definition.addDynFieldInt("unit");
-				definition.addDynFieldInt("sizeOption");
-
-				definition.addDynFieldObject("outlineColor").setClassOfValue(Color.class);
-				definition.addDynFieldObject("symbol").setClassOfValue(IChartSymbol.class);
-				definition.addDynFieldObject("featSelection").setClassOfValue(FeatureSelection.class);
-
-				definition.addDynFieldString("fieldSize");
-				definition.addDynFieldString("fieldNormalize");
-
-				definition.addDynFieldDouble("minFeature");
-				definition.addDynFieldDouble("maxFeature");
-				definition.addDynFieldDouble("maxField");
-			}
-			return Boolean.TRUE;
-		}
-
-	}
-
+//	public static class RegisterPersistence implements Callable {
+//
+//		public Object call() throws Exception {
+//			PersistenceManager manager = ToolsLocator.getPersistenceManager();
+//			if( manager.getDefinition(BASE_PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME)==null ) {
+//				DynStruct definition = manager.addDefinition(
+//						BasePieChartLegend.class,
+//						BASE_PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME,
+//						BASE_PIE_CHART_LEGEND_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
+//						null,
+//						null
+//				);
+//				// Extend the Classified Vector Legend base definition
+//				definition.extend(manager.getDefinition(VECTORIAL_UNIQUE_VALUE_LEGEND_PERSISTENCE_DEFINITION_NAME));
+//
+//				// Field names
+//				definition.addDynFieldArray(FIELD_NAMES)
+//				.setClassOfItems(String.class);
+//				definition.addDynFieldArray(FIELD_LABEL_NAMES)
+//					.setClassOfItems(String.class);
+//				definition.addDynFieldArray(FIELD_LABEL_COLOR)
+//				.setClassOfItems(Color.class);
+//
+//				definition.addDynField("backgroundSymbol").setClassOfValue(ISymbol.class);
+//				definition.addDynFieldInt("size");
+//				definition.addDynFieldBoolean("is3D");
+//
+//				definition.addDynFieldBoolean("isOutlineShow");
+//				definition.addDynFieldBoolean("onlySelection");
+//				definition.addDynFieldBoolean("isActiveLimits");
+//
+//				definition.addDynFieldInt("outlineWidth");
+//				definition.addDynFieldInt("referenceSystem");
+//				definition.addDynFieldInt("sizeFrom");
+//				definition.addDynFieldInt("sizeTo");
+//				definition.addDynFieldInt("unit");
+//				definition.addDynFieldInt("sizeOption");
+//
+//				definition.addDynFieldObject("outlineColor").setClassOfValue(Color.class);
+//				definition.addDynFieldObject("symbol").setClassOfValue(IChartSymbol.class);
+//				definition.addDynFieldObject("featSelection").setClassOfValue(FeatureSelection.class);
+//
+//				definition.addDynFieldString("fieldSize");
+//				definition.addDynFieldString("fieldNormalize");
+//
+//				definition.addDynFieldDouble("minFeature");
+//				definition.addDynFieldDouble("maxFeature");
+//				definition.addDynFieldDouble("maxField");
+//			}
+//			return Boolean.TRUE;
+//		}
+//
+//	}
     protected void updateSymbols() {
         ISymbol[] symbols = getSymbols();
-        for (int i = 0; i < symbols.length; i++) {
-            delSymbol(getSymbolKey(symbols[i]));
+        for (ISymbol symbol1 : symbols) {
+            delSymbol(getSymbolKey(symbol1));
         }
         if (fields != null && colors != null && labels != null) {
 
             if (fields.length != colors.length) {
                 LOG.warn("The length of fields and colors isn't the same: fields.length = " + fields.length
-                    + " fields.length = " + colors.length);
+                        + " fields.length = " + colors.length);
             }
 
             if (fields.length != labels.length) {
                 LOG.warn("The length of fields and labels isn't the same: fields.length = " + fields.length
-                    + " labels.length = " + labels.length);
+                        + " labels.length = " + labels.length);
             }
 
             for (int i = 0; i < Math.min(fields.length, Math.min(labels.length, colors.length)); i++) {
-                ISimpleFillSymbol symbol = SymbologyLocator.getSymbologyManager().createSimpleFillSymbol();
-                symbol.setColor(colors[i]);
-                symbol.setDescription(labels[i]);
-                addSymbol(fields[i], symbol);
+                ISimpleFillSymbol symbol1 = SymbologyLocator.getSymbologyManager().createSimpleFillSymbol();
+                symbol1.setColor(colors[i]);
+                symbol1.setDescription(labels[i]);
+                addSymbol(fields[i], symbol1);
             }
         }
     }
