package net.sf.jasperreports.charts.base;

import java.io.Serializable;
import net.sf.jasperreports.charts.JRChartAxis;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRVisitable;
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;

public class JRBaseChartAxis implements JRChartAxis, Serializable {
  protected byte position = 1;
  
  protected JRChart chart = null;
  
  private static final long serialVersionUID = 10200L;
  
  public JRBaseChartAxis() {}
  
  public JRBaseChartAxis(JRChartAxis axis, JRBaseObjectFactory factory) {
    factory.put(axis, this);
    this.position = axis.getPosition();
    this.chart = (JRChart)factory.getVisitResult((JRVisitable)axis.getChart());
  }
  
  public byte getPosition() {
    return this.position;
  }
  
  public JRChart getChart() {
    return this.chart;
  }
  
  public Object clone(JRChart parentChart) {
    JRBaseChartAxis clone = null;
    try {
      clone = (JRBaseChartAxis)clone();
    } catch (CloneNotSupportedException e) {
      throw new JRRuntimeException(e);
    } 
    clone.chart = parentChart;
    return clone;
  }
}
