예제 #1
0
    @Override
    protected Object[] doInBackground() throws Exception {
      IOFileFilter pdfFilter = FileFilterUtils.asFileFilter(this);
      IOFileFilter suffixFilter = FileFilterUtils.notFileFilter(new SuffixFileFilter(".fo"));
      IOFileFilter sheetFilter =
          FileFilterUtils.prefixFileFilter(Constants.CHARACTER_TEMPLATE_PREFIX);
      IOFileFilter fileFilter = FileFilterUtils.and(pdfFilter, suffixFilter, sheetFilter);

      IOFileFilter dirFilter = FileFilterUtils.makeSVNAware(TrueFileFilter.INSTANCE);
      File dir = new File(ConfigurationSettings.getOutputSheetsDir());
      Collection<File> files = FileUtils.listFiles(dir, fileFilter, dirFilter);
      URI osPath = new File(ConfigurationSettings.getOutputSheetsDir()).toURI();
      Object[] uriList = new Object[files.size()];
      int i = 0;
      for (File file : files) {
        uriList[i] = osPath.relativize(file.toURI());
        i++;
      }
      return uriList;
    }
예제 #2
0
    @Override
    protected AWTRenderer doInBackground() throws Exception {
      URI osPath = new File(ConfigurationSettings.getOutputSheetsDir()).toURI();
      File xsltFile = new File(osPath.resolve(uri));

      FOUserAgent userAgent = FopTask.getFactory().newFOUserAgent();
      AWTRenderer renderer = new AWTRenderer(userAgent, null, false, false);
      PipedOutputStream out = new PipedOutputStream();
      FopTask task = FopTask.newFopTask(new PipedInputStream(out), xsltFile, renderer);
      Thread thread = new Thread(task, "fop-preview");
      thread.setDaemon(true);
      thread.start();
      BatchExporter.exportCharacter(character, out);
      try {
        thread.join();
      } catch (InterruptedException ex) {
        // pass on the interrupt and hope it stops
        thread.interrupt();
      }
      return renderer;
    }