public final class ProgressUtils extends Object
BaseProgressUtils
.Modifier and Type | Method and Description |
---|---|
static void |
runOffEventDispatchThread(Runnable operation,
String operationDescr,
AtomicBoolean cancelOperation,
boolean waitForCanceled)
Deprecated.
|
static void |
runOffEventDispatchThread(Runnable operation,
String operationDescr,
AtomicBoolean cancelOperation,
boolean waitForCanceled,
int waitCursorAfter,
int dialogAfter)
Deprecated.
|
static void |
runOffEventThreadWithCustomDialogContent(Runnable operation,
String dialogTitle,
JPanel content,
int waitCursorAfter,
int dialogAfter)
Deprecated.
|
static void |
runOffEventThreadWithProgressDialog(Runnable operation,
String dialogTitle,
ProgressHandle progress,
boolean includeDetailLabel,
int waitCursorAfter,
int dialogAfter)
Deprecated.
|
static <T> T |
showProgressDialogAndRun(ProgressRunnable<T> operation,
String displayName,
boolean includeDetailLabel)
Deprecated.
|
static void |
showProgressDialogAndRun(Runnable operation,
ProgressHandle progress,
boolean includeDetailLabel)
Deprecated.
|
static void |
showProgressDialogAndRun(Runnable operation,
String displayName)
Deprecated.
|
static <T> Future<T> |
showProgressDialogAndRunLater(ProgressRunnable<T> operation,
ProgressHandle handle,
boolean includeDetailLabel)
Deprecated.
|
public static void runOffEventDispatchThread(Runnable operation, String operationDescr, AtomicBoolean cancelOperation, boolean waitForCanceled)
BaseProgressUtils
This method is supposed to be used by user invoked foreground actions, that are expected to run very fast in vast majority of cases. However, in some rather rare cases (e.g. extensive IO operations in progress), supplied operation may need longer time. In such case this method first displays wait cursor and if operation takes even more time it displays dialog allowing to cancel operation. DO NOT use this method for operations that may take long time under normal circumstances!
operation
- operation to performoperationDescr
- text shown in dialogcancelOperation
- set to true if user canceled the operationwaitForCanceled
- true if method should wait until canceled task is finished (if it is not finished in 1s ISE is thrown)public static void runOffEventDispatchThread(Runnable operation, String operationDescr, AtomicBoolean cancelOperation, boolean waitForCanceled, int waitCursorAfter, int dialogAfter)
BaseProgressUtils
This method is supposed to be used by user invoked foreground actions, that are expected to run very fast in vast majority of cases. However, in some rather rare cases (e.g. extensive IO operations in progress), supplied operation may need longer time. In such case this method first displays wait cursor and if operation takes even more time it displays dialog allowing to cancel operation. DO NOT use this method for operations that may take long time under normal circumstances!
operation
- operation to performoperationDescr
- text shown in dialogcancelOperation
- set to true if user canceled the operationwaitForCanceled
- true if method should wait until canceled task is finished (if it is not finished in 1s ISE is thrown)waitCursorAfter
- time in ms after which wait cursor is showndialogAfter
- time in ms after which dialog with "Cancel" button is shownpublic static void showProgressDialogAndRun(Runnable operation, ProgressHandle progress, boolean includeDetailLabel)
BaseProgressUtils
showProgressDialogAndRun(ProgressRunnable, String, boolean)
.operation
- A runnable to run in the backgroundprogress
- A progress handle to create a progress bar forincludeDetailLabel
- True if the caller will use
ProgressHandle.progress (String, int), false if not. If true, the
created dialog will include a label that shows progress details.public static void runOffEventThreadWithProgressDialog(Runnable operation, String dialogTitle, ProgressHandle progress, boolean includeDetailLabel, int waitCursorAfter, int dialogAfter)
BaseProgressUtils
Cancellable
interface, cancel button is part of dialog and can be used
to interrupt the operation.operation
- task to perform in the backgrounddialogTitle
- dialog titleprogress
- progress handle. Do not invoke any methods before
passing to this method. Start/progress/finish it
only in operation
includeDetailLabel
- show progress detail label in the dialogwaitCursorAfter
- amount of time, in milliseconds, after which wait
cursor is showndialogAfter
- amount of time, in milliseconds, after which dialog
is shownpublic static void runOffEventThreadWithCustomDialogContent(Runnable operation, String dialogTitle, JPanel content, int waitCursorAfter, int dialogAfter)
BaseProgressUtils
content
panel is shown.
If operation is marked with Cancellable
interface, cancel button is part of dialog and can be used to
interrupt the operation.operation
- task to perform in the backgrounddialogTitle
- dialog titlecontent
- panel to be shown in the dialogwaitCursorAfter
- amount of time, in milliseconds, after which wait
cursor is showndialogAfter
- amount of time, in milliseconds, after which dialog
is shownpublic static <T> T showProgressDialogAndRun(ProgressRunnable<T> operation, String displayName, boolean includeDetailLabel)
BaseProgressUtils
T
- The result type - use Void if no return type neededoperation
- A runnable-like object which performs work in the
background, and is passed a ProgressHandle to update progressdisplayName
- The display name for this operationincludeDetailLabel
- If true, include a lable to show progress
details (needed only if you plan to call ProgressHandle.setProgress(String, int)public static void showProgressDialogAndRun(Runnable operation, String displayName)
BaseProgressUtils
operation
- A runnable to rundisplayName
- The display name of the operation, to show in the dialogpublic static <T> Future<T> showProgressDialogAndRunLater(ProgressRunnable<T> operation, ProgressHandle handle, boolean includeDetailLabel)
BaseProgressUtils
operation
- handle
- includeDetailLabel
- Built on June 4 2024. | Copyright © 2017-2024 Apache Software Foundation. All Rights Reserved.