protected void setValidationMarkers(JRValidationException e, JasperDesign design) { for (JRValidationFault fault : e.getFaults()) { String message = fault.getMessage(); SourceLocation location = null; Object source = fault.getSource(); if (source != null) { location = digester.getLocation(source); if (location == null) message = message + " --- " + source.toString(); //$NON-NLS-1$ } if (source instanceof StandardTable){ JRDesignElement componentElement = getElementFromTable(design.getAllBands(), (StandardTable)source); if (componentElement != null) source = componentElement; } if (location == null && source instanceof JRDesignElement) errorHandler.addMarker(message, location, (JRDesignElement)source); else errorHandler.addMarker(message, location); } }
/** * Creates an object from a subreport copied value XML element. * * @param atts the element attributes * @return a {@link JRDesignSubreportReturnValue JRDesignSubreportReturnValue} object */ @Override public Object createObject(Attributes atts) { JRXmlLoader xmlLoader = (JRXmlLoader) digester.peek(digester.getCount() - 1); JasperDesign design = (JasperDesign) digester.peek(digester.getCount() - 2); JRDesignSubreportReturnValue returnValue = new JRDesignSubreportReturnValue(); String variableName = atts.getValue(JRXmlConstants.ATTRIBUTE_toVariable); JRVariable variable = design.getVariablesMap().get(variableName); if (variable == null) { xmlLoader.addError(new JRValidationException("Unknown variable " + variableName, returnValue)); } returnValue.setSubreportVariable(atts.getValue(JRXmlConstants.ATTRIBUTE_subreportVariable)); returnValue.setToVariable(variableName); CalculationEnum calculation = CalculationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_calculation)); if (calculation != null) { returnValue.setCalculation(calculation); } String incrementerFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_incrementerFactoryClass); if (incrementerFactoryClass != null) { returnValue.setIncrementerFactoryClassName(incrementerFactoryClass); } return returnValue; }
/** * @param atts the element attributes * @return a {@link DesignExpressionReturnValue DesignExpressionReturnValue} object */ @Override public Object createObject(Attributes atts) { JRXmlLoader xmlLoader = (JRXmlLoader) digester.peek(digester.getCount() - 1); JasperDesign design = (JasperDesign) digester.peek(digester.getCount() - 2); DesignExpressionReturnValue returnValue = new DesignExpressionReturnValue(); String variableName = atts.getValue(JRXmlConstants.ATTRIBUTE_toVariable); JRVariable variable = design.getVariablesMap().get(variableName); if (variable == null) { xmlLoader.addError(new JRValidationException("Unknown variable " + variableName, returnValue)); } returnValue.setToVariable(variableName); CalculationEnum calculation = CalculationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_calculation)); if (calculation != null) { returnValue.setCalculation(calculation); } String incrementerFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_incrementerFactoryClass); if (incrementerFactoryClass != null) { returnValue.setIncrementerFactoryClassName(incrementerFactoryClass); } return returnValue; }
@Override public void groupNotFound(String groupName) throws JRValidationException { throw new JRValidationException("Unknown reprint group '" + groupName + "' for element.", element); }
@Override public void groupNotFound(String groupName) throws JRValidationException { throw new JRValidationException("Unknown evaluation group '" + groupName + "' for chart.", chart); }
@Override public void groupNotFound(String groupName) throws JRValidationException { throw new JRValidationException("Unknown evaluation group '" + groupName + "' for image.", image); }
@Override public void groupNotFound(String groupName) throws JRValidationException { throw new JRValidationException("Unknown evaluation group '" + groupName + "' for text field.", textField); }
protected void verifyBandHeights() throws JRException { if (!filler.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.parent != null && parentFiller.parent.getFiller() instanceof JRBaseFiller ? (JRBaseFiller) parentFiller.parent.getFiller() : null;//FIXMEBOOK } 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 + ")"); } } }
void groupNotFound(String groupName) throws JRValidationException;