/* * JasperReports - Free Java Reporting Library. * Copyright (C) 2001 - 2009 Jaspersoft Corporation. All rights reserved. * http://www.jaspersoft.com * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is part of JasperReports. * * JasperReports is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JasperReports is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JasperReports. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.jasperreports.charts.base; import java.io.IOException; import java.io.ObjectInputStream; import net.sf.jasperreports.charts.JRItemLabel; import net.sf.jasperreports.charts.JRPie3DPlot; import net.sf.jasperreports.engine.JRChart; import net.sf.jasperreports.engine.JRChartPlot; import net.sf.jasperreports.engine.JRConstants; import net.sf.jasperreports.engine.JRExpressionCollector; import net.sf.jasperreports.engine.base.JRBaseChartPlot; import net.sf.jasperreports.engine.base.JRBaseObjectFactory; /** * @author Teodor Danciu (teodord@users.sourceforge.net) * @version $Id: JRBasePie3DPlot.java 3715 2010-04-08 18:08:49Z teodord $ */ public class JRBasePie3DPlot extends JRBaseChartPlot implements JRPie3DPlot { /** * */ private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; public static final String PROPERTY_CIRCULAR = "circular"; public static final String PROPERTY_DEPTH_FACTOR = "depthFactor"; public static final String PROPERTY_LABEL_FORMAT = "labelFormat"; public static final String PROPERTY_LEGEND_LABEL_FORMAT = "legendLabelFormat"; public static final String PROPERTY_ITEM_LABEL = "itemLabel"; protected Double depthFactorDouble = null; protected Boolean circular = null; protected String labelFormat = null; protected String legendLabelFormat = null; protected JRItemLabel itemLabel = null; /** * */ public JRBasePie3DPlot(JRChartPlot pie3DPlot, JRChart chart) { super(pie3DPlot, chart); if (pie3DPlot == null) { itemLabel = new JRBaseItemLabel(null, chart); } else { itemLabel = new JRBaseItemLabel(((JRPie3DPlot)pie3DPlot).getItemLabel(), chart); } } /** * */ public JRBasePie3DPlot(JRPie3DPlot pie3DPlot, JRBaseObjectFactory factory) { super(pie3DPlot, factory); depthFactorDouble = pie3DPlot.getDepthFactorDouble(); circular = pie3DPlot.getCircular(); labelFormat = pie3DPlot.getLabelFormat(); legendLabelFormat = pie3DPlot.getLegendLabelFormat(); itemLabel = new JRBaseItemLabel(pie3DPlot.getItemLabel(), factory); } /** * @deprecated Replaced by {@link #getDepthFactorDouble()} */ public double getDepthFactor() { return depthFactorDouble == null ? DEPTH_FACTOR_DEFAULT : depthFactorDouble.doubleValue(); } /** * */ public Double getDepthFactorDouble() { return depthFactorDouble; } /** * */ public JRItemLabel getItemLabel() { return itemLabel; } /** * @deprecated Replaced by {@link #setDepthFactor(Double)} */ public void setDepthFactor(double depthFactor) { setDepthFactor(new Double(depthFactor)); } /** * */ public void setDepthFactor(Double depthFactor) { Double old = this.depthFactorDouble; this.depthFactorDouble = depthFactor; getEventSupport().firePropertyChange(PROPERTY_DEPTH_FACTOR, old, this.depthFactorDouble); } /** * */ public void collectExpressions(JRExpressionCollector collector) { } /** * @deprecated Replaced by {@link #getCircular()} */ public boolean isCircular() { return circular == null ? false : circular.booleanValue(); } /** * */ public Boolean getCircular() { return circular; } /** * @param isCircular the isCircular to set * @deprecated Replaced by {@link #setCircular(Boolean)} */ public void setCircular(boolean isCircular) { setCircular(Boolean.valueOf(isCircular)); } /** * @param isCircular the isCircular to set */ public void setCircular(Boolean isCircular) { Boolean old = this.circular; this.circular = isCircular; getEventSupport().firePropertyChange(PROPERTY_CIRCULAR, old, this.circular); } /** * @return the labelFormat */ public String getLabelFormat() { return labelFormat; } /** * @param labelFormat the labelFormat to set */ public void setLabelFormat(String labelFormat) { String old = this.labelFormat; this.labelFormat = labelFormat; getEventSupport().firePropertyChange(PROPERTY_LABEL_FORMAT, old, this.labelFormat); } /** * @return the legendLabelFormat */ public String getLegendLabelFormat() { return legendLabelFormat; } /** * @param legendLabelFormat the legendLabelFormat to set */ public void setLegendLabelFormat(String legendLabelFormat) { String old = this.legendLabelFormat; this.legendLabelFormat = legendLabelFormat; getEventSupport().firePropertyChange(PROPERTY_LEGEND_LABEL_FORMAT, old, this.legendLabelFormat); } /** * @param itemLabel the itemLabel to set */ public void setItemLabel(JRItemLabel itemLabel) { JRItemLabel old = this.itemLabel; this.itemLabel = itemLabel; getEventSupport().firePropertyChange(PROPERTY_ITEM_LABEL, old, this.itemLabel); } /* * These fields are only for serialization backward compatibility. */ private int PSEUDO_SERIAL_VERSION_UID = JRConstants.PSEUDO_SERIAL_VERSION_UID; //NOPMD /** * @deprecated */ private double depthFactor = DEPTH_FACTOR_DEFAULT; /** * @deprecated */ private boolean isCircular = false; private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_1_3) { depthFactorDouble = new Double(depthFactor); circular = Boolean.valueOf(isCircular); } } }