package net.sf.jasperreports.charts.design;

import net.sf.jasperreports.charts.JRValueDataset;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.design.JRDesignChartDataset;
import net.sf.jasperreports.engine.design.JRVerifier;

public class JRDesignValueDataset extends JRDesignChartDataset implements JRValueDataset {
  private static final long serialVersionUID = 10200L;
  
  public static final String PROPERTY_VALUE_EXPRESSION = "valueExpression";
  
  protected JRExpression valueExpression = null;
  
  public JRDesignValueDataset(JRChartDataset dataset) {
    super(dataset);
  }
  
  public JRExpression getValueExpression() {
    return this.valueExpression;
  }
  
  public void setValueExpression(JRExpression valueExpression) {
    Object old = this.valueExpression;
    this.valueExpression = valueExpression;
    getEventSupport().firePropertyChange("valueExpression", old, this.valueExpression);
  }
  
  public byte getDatasetType() {
    return 8;
  }
  
  public void collectExpressions(JRExpressionCollector collector) {
    collector.collect(this);
  }
  
  public void validate(JRVerifier verifier) {
    verifier.verify(this);
  }
  
  public Object clone() {
    JRDesignValueDataset clone = (JRDesignValueDataset)super.clone();
    if (this.valueExpression != null)
      clone.valueExpression = (JRExpression)this.valueExpression.clone(); 
    return clone;
  }
}
