package net.sf.jasperreports.charts.base;

import java.awt.Color;
import net.sf.jasperreports.charts.JRBubblePlot;
import net.sf.jasperreports.charts.JRXAxisFormat;
import net.sf.jasperreports.charts.JRYAxisFormat;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartPlot;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRFont;
import net.sf.jasperreports.engine.JRStyleContainer;
import net.sf.jasperreports.engine.base.JRBaseChartPlot;
import net.sf.jasperreports.engine.base.JRBaseFont;
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
import net.sf.jasperreports.engine.util.JRStyleResolver;

public class JRBaseBubblePlot extends JRBaseChartPlot implements JRBubblePlot {
  private static final long serialVersionUID = 10200L;
  
  public static final String PROPERTY_SCALE_TYPE = "scaleType";
  
  protected JRExpression xAxisLabelExpression = null;
  
  protected JRFont xAxisLabelFont = null;
  
  protected Color xAxisLabelColor = null;
  
  protected JRFont xAxisTickLabelFont = null;
  
  protected Color xAxisTickLabelColor = null;
  
  protected String xAxisTickLabelMask = null;
  
  protected Color xAxisLineColor = null;
  
  protected JRExpression yAxisLabelExpression = null;
  
  protected JRFont yAxisLabelFont = null;
  
  protected Color yAxisLabelColor = null;
  
  protected JRFont yAxisTickLabelFont = null;
  
  protected Color yAxisTickLabelColor = null;
  
  protected String yAxisTickLabelMask = null;
  
  protected Color yAxisLineColor = null;
  
  protected int scaleType = 2;
  
  public JRBaseBubblePlot(JRChartPlot bubblePlot, JRChart chart) {
    super(bubblePlot, chart);
  }
  
  public JRBaseBubblePlot(JRBubblePlot bubblePlot, JRBaseObjectFactory factory) {
    super((JRChartPlot)bubblePlot, factory);
    this.scaleType = bubblePlot.getScaleType();
    this.xAxisLabelExpression = factory.getExpression(bubblePlot.getXAxisLabelExpression());
    this.xAxisLabelFont = (JRFont)new JRBaseFont(null, null, (JRStyleContainer)bubblePlot.getChart(), bubblePlot.getXAxisLabelFont());
    this.xAxisLabelColor = bubblePlot.getOwnXAxisLabelColor();
    this.xAxisTickLabelFont = (JRFont)new JRBaseFont(null, null, (JRStyleContainer)bubblePlot.getChart(), bubblePlot.getXAxisTickLabelFont());
    this.xAxisTickLabelColor = bubblePlot.getOwnXAxisTickLabelColor();
    this.xAxisTickLabelMask = bubblePlot.getXAxisTickLabelMask();
    this.xAxisLineColor = bubblePlot.getXAxisLineColor();
    this.yAxisLabelExpression = factory.getExpression(bubblePlot.getYAxisLabelExpression());
    this.yAxisLabelFont = (JRFont)new JRBaseFont(null, null, (JRStyleContainer)bubblePlot.getChart(), bubblePlot.getYAxisLabelFont());
    this.yAxisLabelColor = bubblePlot.getOwnYAxisLabelColor();
    this.yAxisTickLabelFont = (JRFont)new JRBaseFont(null, null, (JRStyleContainer)bubblePlot.getChart(), bubblePlot.getYAxisTickLabelFont());
    this.yAxisTickLabelColor = bubblePlot.getOwnYAxisTickLabelColor();
    this.yAxisTickLabelMask = bubblePlot.getYAxisTickLabelMask();
    this.yAxisLineColor = bubblePlot.getYAxisLineColor();
  }
  
  public JRExpression getXAxisLabelExpression() {
    return this.xAxisLabelExpression;
  }
  
  public JRFont getXAxisLabelFont() {
    return this.xAxisLabelFont;
  }
  
  public Color getXAxisLabelColor() {
    return JRStyleResolver.getXAxisLabelColor((JRXAxisFormat)this, (JRChartPlot)this);
  }
  
  public Color getOwnXAxisLabelColor() {
    return this.xAxisLabelColor;
  }
  
  public JRFont getXAxisTickLabelFont() {
    return this.xAxisTickLabelFont;
  }
  
  public Color getXAxisTickLabelColor() {
    return JRStyleResolver.getXAxisTickLabelColor((JRXAxisFormat)this, (JRChartPlot)this);
  }
  
  public Color getOwnXAxisTickLabelColor() {
    return this.xAxisTickLabelColor;
  }
  
  public String getXAxisTickLabelMask() {
    return this.xAxisTickLabelMask;
  }
  
  public Color getXAxisLineColor() {
    return JRStyleResolver.getXAxisLineColor((JRXAxisFormat)this, (JRChartPlot)this);
  }
  
  public Color getOwnXAxisLineColor() {
    return this.xAxisLineColor;
  }
  
  public JRExpression getYAxisLabelExpression() {
    return this.yAxisLabelExpression;
  }
  
  public JRFont getYAxisLabelFont() {
    return this.yAxisLabelFont;
  }
  
  public Color getYAxisLabelColor() {
    return JRStyleResolver.getYAxisLabelColor((JRYAxisFormat)this, (JRChartPlot)this);
  }
  
  public Color getOwnYAxisLabelColor() {
    return this.yAxisLabelColor;
  }
  
  public JRFont getYAxisTickLabelFont() {
    return this.yAxisTickLabelFont;
  }
  
  public Color getYAxisTickLabelColor() {
    return JRStyleResolver.getYAxisTickLabelColor((JRYAxisFormat)this, (JRChartPlot)this);
  }
  
  public Color getOwnYAxisTickLabelColor() {
    return this.yAxisTickLabelColor;
  }
  
  public String getYAxisTickLabelMask() {
    return this.yAxisTickLabelMask;
  }
  
  public Color getYAxisLineColor() {
    return JRStyleResolver.getYAxisLineColor((JRYAxisFormat)this, (JRChartPlot)this);
  }
  
  public Color getOwnYAxisLineColor() {
    return this.yAxisLineColor;
  }
  
  public int getScaleType() {
    return this.scaleType;
  }
  
  public void setScaleType(int scaleType) {
    int old = this.scaleType;
    this.scaleType = scaleType;
    getEventSupport().firePropertyChange("scaleType", old, this.scaleType);
  }
  
  public void collectExpressions(JRExpressionCollector collector) {
    collector.collect(this);
  }
  
  public Object clone(JRChart parentChart) {
    JRBaseBubblePlot clone = (JRBaseBubblePlot)super.clone(parentChart);
    if (this.xAxisLabelExpression != null)
      clone.xAxisLabelExpression = (JRExpression)this.xAxisLabelExpression.clone(); 
    if (this.yAxisLabelExpression != null)
      clone.yAxisLabelExpression = (JRExpression)this.yAxisLabelExpression.clone(); 
    return clone;
  }
}
