All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.e2u.preview.stax.StaxPreviewRenderer Maven / Gradle / Ivy

package com.googlecode.e2u.preview.stax;

import java.io.File;
import java.util.List;

import org.daisy.braille.utils.pef.PEFBook;
import org.daisy.dotify.api.validity.ValidationReport;

import javafx.concurrent.Task;

class StaxPreviewRenderer {
	private final StaxPreviewParser parser;

	StaxPreviewRenderer(PEFBook book, ValidationReport report) {
		this.parser = new StaxPreviewParser(book, report);
		Task t = new Task() {

			@Override
			protected Void call() throws Exception {
				parser.staxParse();
				return null;
			}
		};
        Thread th = new Thread(t);
        th.setDaemon(true);
        th.start();
	}
	
	void abort() {
		parser.abort();
	}

	File getFile(int v) throws InterruptedException {
		if (v<1 || v>parser.getBook().getVolumes()) {
			throw new IndexOutOfBoundsException();
		}
		try {
			List volumes = parser.getVolumes(); 
			while (volumes.size()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy