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

项目: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);
    }
}
项目:ireport-fork    文件:ProblemItem.java   
/** Creates a new instance of ProblemItem */
public ProblemItem(int problemType, JRValidationFault fault) {
    this.fault = fault;
    this.problemType = problemType;
    if (fault != null)
    {
        this.description = fault.getMessage();
    }
}
项目:ireport-fork    文件:ProblemItem.java   
/** Creates a new instance of ProblemItem */
public ProblemItem(int problemType, JRValidationFault fault, SourceLocation sl) {
    this.fault = fault;
    this.problemType = problemType;
    if (fault != null)
    {
        this.description = fault.getMessage();
    }
    this.sourceLocation = sl;
    if (sl != null)
    {
        this.where = sl.getXPath();
    }
}
项目:jasperreports    文件:JasperCompileManager.java   
/**
 * @see #verify(JasperDesign)
 */
public static Collection<JRValidationFault> verifyDesign(JasperDesign jasperDesign)
{
    return getDefaultInstance().verify(jasperDesign);
}
项目: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 + ")");
        }
    }
}
项目:ireport-fork    文件:DesignVerifyerThread.java   
public void verifyDesign()
{
   // Remove all the WARNINGS...


   for (int i=0; i<getJrxmlVisualView().getReportProblems().size(); ++i)
   {
       ProblemItem pii = getJrxmlVisualView().getReportProblems().get(i);
       if (pii.getProblemType() == ProblemItem.WARNING ||
           pii.getProblemType() == ProblemItem.INFORMATION)
       {
           getJrxmlVisualView().getReportProblems().remove(i);
           i--;
       }
   }
   //getJReportFrame().getReportProblems().clear();

   try {
        //SourceTraceDigester digester = IReportCompiler.createDigester();
        //ReportWriter rw = new ReportWriter(getJReportFrame().getReport());
        //ByteArrayOutputStream baos = new ByteArrayOutputStream();
        //rw.writeToOutputStream(baos);
        //JasperDesign jd = IReportCompiler.loadJasperDesign( new ByteArrayInputStream( baos.toByteArray() ), digester);

        // set the correct class loader
       Thread.currentThread().setContextClassLoader( IReportManager.getReportClassLoader());


        if (getJrxmlVisualView().getModel() != null &&
            getJrxmlVisualView().getModel().getJasperDesign() != null)
        {
            JasperDesign design = getJrxmlVisualView().getModel().getJasperDesign();

            Collection ls = JasperCompileManager.verifyDesign(design);
            Iterator iterator = ls.iterator();
            while (iterator.hasNext())
            {
                JRValidationFault fault = (JRValidationFault)iterator.next();
                String s = fault.getMessage();
                //SourceLocation sl = digester.getLocation( fault.getSource() );
                getJrxmlVisualView().getReportProblems().add( new ProblemItem(ProblemItem.WARNING, fault));
            }
        }
   } catch (Exception ex)
    {
        ex.printStackTrace();
        getJrxmlVisualView().getReportProblems().add(new ProblemItem(ProblemItem.WARNING, ex.getMessage(), null, null) );
    }

   Runnable runner = new Runnable(){
            public void run()
            {
                //MainFrame.getMainInstance().getLogPane().getProblemsPanel().update();
                ErrorHandlerTopComponent.getDefault().refreshErrors();
            }
    };

    SwingUtilities.invokeLater(runner);

}
项目:ireport-fork    文件:ProblemItem.java   
public JRValidationFault getFault() {
    return fault;
}
项目:ireport-fork    文件:ProblemItem.java   
public void setFault(JRValidationFault fault) {
    this.fault = fault;
}
项目:jasperreports    文件:JasperCompileManager.java   
/**
 * 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 Collection<JRValidationFault> verify(JasperDesign jasperDesign)
{
    return JRVerifier.verifyDesign(jasperDesign);
}