package net.sf.jasperreports.engine.base;

import net.sf.jasperreports.engine.JRCommonRectangle;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRRectangle;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRStyleResolver;

public class JRBaseRectangle extends JRBaseGraphicElement implements JRRectangle {
  private static final long serialVersionUID = 10200L;
  
  protected Integer radius;
  
  protected JRBaseRectangle(JRRectangle rectangle, JRBaseObjectFactory factory) {
    super((JRGraphicElement)rectangle, factory);
    this.radius = rectangle.getOwnRadius();
  }
  
  public int getRadius() {
    return JRStyleResolver.getRadius((JRCommonRectangle)this);
  }
  
  public Integer getOwnRadius() {
    return this.radius;
  }
  
  public void setRadius(int radius) {
    setRadius(new Integer(radius));
  }
  
  public void setRadius(Integer radius) {
    Object old = this.radius;
    this.radius = radius;
    getEventSupport().firePropertyChange("radius", old, this.radius);
  }
  
  public void collectExpressions(JRExpressionCollector collector) {
    collector.collect(this);
  }
  
  public void visit(JRVisitor visitor) {
    visitor.visitRectangle(this);
  }
}
