public abstract class PleaseWaitRunnable extends Object implements Runnable, ProgressMonitor.CancelListener
Modifier and Type | Field and Description |
---|---|
private boolean |
canceled |
private boolean |
ignoreException |
protected ProgressMonitor |
progressMonitor |
private String |
title |
Constructor and Description |
---|
PleaseWaitRunnable(Component parent,
String title,
boolean ignoreException)
Create the runnable object with a given message for the user
|
PleaseWaitRunnable(String title)
Create the runnable object with a given message for the user.
|
PleaseWaitRunnable(String title,
boolean ignoreException)
Create the runnable object with a given message for the user.
|
PleaseWaitRunnable(String title,
ProgressMonitor progressMonitor,
boolean ignoreException)
Create the runnable object with a given message for the user
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterFinish()
Can be overriden if something needs to run after progress monitor is closed.
|
protected abstract void |
cancel()
User pressed cancel button.
|
ProgressTaskId |
canRunInBackground()
Task can run in background if returned value != null.
|
private void |
doRealRun() |
protected abstract void |
finish()
Finish up the data work.
|
ProgressMonitor |
getProgressMonitor()
Relies the progress monitor.
|
void |
operationCanceled() |
protected abstract void |
realRun()
Called in the worker thread to do the actual work.
|
void |
run() |
private boolean canceled
private boolean ignoreException
protected final ProgressMonitor progressMonitor
public PleaseWaitRunnable(String title)
title
- message for the userpublic PleaseWaitRunnable(String title, boolean ignoreException)
title
- message for the userignoreException
- If true, exception will be silently ignored. If false then
exception will be handled by showing a dialog. When this runnable is executed using executor framework
then use false unless you read result of task (because exception will get lost if you don't)public PleaseWaitRunnable(Component parent, String title, boolean ignoreException) throws IllegalArgumentException
parent
- the parent component for the please wait dialog. Must not be null.title
- message for the userignoreException
- If true, exception will be silently ignored. If false then
exception will be handled by showing a dialog. When this runnable is executed using executor framework
then use false unless you read result of task (because exception will get lost if you don't)IllegalArgumentException
- thrown if parent is nullpublic PleaseWaitRunnable(String title, ProgressMonitor progressMonitor, boolean ignoreException)
title
- message for the userprogressMonitor
- progress monitorignoreException
- If true, exception will be silently ignored. If false then
exception will be handled by showing a dialog. When this runnable is executed using executor framework
then use false unless you read result of task (because exception will get lost if you don't)private void doRealRun()
protected void afterFinish()
public void operationCanceled()
operationCanceled
in interface ProgressMonitor.CancelListener
protected abstract void cancel()
protected abstract void realRun() throws SAXException, IOException, OsmTransferException
protected abstract void finish()
public ProgressMonitor getProgressMonitor()
public ProgressTaskId canRunInBackground()