Class SimpleProgressWorker
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
ExtensionDownloadThread
USAGE: Generally, you just need to extend this class and implement the run() method from the Runnable interface. Use the various fire...() methods to keep listeners up to date as to the status of your operation. Remember to end by invoking EITHER fireProgressComplete() or fireProgressCanceled()! Failure to fire one of these termination events will result in the progress dialog remaining open.
It is important to check for cancellation! The fireProgressUpdate() method returns a boolean indicating whether the operation should continue. If any listener returns false, you should abort your operation as soon as possible and invoke fireProgressCanceled(). Failure to do so may result in the progress dialog remaining open indefinitely.
Reporting errors - If a recoverable error occurs during your operation, you can report it by invoking fireProgressError(). This will notify all listeners of the error. The listeners can then decide whether to continue or cancel the operation by returning true or false. If any listener returns false, you should abort your operation and invoke fireProgressCanceled().
- Since:
- swing-extras 1.6 (2022-05-10)
- Author:
- scorbo2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProgressListener(SimpleProgressListener listener) voidprotected voidfireProgressBegins(int totalMajorSteps) voidprotected voidprotected booleanfireProgressError(String errorSource, String errorDetails) protected booleanfireProgressUpdate(int currentStep, String message) voidremoveProgressListener(SimpleProgressListener listener)
-
Constructor Details
-
SimpleProgressWorker
public SimpleProgressWorker()
-
-
Method Details
-
addProgressListener
-
removeProgressListener
-
clearProgressListeners
public void clearProgressListeners() -
fireProgressBegins
protected void fireProgressBegins(int totalMajorSteps) -
fireProgressUpdate
-
fireProgressError
-
fireProgressComplete
protected void fireProgressComplete() -
fireProgressCanceled
public void fireProgressCanceled()
-