Java 类net.sf.jasperreports.engine.design.JRValidationException 实例源码

项目:PDFReporter-Studio    文件:JasperReportCompiler.java   
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);
    }
}
项目:jasperreports    文件:JRSubreportReturnValueFactory.java   
/**
 * 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;
}
项目:jasperreports    文件:ExpressionReturnValueFactory.java   
/**
 * @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;
}
项目:jasperreports    文件:ElementReprintGroupReference.java   
@Override
public void groupNotFound(String groupName) throws JRValidationException
{
    throw new JRValidationException("Unknown reprint group '" + groupName + "' for element.", element);
}
项目:jasperreports    文件:ChartEvaluationGroupReference.java   
@Override
public void groupNotFound(String groupName) throws JRValidationException
{
    throw new JRValidationException("Unknown evaluation group '" + groupName + "' for chart.", chart);
}
项目:jasperreports    文件:ImageEvaluationGroupReference.java   
@Override
public void groupNotFound(String groupName) throws JRValidationException
{
    throw new JRValidationException("Unknown evaluation group '" + groupName + "' for image.", image);
}
项目:jasperreports    文件:TextFieldEvaluationGroupReference.java   
@Override
public void groupNotFound(String groupName) throws JRValidationException
{
    throw new JRValidationException("Unknown evaluation group '" + groupName + "' for text field.", textField);
}
项目:jasperreports    文件:JRFillSubreport.java   
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 + ")");
        }
    }
}
项目:jasperreports    文件:XmlGroupReference.java   
void groupNotFound(String groupName) throws JRValidationException;