protected void verifyBandHeights() throws JRException {
    if (!filler.fillContext.isIgnorePagination()) {
      int pageHeight;
      int topMargin = jasperReport.getTopMargin();
      int bottomMargin = jasperReport.getBottomMargin();

      JRBaseFiller parentFiller = filler;
      do {
        // set every time, so at the end it will be the master page height
        pageHeight = parentFiller.jasperReport.getPageHeight();

        // sum parent page margins
        topMargin += parentFiller.jasperReport.getTopMargin();
        bottomMargin += parentFiller.jasperReport.getBottomMargin();

        parentFiller = parentFiller.parentFiller;
      } while (parentFiller != null);

      List<JRValidationFault> brokenRules = new ArrayList<JRValidationFault>();
      JRVerifier.verifyBandHeights(brokenRules, jasperReport, pageHeight, topMargin, bottomMargin);

      if (!brokenRules.isEmpty()) {
        throw new JRValidationException(
            "Band height validation for subreport \""
                + jasperReport.getName()
                + "\" failed in the current page context "
                + "(height = "
                + pageHeight
                + ", top margin = "
                + topMargin
                + ", bottom margin = "
                + bottomMargin
                + ") : ",
            brokenRules);
      } else if (log.isDebugEnabled()) {
        log.debug(
            "Band height validation for subreport \""
                + jasperReport.getName()
                + "\" succeeded in the current page context "
                + "(height = "
                + pageHeight
                + ", top margin = "
                + topMargin
                + ", bottom margin = "
                + bottomMargin
                + ")");
      }
    }
  }
 public void validate(JRVerifier verifier) {
   verifier.verify(this);
 }
Exemplo n.º 3
0
 /**
  * Verifies the validity and consistency of the report design object. Returns a collection of
  * {@link JRValidationFault errors}, if problems are found in the report design.
  *
  * @param jasperDesign report design object to verify
  * @return collection of {@link JRValidationFault JRValidationFault} if problems are found
  * @see net.sf.jasperreports.engine.design.JRVerifier
  */
 public static Collection verifyDesign(JasperDesign jasperDesign) {
   return JRVerifier.verifyDesign(jasperDesign);
 }