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 + ")"); } } }
private static JRDataset findSubdataset(JRDatasetRun datasetRun, JasperReport report) { JRDataset[] datasets = report.getDatasets(); JRDataset reportDataset = null; if (datasets != null) { for (int i = 0; i < datasets.length; i++) { if (datasetRun.getDatasetName().equals(datasets[i].getName())) { reportDataset = datasets[i]; break; } } } if (reportDataset == null) { throw new JRRuntimeException( "Could not find subdataset named \"" + datasetRun.getDatasetName() + "\" in report \"" + report.getName() + "\""); } return reportDataset; }