Example #1
0
 /**
  * Opens a design file.
  *
  * @param fileName the design file name
  * @param is the input stream of the design file.
  * @param locale the user locale.
  * @throws DesignFileException if any exception.
  */
 protected void openDesign(String fileName, InputStream is, ULocale locale)
     throws DesignFileException {
   if (engine == null) {
     engine = new DesignEngine(new DesignConfig());
     resetMetadata();
   }
   sessionHandle = engine.newSessionHandle(locale);
   designHandle = sessionHandle.openDesign(fileName, is);
   design = (ReportDesign) designHandle.getModule();
 }
Example #2
0
  /**
   * Creates library with given locale.
   *
   * @param locale the user locale
   * @return the handle for new library
   */
  protected LibraryHandle createLibrary(ULocale locale) {
    if (engine == null) {
      engine = new DesignEngine(new DesignConfig());
      resetMetadata();
    }
    sessionHandle = engine.newSessionHandle(locale);
    libraryHandle = sessionHandle.createLibrary();

    return libraryHandle;
  }
Example #3
0
  /**
   * Opend a module given file name and locale.
   *
   * @param fileName the module file name
   * @param locale the user locale
   * @throws DesignFileException
   */
  protected void openModule(String fileName, ULocale locale) throws DesignFileException {
    if (engine == null) {
      engine = new DesignEngine(new DesignConfig());
      resetMetadata();
    }
    fileName = INPUT_FOLDER + fileName;
    sessionHandle = engine.newSessionHandle(locale);
    assertNotNull(sessionHandle);

    moduleHandle =
        sessionHandle.openModule(getResource(fileName).toString(), getResourceAStream(fileName));
  }
Example #4
0
  /**
   * Creates a new report with given locale.
   *
   * @param locale the user locale
   * @return the handle for new report
   */
  protected ReportDesignHandle createDesign(ULocale locale) {
    if (engine == null) {
      engine = new DesignEngine(new DesignConfig());
      resetMetadata();
    }
    sessionHandle = engine.newSessionHandle(locale);
    designHandle = sessionHandle.createDesign();
    design = (ReportDesign) designHandle.getModule();

    removeExtensionStyles(design);
    return designHandle;
  }
Example #5
0
  /**
   * Opens library file with given file name and locale.
   *
   * @param fileName the library file name
   * @param locale the user locale
   * @param inSingleJarMode <code>true</code> if open the design that is in the single jar.
   *     Otherwise <code>false</code>.
   * @throws DesignFileException if any exception
   */
  protected void openLibrary(String fileName, ULocale locale, boolean inSingleJarMode)
      throws DesignFileException {
    if (inSingleJarMode) fileName = INPUT_FOLDER + fileName;

    if (engine == null) {
      engine = new DesignEngine(new DesignConfig());
      resetMetadata();
    }
    sessionHandle = engine.newSessionHandle(locale);
    assertNotNull(sessionHandle);

    if (inSingleJarMode)
      libraryHandle =
          sessionHandle.openLibrary(getResource(fileName).toString(), getResourceAStream(fileName));
    else libraryHandle = sessionHandle.openLibrary(fileName);
  }
Example #6
0
  /**
   * Opens design file providing the file name and the locale.
   *
   * @param fileName the design file to be opened
   * @param locale the user locale
   * @param inSingleJarMode <code>true</code> if open the design that is in the single jar.
   *     Otherwise <code>false</code>.
   * @throws DesignFileException if any exception.
   */
  protected void openDesign(String fileName, ULocale locale, boolean inSingleJarMode)
      throws DesignFileException {
    if (inSingleJarMode) fileName = INPUT_FOLDER + fileName;

    if (engine == null) {
      engine = new DesignEngine(new DesignConfig());
      resetMetadata();
    }
    sessionHandle = engine.newSessionHandle(locale);
    assertNotNull(sessionHandle);

    if (inSingleJarMode) designHandle = sessionHandle.openDesign(getResource(fileName).toString());
    else designHandle = sessionHandle.openDesign(fileName);

    design = (ReportDesign) designHandle.getModule();
  }