public final class ProgressHandle extends Object
Modifier and Type | Method and Description |
---|---|
void |
finish()
Finish the task, remove the task's component from the progress bar UI.
|
void |
progress(int workunit)
Notify the user about completed workunits.
|
void |
progress(String message)
Notify the user about progress by showing message with details.
|
void |
progress(String message,
int workunit)
Notify the user about completed workunits and show additional detailed message.
|
void |
setDisplayName(String newDisplayName)
Change the display name of the progress task.
|
void |
setInitialDelay(int millis)
Set a custom initial delay for the progress task to appear in the status bar.
|
void |
start()
start the progress indication for indeterminate task.
|
void |
start(int workunits)
start the progress indication for a task with known number of steps.
|
void |
start(int workunits,
long estimate)
start the progress indication for a task with known number of steps and known
time estimate for completing the task.
|
void |
suspend(String message)
Current task can switch to silent suspend mode where the progress bar stops moving, hides completely or partially.
|
void |
switchToDeterminate(int workunits)
Currently indeterminate task can be switched to show percentage completed.
|
void |
switchToDeterminate(int workunits,
long estimate)
Currently indeterminate task can be switched to show the time estimate til completion.
|
void |
switchToIndeterminate()
Currently determinate task (with percentage or time estimate) can be
switched to indeterminate mode.
|
public void start()
start
method can be called just once.public void start(int workunits)
start
method can be called just once.workunits
- total number of workunits that will be processedpublic void start(int workunits, long estimate)
start
method can be called just once.workunits
- total number of workunits that will be processedestimate
- estimated time to process the task in secondspublic void switchToIndeterminate()
start
method and before calling finish
method (the task has to be running).public void suspend(String message)
start
method and before calling finish
method (the task has to be running).
Useful to make progress in status bar less intrusive.
for very long running tasks, eg. running an ant script that executes user application, debugs user application etc.
Any incoming progress wakes up the progress bar to previous state.message
- a message to display in the silent modepublic void switchToDeterminate(int workunits)
start
method and before calling finish
method (the task has to be running).
A common usecase is to calculate the amount of work in the beginning showing
in indeterminate mode and later switch to the progress with known stepsworkunits
- a definite number of complete units of work out of the totalpublic void switchToDeterminate(int workunits, long estimate)
start
method and before calling finish
method (the task has to be running).
A common usecase is to calculate the amount of work in the beginning
in indeterminate mode and later switch to the progress with the calculated estimate.workunits
- a definite number of complete units of work out of the totalestimate
- estimated time to process the task, in secondspublic void finish()
start
method (the task has to be running).public void progress(int workunit)
start
method and before calling finish
method (the task has to be running).workunit
- a cumulative number of workunits completed so farpublic void progress(String message)
start
method and before calling finish
method (the task has to be running).message
- details about the status of the taskpublic void progress(String message, int workunit)
start
method and before calling finish
method (the task has to be running).message
- details about the status of the taskworkunit
- a cumulative number of workunits completed so farpublic void setInitialDelay(int millis)
Progress bars that are placed in custom dialogs do always appear right away without a delay.
millis
- number of miliseconds to wait before the progress appears in status bar.public void setDisplayName(String newDisplayName)
newDisplayName
- a new name to set for the taskBuilt on January 7 2015. | Portions Copyright 1997-2015 Oracle. All rights reserved.