// Path: src/org/primaresearch/page/viewer/extra/Task.java
// public abstract class Task {
// 
// 	private boolean success = false;
// 	private volatile boolean running = false;
// 	private TaskThread thread = null;
// 	private Set<TaskListener> listeners = new HashSet<TaskListener>();
// 	
// 	/**
// 	 * Method containing the task content (to be overridden)
// 	 * @return <code>true</code> if the task was successful; <code>false</code> otherwise
// 	 */
// 	protected abstract boolean doRun();
// 	
// 	/**
// 	 * Runs the task synchronously (in the current thread)
// 	 */
// 	public synchronized void run() {
// 		if (running)
// 			return;
// 		running = true;
// 		
// 		success = doRun();
// 		
// 		thread = null;
// 		running = false;
// 		notifyFinished();
// 	}
// 	
// 	/**
// 	 * Runs the task asynchronously (in its own thread)
// 	 */
// 	public synchronized void runAsync() {
// 		if (thread != null)
// 			return;
// 		thread = new TaskThread(this);
// 		thread.start();
// 	}
// 	
// 	/**
// 	 * Returns <code>true</code> if the task was successful; <code>false</code> otherwise
// 	 */
// 	public boolean isSuccessfull() {
// 		return success;
// 	}
// 	
// 	/**
// 	 * Adds a listener for task related events
// 	 * @param listener Listener object
// 	 */
// 	public void addListener(TaskListener listener) {
// 		this.listeners.add(listener);
// 	}
// 
// 	/**
// 	 * Notifies all listeners that this task has finished
// 	 */
// 	private void notifyFinished() {
// 		for (Iterator<TaskListener> it = listeners.iterator(); it.hasNext(); ) {
// 			TaskListener listener = it.next();
// 			listener.taskFinished(this);
// 		}
// 	}
// 	
// 	/**
// 	 * Thread implementation for asynchronous tasks
// 	 *  
// 	 * @author Christian Clausner
// 	 *
// 	 */
// 	static class TaskThread extends Thread {
// 		private Task task;
// 		
// 		public TaskThread(Task task) {
// 			this.task = task;
// 		}
// 		
// 		public void run() {
// 	        task.run();
// 	    }
// 	}
// 
// }


import java.io.File;
import org.primaresearch.dla.page.Page;
import org.primaresearch.dla.page.io.xml.PageXmlInputOutput;
import org.primaresearch.page.viewer.extra.Task;
		}
		return page != null;
	}

	/**
	 * Returns the loaded page
	 * @return The page object or <code>null</code> if the loading failed
	 */
	public Page getPage() {
		return page;
	}

	/**
	 * Returns the image file path that was specified in the XML file
	 * @return The file path or an empty string if no image was specified
	 */
	public String getImageFilePath() {
		//Do we have a full path in the XML?
		try {
			if (page.getImageFilename() != null 
					&& (page.getImageFilename().startsWith("/") || page.getImageFilename().contains(":"))
					&& new File(page.getImageFilename()).exists()) {
				return page.getImageFilename();
			}
		} catch (Exception exc) {
			exc.printStackTrace();
		}
		//Get root folder from XML file path or use resolveDir
		String rootFolder = "";
		if (resolveDir != null)
// Path: src/org/primaresearch/page/viewer/extra/Task.java
// public abstract class Task {
// 
// 	private boolean success = false;
// 	private volatile boolean running = false;
// 	private TaskThread thread = null;
// 	private Set<TaskListener> listeners = new HashSet<TaskListener>();
// 	
// 	/**
// 	 * Method containing the task content (to be overridden)
// 	 * @return <code>true</code> if the task was successful; <code>false</code> otherwise
// 	 */
// 	protected abstract boolean doRun();
// 	
// 	/**
// 	 * Runs the task synchronously (in the current thread)
// 	 */
// 	public synchronized void run() {
// 		if (running)
// 			return;
// 		running = true;
// 		
// 		success = doRun();
// 		
// 		thread = null;
// 		running = false;
// 		notifyFinished();
// 	}
// 	
// 	/**
// 	 * Runs the task asynchronously (in its own thread)
// 	 */
// 	public synchronized void runAsync() {
// 		if (thread != null)
// 			return;
// 		thread = new TaskThread(this);
// 		thread.start();
// 	}
// 	
// 	/**
// 	 * Returns <code>true</code> if the task was successful; <code>false</code> otherwise
// 	 */
// 	public boolean isSuccessfull() {
// 		return success;
// 	}
// 	
// 	/**
// 	 * Adds a listener for task related events
// 	 * @param listener Listener object
// 	 */
// 	public void addListener(TaskListener listener) {
// 		this.listeners.add(listener);
// 	}
// 
// 	/**
// 	 * Notifies all listeners that this task has finished
// 	 */
// 	private void notifyFinished() {
// 		for (Iterator<TaskListener> it = listeners.iterator(); it.hasNext(); ) {
// 			TaskListener listener = it.next();
// 			listener.taskFinished(this);
// 		}
// 	}
// 	
// 	/**
// 	 * Thread implementation for asynchronous tasks
// 	 *  
// 	 * @author Christian Clausner
// 	 *
// 	 */
// 	static class TaskThread extends Thread {
// 		private Task task;
// 		
// 		public TaskThread(Task task) {
// 			this.task = task;
// 		}
// 		
// 		public void run() {
// 	        task.run();
// 	    }
// 	}
// 
// }


// Path: src/org/primaresearch/page/viewer/dla/XmlDocumentLayoutLoader.java
import java.io.File;
import org.primaresearch.dla.page.Page;
import org.primaresearch.dla.page.io.xml.PageXmlInputOutput;
import org.primaresearch.page.viewer.extra.Task;

		}
		return page != null;
	}

	/**
	 * Returns the loaded page
	 * @return The page object or <code>null</code> if the loading failed
	 */
	public Page getPage() {
		return page;
	}

	/**
	 * Returns the image file path that was specified in the XML file
	 * @return The file path or an empty string if no image was specified
	 */
	public String getImageFilePath() {
		//Do we have a full path in the XML?
		try {
			if (page.getImageFilename() != null 
					&& (page.getImageFilename().startsWith("/") || page.getImageFilename().contains(":"))
					&& new File(page.getImageFilename()).exists()) {
				return page.getImageFilename();
			}
		} catch (Exception exc) {
			exc.printStackTrace();
		}
		//Get root folder from XML file path or use resolveDir
		String rootFolder = "";
		if (resolveDir != null)
			rootFolder = resolveDir;