package net.sf.jasperreports.charts.fill;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.sf.jasperreports.charts.JRChartAxis;
import net.sf.jasperreports.charts.JRMultiAxisPlot;
import net.sf.jasperreports.engine.JRChartPlot;
import net.sf.jasperreports.engine.fill.JRFillChartDataset;
import net.sf.jasperreports.engine.fill.JRFillChartPlot;
import net.sf.jasperreports.engine.fill.JRFillObjectFactory;

public class JRFillMultiAxisPlot extends JRFillChartPlot implements JRMultiAxisPlot {
  private List axes;
  
  public JRFillMultiAxisPlot(JRMultiAxisPlot multiAxisPlot, JRFillObjectFactory factory) {
    super((JRChartPlot)multiAxisPlot, factory);
    List parentAxes = multiAxisPlot.getAxes();
    this.axes = new ArrayList(parentAxes.size());
    Iterator iter = parentAxes.iterator();
    while (iter.hasNext()) {
      JRChartAxis axis = iter.next();
      this.axes.add(factory.getChartAxis(axis));
    } 
  }
  
  public List getAxes() {
    return this.axes;
  }
  
  public JRFillChartDataset getMainDataset() {
    return (JRFillChartDataset)((JRFillChartAxis)this.axes.get(0)).getFillChart().getDataset();
  }
}
