public abstract class LongRunningTask extends Object
Warning: If the task started via "startAndWait()", caller must ensure that she is not running in the Swing EventDispatchThread, otherwise an exception is thrown, as the EvenDispatchThread will be blocked, preventing LongRunningTask from showing progress dialog.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
canceled |
protected static int |
DEFAULT_MS_TO_DECIDE_TO_POPUP |
protected ProgressDialog |
dialog |
protected boolean |
finished |
protected JFrame |
frame |
protected int |
maxValue |
protected int |
minValue |
protected Timer |
taskPollingTimer |
protected String |
title |
| Constructor and Description |
|---|
LongRunningTask(JFrame frame,
String title) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
execute()
Runs the actual task, consulting "isCanceled()" state to make sure that the task
wasn't canceled.
|
protected abstract String |
getCurrentNote() |
protected abstract int |
getCurrentValue() |
int |
getMaxValue() |
int |
getMinValue() |
protected void |
internalExecute() |
boolean |
isCanceled() |
boolean |
isFinished() |
protected abstract boolean |
isIndeterminate() |
void |
setCanceled(boolean b) |
void |
setMaxValue(int maxValue) |
void |
setMinValue(int minValue) |
protected void |
showProgress()
Starts progress dialog if the task is not finished yet.
|
void |
start()
Configures the task to run in a separate thread, and immediately exits the method.
|
void |
startAndWait()
Starts current task, and blocks current thread until the task is done.
|
protected void |
stop() |
protected void |
updateProgress()
Updates current state of the progress dialog.
|
protected static final int DEFAULT_MS_TO_DECIDE_TO_POPUP
protected ProgressDialog dialog
protected JFrame frame
protected String title
protected Timer taskPollingTimer
protected boolean canceled
protected int minValue
protected int maxValue
protected boolean finished
public void startAndWait()
public void start()
protected void showProgress()
protected void updateProgress()
protected void stop()
public boolean isFinished()
public boolean isCanceled()
public void setCanceled(boolean b)
protected void internalExecute()
protected abstract void execute()
protected abstract String getCurrentNote()
protected abstract int getCurrentValue()
protected abstract boolean isIndeterminate()
public int getMaxValue()
public void setMaxValue(int maxValue)
public int getMinValue()
public void setMinValue(int minValue)
Copyright © 2001–2015 Apache Cayenne. All rights reserved.