|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.wicketstuff.progressbar.spring.Task
public class Task
A Task is some kind of long running action that should be done in the background. The task can update the progress based on the current position in the workload.
Basically what you have to do for your own Task is to override the run() method and frequently call one of the updateProgress methods.
| Nested Class Summary | |
|---|---|
static class |
Task.Message
Message is a value object for messages during task runtime. |
| Constructor Summary | |
|---|---|
Task()
|
|
Task(Runnable runnable)
|
|
| Method Summary | |
|---|---|
void |
cancel()
|
protected void |
doFinish()
Will be called after finishing the task |
void |
error(String messageKey,
Object... arguments)
Add an error message |
List<Task.Message> |
getMessages()
Get generated messages |
int |
getProgress()
|
void |
info(String messageKey,
Object... arguments)
Add an info message |
boolean |
isCancelled()
|
boolean |
isDone()
|
void |
reset()
|
protected void |
run()
Implement the actual calculation of the task here. |
void |
updateProgress(int progressPercent)
Update progress with percentage value |
void |
updateProgress(int current,
int total)
Update the current progress with current / total values (e.g. |
void |
warn(String messageKey,
Object... arguments)
Add an warn message |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Task()
public Task(Runnable runnable)
| Method Detail |
|---|
protected void run()
Implement the actual calculation of the task here.
If iterating and cancelling should be supported you should check for a canceled task in every iteration:
if (isCancelled())
{
return;
}
protected void doFinish()
public boolean isCancelled()
public void reset()
public void cancel()
public void updateProgress(int current,
int total)
current - The current iteration (counted from zero!)total - Total iterationspublic void updateProgress(int progressPercent)
progressPercent - progress in percent in [0, 100]public boolean isDone()
public int getProgress()
public void info(String messageKey,
Object... arguments)
messageKey - arguments -
public void warn(String messageKey,
Object... arguments)
messageKey - arguments -
public void error(String messageKey,
Object... arguments)
messageKey - arguments - public List<Task.Message> getMessages()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||