// Path: progress-object-pattern/src/main/java/com/link_intersystems/swing/ProgressAction.java
// public abstract class ProgressAction<T> extends AbstractAction {
// 
// 	private static final long serialVersionUID = 2088582900434640623L;
// 
// 	private class SwingWorkerPropertyAdapter extends SwingWorkerPropertyChangeAdapter {
// 
// 		@Override
// 		protected void done(boolean cancelled) {
// 			ProgressAction<?> progressAction = ProgressAction.this;
// 			progressAction.workerDone();
// 		}
// 	}
// 
// 	private SwingWorkerPropertyAdapter swingWorkerPropertyAdapter = new SwingWorkerPropertyAdapter();
// 	private Collection<ProgressAware> progressAwares = new LinkedHashSet<ProgressAware>();
// 
// 	private Progress<T> progress;
// 
// 	public void addProgressAware(ProgressAware progressAware) {
// 		this.progressAwares.add(progressAware);
// 	}
// 
// 	@Override
// 	public void actionPerformed(ActionEvent e) {
// 		setEnabled(false);
// 
// 		ProgressWorker<T> progressWorker = createProgressWorker();
// 		setProgress(progressWorker);
// 		progressWorker.execute();
// 	}
// 
// 	protected abstract ProgressWorker<T> createProgressWorker();
// 
// 	private void setProgress(Progress<T> progress) {
// 		this.progress = progress;
// 
// 		for (ProgressAware progressAware : progressAwares) {
// 			progressAware.setProgress(progress);
// 		}
// 
// 		progress.addPropertyChangeListener(swingWorkerPropertyAdapter);
// 	}
// 
// 	void workerDone() {
// 		progress.removePropertyChangeListener(swingWorkerPropertyAdapter);
// 		try {
// 			done(progress);
// 		} finally {
// 			progress = null;
// 			setEnabled(true);
// 		}
// 	}
// 
// 	protected void done(Future<T> result) {
// 	}
// 
// }
// 
// Path: progress-object-pattern/src/main/java/com/link_intersystems/swing/ProgressWorker.java
// public abstract class ProgressWorker<T> extends SwingWorker<T, Void> implements Progress<T> {
// }


import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import com.link_intersystems.swing.ProgressAction;
import com.link_intersystems.swing.ProgressWorker;
package com.link_intersystems.example;




public class ProgressSimulationAction extends ProgressAction<String> {

	private static final long serialVersionUID = 1L;

	public Document resultDocument;

	public void setResultDocument(Document resultDocument) {
		this.resultDocument = resultDocument;
	}

	@Override
	protected ProgressWorker<String> createProgressWorker() {
// Path: progress-object-pattern/src/main/java/com/link_intersystems/swing/ProgressAction.java
// public abstract class ProgressAction<T> extends AbstractAction {
// 
// 	private static final long serialVersionUID = 2088582900434640623L;
// 
// 	private class SwingWorkerPropertyAdapter extends SwingWorkerPropertyChangeAdapter {
// 
// 		@Override
// 		protected void done(boolean cancelled) {
// 			ProgressAction<?> progressAction = ProgressAction.this;
// 			progressAction.workerDone();
// 		}
// 	}
// 
// 	private SwingWorkerPropertyAdapter swingWorkerPropertyAdapter = new SwingWorkerPropertyAdapter();
// 	private Collection<ProgressAware> progressAwares = new LinkedHashSet<ProgressAware>();
// 
// 	private Progress<T> progress;
// 
// 	public void addProgressAware(ProgressAware progressAware) {
// 		this.progressAwares.add(progressAware);
// 	}
// 
// 	@Override
// 	public void actionPerformed(ActionEvent e) {
// 		setEnabled(false);
// 
// 		ProgressWorker<T> progressWorker = createProgressWorker();
// 		setProgress(progressWorker);
// 		progressWorker.execute();
// 	}
// 
// 	protected abstract ProgressWorker<T> createProgressWorker();
// 
// 	private void setProgress(Progress<T> progress) {
// 		this.progress = progress;
// 
// 		for (ProgressAware progressAware : progressAwares) {
// 			progressAware.setProgress(progress);
// 		}
// 
// 		progress.addPropertyChangeListener(swingWorkerPropertyAdapter);
// 	}
// 
// 	void workerDone() {
// 		progress.removePropertyChangeListener(swingWorkerPropertyAdapter);
// 		try {
// 			done(progress);
// 		} finally {
// 			progress = null;
// 			setEnabled(true);
// 		}
// 	}
// 
// 	protected void done(Future<T> result) {
// 	}
// 
// }
// 
// Path: progress-object-pattern/src/main/java/com/link_intersystems/swing/ProgressWorker.java
// public abstract class ProgressWorker<T> extends SwingWorker<T, Void> implements Progress<T> {
// }


// Path: progress-object-pattern/src/main/java/com/link_intersystems/example/ProgressSimulationAction.java
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import com.link_intersystems.swing.ProgressAction;
import com.link_intersystems.swing.ProgressWorker;

package com.link_intersystems.example;




public class ProgressSimulationAction extends ProgressAction<String> {

	private static final long serialVersionUID = 1L;

	public Document resultDocument;

	public void setResultDocument(Document resultDocument) {
		this.resultDocument = resultDocument;
	}

	@Override
	protected ProgressWorker<String> createProgressWorker() {
		ProgressWorker<String> progressSimulationWorker = new ProgressSimulationWorker();