Package org.pepsoft.util
Class SubProgressReceiver
java.lang.Object
org.pepsoft.util.SubProgressReceiver
- All Implemented Interfaces:
ProgressReceiver
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pepsoft.util.ProgressReceiver
ProgressReceiver.OperationCancelled, ProgressReceiver.OperationCancelledByUser -
Constructor Summary
ConstructorsConstructorDescriptionSubProgressReceiver(ProgressReceiver progressReceiver, float offset, float extent) SubProgressReceiver(ProgressReceiver progressReceiver, String message, float offset, float extent) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ProgressReceiver listener) Adds an additional progress receiver, to which thesetProgress(float),setMessage(java.lang.String),done()andexceptionThrown(java.lang.Throwable)methods will be forwarded (without remapping the progress).voidCheck whether the operation has been canceled.voiddone()Report that the operation has succeeded successfully.voidexceptionThrown(Throwable exception) Report that the operation has been aborted due to an exception having been thrown.voidremoveListener(ProgressReceiver listener) voidreset()Restart the progress bar.voidsetMessage(String message) Change the message describing the current operation.voidsetProgress(float progress) Set the progress as a value from 0.0f to 1.0f (inclusive).voidsubProgressStarted(SubProgressReceiver subProgressReceiver) Invoked when a subordinateSubProgressReceiveris started, reporting to this progress receiver.
-
Constructor Details
-
SubProgressReceiver
public SubProgressReceiver(ProgressReceiver progressReceiver, float offset, float extent) throws ProgressReceiver.OperationCancelled -
SubProgressReceiver
public SubProgressReceiver(ProgressReceiver progressReceiver, String message, float offset, float extent) throws ProgressReceiver.OperationCancelled
-
-
Method Details
-
addListener
Adds an additional progress receiver, to which thesetProgress(float),setMessage(java.lang.String),done()andexceptionThrown(java.lang.Throwable)methods will be forwarded (without remapping the progress). Note that recursive invocations ofsetMessage(),exceptionThrown()anddone()are not reported. -
removeListener
-
getParent
-
getLastMessage
-
getCreationTrace
-
setProgress
Description copied from interface:ProgressReceiverSet the progress as a value from 0.0f to 1.0f (inclusive).- Specified by:
setProgressin interfaceProgressReceiver- Parameters:
progress- The progress to report.- Throws:
ProgressReceiver.OperationCancelled- If the operation has been canceled, for instance by the user, or because of an exception on another thread.
-
exceptionThrown
Description copied from interface:ProgressReceiverReport that the operation has been aborted due to an exception having been thrown. Any other threads working on the same operation will be canceled.- Specified by:
exceptionThrownin interfaceProgressReceiver- Parameters:
exception- The exception which has been thrown.
-
done
public void done()Description copied from interface:ProgressReceiverReport that the operation has succeeded successfully.- Specified by:
donein interfaceProgressReceiver
-
setMessage
Description copied from interface:ProgressReceiverChange the message describing the current operation.- Specified by:
setMessagein interfaceProgressReceiver- Parameters:
message- A message describing the current operation.- Throws:
ProgressReceiver.OperationCancelled- If the operation has been canceled, for instance by the user, or because of an exception on another thread.
-
checkForCancellation
Description copied from interface:ProgressReceiverCheck whether the operation has been canceled. AnOperationCancelledexception will be thrown if it has.- Specified by:
checkForCancellationin interfaceProgressReceiver- Throws:
ProgressReceiver.OperationCancelled- If the operation has been canceled, for instance by the user, or because of an exception on another thread.
-
reset
public void reset()Description copied from interface:ProgressReceiverRestart the progress bar. All progress will be wiped out and the next expected progress report will be expected to be as if progress started from 0.0f again.- Specified by:
resetin interfaceProgressReceiver
-
subProgressStarted
public void subProgressStarted(SubProgressReceiver subProgressReceiver) throws ProgressReceiver.OperationCancelled Description copied from interface:ProgressReceiverInvoked when a subordinateSubProgressReceiveris started, reporting to this progress receiver.- Specified by:
subProgressStartedin interfaceProgressReceiver- Parameters:
subProgressReceiver- The sub progress receiver which has been started.- Throws:
ProgressReceiver.OperationCancelled- If the operation has been canceled, for instance by the user, or because of an exception on another thread.
-