package net.sf.jasperreports.engine.base;

import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRLine;
import net.sf.jasperreports.engine.JRVisitor;

public class JRBaseLine extends JRBaseGraphicElement implements JRLine {
  private static final long serialVersionUID = 10200L;
  
  public static final String PROPERTY_DIRECTION = "direction";
  
  protected byte direction = 1;
  
  protected JRBaseLine(JRLine line, JRBaseObjectFactory factory) {
    super((JRGraphicElement)line, factory);
    this.direction = line.getDirection();
  }
  
  public void setWidth(int width) {
    if (width == 0)
      width = 1; 
    super.setWidth(width);
  }
  
  public byte getDirection() {
    return this.direction;
  }
  
  public void setDirection(byte direction) {
    byte old = this.direction;
    this.direction = direction;
    getEventSupport().firePropertyChange("direction", old, this.direction);
  }
  
  public void collectExpressions(JRExpressionCollector collector) {
    collector.collect(this);
  }
  
  public void visit(JRVisitor visitor) {
    visitor.visitLine(this);
  }
}
