|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@Extension public interface ProgressListener
Monitor the progress of some lengthly operation, and allows cancelation. This interface makes no assumption about the output device. Additionnaly, this interface provides support for non-fatal warning and exception reports.
All implementations should be multi-thread safe, even the ones that provide feedback to a user interface thread.
Usage example:
float scale = 100f / maximumCount; listener.started(); for (int counter=0; counter<maximumCount; counter++) { if (listener.isCanceled()) { break; } listener.progress(scale * counter); try { // Do some work... } catch (NonFatalException e) { listener.exceptionOccurred(e); } } listener.complete();
Method Summary | |
---|---|
void |
complete()
Notifies this listener that the operation has finished. |
void |
dispose()
Releases any resources used by this listener. |
void |
exceptionOccurred(Throwable exception)
Reports an exception. |
String |
getDescription()
Deprecated. Replaced by getTask().toString() |
float |
getProgress()
Returns the current progress as a percent completed. |
InternationalString |
getTask()
Returns the description of the current task being performed, or null if none. |
boolean |
isCanceled()
Returns true if this job is cancelled. |
void |
progress(float percent)
Notifies this listener of progress in the lengthly operation. |
void |
setCanceled(boolean cancel)
Indicates that task should be cancelled. |
void |
setDescription(String description)
Deprecated. Replaced by setTask |
void |
setTask(InternationalString task)
Sets the description of the current task being performed. |
void |
started()
Notifies this listener that the operation begins. |
void |
warningOccurred(String source,
String location,
String warning)
Reports a warning. |
Method Detail |
---|
InternationalString getTask()
null
if none.
It is assumed that if the task is null
applications may simply report that the
process is "in progress" or "working" as represented in the current locale.
null
if none.@Deprecated String getDescription()
null
if none.
void setTask(InternationalString task)
task
- Description of the task being performed, or null
if none.@Deprecated void setDescription(String description)
description
- The new description, or null
if none.void started()
void progress(float percent)
percent
- The progress as a value between 0 and 100 inclusive.float getProgress()
void complete()
void dispose()
boolean isCanceled()
true
if this job is cancelled.
true
if this job is cancelled.void setCanceled(boolean cancel)
cancel
- true
for cancelling the task.void warningOccurred(String source, String location, String warning)
source
- Name of the warning source, or null
if none. This is typically the
filename in process of being parsed or the URL of the data being processedlocation
- Text to write on the left side of the warning message, or null
if none.
This is typically the line number where the error occured in the source
file or the feature ID of the feature that produced the messagewarning
- The warning message.void exceptionOccurred(Throwable exception)
exception
- The exception to report.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |