public abstract class PleaseWaitRunnable extends java.lang.Object implements java.lang.Runnable, ProgressMonitor.CancelListener
Modifier and Type | Field and Description |
---|---|
private boolean |
ignoreException |
protected ProgressMonitor |
progressMonitor
progress monitor
|
private java.lang.String |
title |
Constructor and Description |
---|
PleaseWaitRunnable(java.awt.Component parent,
java.lang.String title,
boolean ignoreException)
Create the runnable object with a given message for the user
|
PleaseWaitRunnable(java.lang.String title)
Create the runnable object with a given message for the user.
|
PleaseWaitRunnable(java.lang.String title,
boolean ignoreException)
Create the runnable object with a given message for the user.
|
PleaseWaitRunnable(java.lang.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 overridden 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()
Called when the operation was canceled
|
protected abstract void |
realRun()
Called in the worker thread to do the actual work.
|
void |
run() |
private boolean ignoreException
private final java.lang.String title
protected final ProgressMonitor progressMonitor
public PleaseWaitRunnable(java.lang.String title)
title
- message for the userpublic PleaseWaitRunnable(java.lang.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(java.awt.Component parent, java.lang.String title, boolean ignoreException)
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)java.lang.IllegalArgumentException
- if parent is nullpublic PleaseWaitRunnable(java.lang.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 final void run()
run
in interface java.lang.Runnable
public void operationCanceled()
ProgressMonitor.CancelListener
operationCanceled
in interface ProgressMonitor.CancelListener
protected abstract void cancel()
protected abstract void realRun() throws org.xml.sax.SAXException, java.io.IOException, OsmTransferException
org.xml.sax.SAXException
- if a SAX error occursjava.io.IOException
- if an I/O error occursOsmTransferException
- if a communication error with the OSM server occursprotected abstract void finish()
public ProgressMonitor getProgressMonitor()
public ProgressTaskId canRunInBackground()