package net.sf.jasperreports.engine.design;

import net.sf.jasperreports.engine.JRBand;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JROrigin;

public class JRDesignBand extends JRDesignElementGroup implements JRBand {
  private static final long serialVersionUID = 10200L;
  
  public static final String PROPERTY_HEIGHT = "height";
  
  public static final String PROPERTY_PRINT_WHEN_EXPRESSION = "printWhenExpression";
  
  protected int height = 0;
  
  protected boolean isSplitAllowed = true;
  
  protected JRExpression printWhenExpression = null;
  
  private JROrigin origin;
  
  public int getHeight() {
    return this.height;
  }
  
  public void setHeight(int height) {
    int old = this.height;
    this.height = height;
    getEventSupport().firePropertyChange("height", old, this.height);
  }
  
  public boolean isSplitAllowed() {
    return this.isSplitAllowed;
  }
  
  public void setSplitAllowed(boolean isSplitAllowed) {
    boolean old = this.isSplitAllowed;
    this.isSplitAllowed = isSplitAllowed;
    getEventSupport().firePropertyChange("splitAllowed", old, this.isSplitAllowed);
  }
  
  public JRExpression getPrintWhenExpression() {
    return this.printWhenExpression;
  }
  
  public void setPrintWhenExpression(JRExpression expression) {
    Object old = this.printWhenExpression;
    this.printWhenExpression = expression;
    getEventSupport().firePropertyChange("printWhenExpression", old, this.printWhenExpression);
  }
  
  public JROrigin getOrigin() {
    return this.origin;
  }
  
  void setOrigin(JROrigin origin) {
    this.origin = origin;
  }
  
  public Object clone() {
    JRDesignBand clone = (JRDesignBand)super.clone();
    if (this.printWhenExpression != null)
      clone.printWhenExpression = (JRExpression)this.printWhenExpression.clone(); 
    if (this.origin != null)
      clone.origin = (JROrigin)this.origin.clone(); 
    return clone;
  }
}
