Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JRException


      !LANGUAGE_BSH.equals(language)
      && !JRReport.LANGUAGE_JAVA.equals(language)
      )
    {
      throw
        new JRException(
          "Language \"" + language
          + "\" not supported by this report compiler.\n"
          + "Expecting \"bsh\" or \"java\" instead."
          );
    }
View Full Code Here


    {
      unit.compile(Phases.CLASS_GENERATION);
    }
    catch (CompilationFailedException e)
    {
      throw new JRException(
        "Errors were encountered when compiling report expressions class file:\n"
        + e.toString(),
        e
        );
    }

    if (collector.classes.size() < units.length)
    {
      throw new JRException("Too few groovy class were generated.");
    }
    else if (collector.classCount > units.length)
    {
      throw new JRException(
        "Too many groovy classes were generated.\n"
        + "Please make sure that you don't use Groovy features such as closures that are not supported by this report compiler.\n"
        );
    }
   
View Full Code Here

      !JRReport.LANGUAGE_GROOVY.equals(language)
      && !JRReport.LANGUAGE_JAVA.equals(language)
      )
    {
      throw
        new JRException(
          "Language \"" + language
          + "\" not supported by this report compiler.\n"
          + "Expecting \"groovy\" or \"java\" instead."
          );
    }
View Full Code Here

    {
      interpreter.eval(new StringReader(bshScript));
    }
    catch(EvalError e)
    {
      throw new JRException(
        "Error evaluating report expressions BeanShell script."
        + "\nMessage : " + e.getMessage()
        + "\nLine " + e.getErrorLineNumber() + " : " + extractLineContent(e)
        );
    }
View Full Code Here

    {
      //ignore
    }
    catch(EvalError e)
    {
      throw new JRException(
        "Error testing report expressions BeanShell script."
        + "\nMessage : " + e.getMessage()
        + "\nLine " + e.getErrorLineNumber() + " : " + extractLineContent(e)
        );
    }
View Full Code Here

      interpreter.eval("bshEvaluator = createBshEvaluator()");
      interpreter.eval("bshEvaluator.init(calculator, parsm, fldsm, varsm)");
    }
    catch(EvalError e)
    {
      throw new JRException("Error initializing report BeanShell calculator.", e);
    }
  }
View Full Code Here

 
  public Object evaluate(JRExpression expression, byte evaluationType) throws JRException
  {
    if (evaluationType != JRExpression.EVALUATION_DEFAULT)
    {
      throw new JRException("The crosstab evaluator doesn't support old or estimated expression evaluation.");
    }
   
    return evaluator.evaluate(expression);
  }
View Full Code Here

  protected JREvaluator loadEvaluator(Serializable compileData,
      String unitName) throws JRException
  {
    if (!(compileData instanceof JavaScriptCompileData))
    {
      throw new JRException("Invalid compile data, should be an instance of "
          + JavaScriptCompileData.class.getName());
    }
   
    JavaScriptCompileData jsCompileData = (JavaScriptCompileData) compileData;
    return new JavaScriptEvaluator(jsCompileData);
View Full Code Here

      Class scriptletClass = JRClassLoader.loadClassForName(scriptletClassName)
      scriptlet = (JRAbstractScriptlet) scriptletClass.newInstance();
    }
    catch (ClassNotFoundException e)
    {
      throw new JRException("Error loading scriptlet class : " + scriptletClassName, e);
    }
    catch (Exception e)
    {
      throw new JRException("Error creating scriptlet class instance : " + scriptletClassName, e);
    }
   
    return scriptlet;
  }
View Full Code Here

      firstPageIndex < 0 ||
      firstPageIndex > lastPageIndex ||
      lastPageIndex >= jasperPrint.getPages().size()
      )
    {
      throw new JRException(
        "Invalid page index range : " +
        firstPageIndex + " - " +
        lastPageIndex + " of " +
        jasperPrint.getPages().size()
        );
    }

    pageOffset = firstPageIndex;

    PrinterJob printJob = PrinterJob.getPrinterJob();

    // fix for bug ID 6255588 from Sun bug database
    initPrinterJobFields(printJob);
   
    PageFormat pageFormat = printJob.defaultPage();
    Paper paper = pageFormat.getPaper();

    printJob.setJobName("JasperReports - " + jasperPrint.getName());
   
    switch (jasperPrint.getOrientationValue())
    {
      case LANDSCAPE :
      {
        pageFormat.setOrientation(PageFormat.LANDSCAPE);
        paper.setSize(jasperPrint.getPageHeight(), jasperPrint.getPageWidth());
        paper.setImageableArea(
          0,
          0,
          jasperPrint.getPageHeight(),
          jasperPrint.getPageWidth()
          );
        break;
      }
      case
      PORTRAIT :
      default :
      {
        pageFormat.setOrientation(PageFormat.PORTRAIT);
        paper.setSize(jasperPrint.getPageWidth(), jasperPrint.getPageHeight());
        paper.setImageableArea(
          0,
          0,
          jasperPrint.getPageWidth(),
          jasperPrint.getPageHeight()
          );
      }
    }

    pageFormat.setPaper(paper);

    Book book = new Book();
    book.append(this, pageFormat, lastPageIndex - firstPageIndex + 1);
    printJob.setPageable(book);
    try
    {
      if (withPrintDialog)
      {
        if (printJob.printDialog())
        {
          printJob.print();
        }
        else
        {
          isOK = false;
        }
      }
      else
      {
        printJob.print();
      }
    }
    catch (Exception ex)
    {
      throw new JRException("Error printing report.", ex);
    }

    return isOK;
  }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JRException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.