package net.sf.jasperreports.engine.fill;

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

public class JRFillGroup implements JRGroup {
  protected JRGroup parent = null;
  
  private JRFillBand groupHeader = null;
  
  private JRFillBand groupFooter = null;
  
  private JRVariable countVariable = null;
  
  private boolean hasChanged = true;
  
  private boolean isTopLevelChange = false;
  
  private boolean isHeaderPrinted = false;
  
  private boolean isFooterPrinted = true;
  
  public JRFillGroup(JRGroup group, JRFillObjectFactory factory) {
    factory.put(group, this);
    this.parent = group;
    String reportName = factory.getFiller().isSubreport() ? factory.getFiller().getJasperReport().getName() : null;
    this.groupHeader = factory.getBand(group.getGroupHeader());
    if (this.groupHeader != (factory.getFiller()).missingFillBand)
      this.groupHeader.setOrigin(new JROrigin(reportName, group.getName(), (byte)5)); 
    this.groupFooter = factory.getBand(group.getGroupFooter());
    if (this.groupFooter != (factory.getFiller()).missingFillBand)
      this.groupFooter.setOrigin(new JROrigin(reportName, group.getName(), (byte)7)); 
    this.countVariable = factory.getVariable(group.getCountVariable());
  }
  
  public String getName() {
    return this.parent.getName();
  }
  
  public JRExpression getExpression() {
    return this.parent.getExpression();
  }
  
  public boolean isStartNewColumn() {
    return this.parent.isStartNewColumn();
  }
  
  public void setStartNewColumn(boolean isStart) {
    this.parent.setStartNewColumn(isStart);
  }
  
  public boolean isStartNewPage() {
    return this.parent.isStartNewPage();
  }
  
  public void setStartNewPage(boolean isStart) {
    this.parent.setStartNewPage(isStart);
  }
  
  public boolean isResetPageNumber() {
    return this.parent.isResetPageNumber();
  }
  
  public void setResetPageNumber(boolean isReset) {
    this.parent.setResetPageNumber(isReset);
  }
  
  public boolean isReprintHeaderOnEachPage() {
    return this.parent.isReprintHeaderOnEachPage();
  }
  
  public void setReprintHeaderOnEachPage(boolean isReprint) {}
  
  public int getMinHeightToStartNewPage() {
    return this.parent.getMinHeightToStartNewPage();
  }
  
  public void setMinHeightToStartNewPage(int minHeight) {}
  
  public JRBand getGroupHeader() {
    return this.groupHeader;
  }
  
  public JRBand getGroupFooter() {
    return this.groupFooter;
  }
  
  public JRVariable getCountVariable() {
    return this.countVariable;
  }
  
  public boolean hasChanged() {
    return this.hasChanged;
  }
  
  public void setHasChanged(boolean hasChanged) {
    this.hasChanged = hasChanged;
  }
  
  public boolean isTopLevelChange() {
    return this.isTopLevelChange;
  }
  
  public void setTopLevelChange(boolean isTopLevelChange) {
    this.isTopLevelChange = isTopLevelChange;
  }
  
  public boolean isHeaderPrinted() {
    return this.isHeaderPrinted;
  }
  
  public void setHeaderPrinted(boolean isHeaderPrinted) {
    this.isHeaderPrinted = isHeaderPrinted;
  }
  
  public boolean isFooterPrinted() {
    return this.isFooterPrinted;
  }
  
  public void setFooterPrinted(boolean isFooterPrinted) {
    this.isFooterPrinted = isFooterPrinted;
  }
  
  public Object clone() {
    return null;
  }
}
