public static void main(String[] args) throws InterruptedException { Logging.log( Level.INFO, "Starting PCGen Data Converter v" + PCGenPropBundle.getVersionNumber()); // $NON-NLS-1$ configFactory = new PropertyContextFactory(SystemUtils.USER_DIR); configFactory.registerAndLoadPropertyContext(ConfigurationSettings.getInstance()); Main.loadProperties(true); getConverter(new ObjectCache()).setVisible(true); }
@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; }
public LoadButtonAndSheetHandler() { File sheet = FileUtils.getFile( ConfigurationSettings.getPreviewDir(), "companions", "compact_companion.htm"); //$NON-NLS-1$ //$NON-NLS-2$ this.sheetSupport = new HtmlSheetSupport(infoPane, sheet.getAbsolutePath()); this.selectedRow = -1; this.selectionModel = companionsTable.getSelectionModel(); this.frame = (PCGenFrame) JOptionPane.getFrameForComponent(CompanionInfoTab.this); }
@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; }