Package editor.util
Class ProgressFeedback
- java.lang.Object
-
- editor.util.ProgressFeedback
-
- All Implemented Interfaces:
IProgressCallback
,ActionListener
,EventListener
public class ProgressFeedback extends Object implements IProgressCallback, ActionListener
A helper class for displaying aProgressWindow
while a task executes in a worker thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProgressFeedback.ProgressFeedbackThread
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProgressFeedback(String strNotice, boolean bHideAbortButton, boolean bShowInStudioGlassPane)
Construct a ProgressFeedback with a given text notice.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(ActionEvent e)
int
getProgress()
boolean
incrementProgress(String strMessage, String... args)
boolean
isAbort()
Should the operation abort?void
operationComplete()
Signals that the operation is completestatic <T> T
runWithPossibleDialog(Callable<T> callable, String message)
protected static ProgressFeedback
runWithProgress(IRunnableWithProgress task, ProgressFeedback progressFeedback)
static ProgressFeedback
runWithProgress(String strNotice, IRunnableWithProgress task)
A helper method that executes a task in a worker thread and displays feedback in a progress windows.static ProgressFeedback
runWithProgress(String strNotice, IRunnableWithProgress task, boolean bHideAbortBtn)
static ProgressFeedback
runWithProgress(String strNotice, IRunnableWithProgress task, boolean bHideAbortBtn, boolean bShowInStudioGlassPane)
void
setLength(int iLength)
How long is this operation in units?boolean
updateProgress(int iProgress, String strMessage, String... args)
Call this when a unit of progress completes.boolean
updateProgress(String strMessage, String... args)
Call this to update the progress message without modifying the amount of progress completed.
-
-
-
Constructor Detail
-
ProgressFeedback
protected ProgressFeedback(String strNotice, boolean bHideAbortButton, boolean bShowInStudioGlassPane)
Construct a ProgressFeedback with a given text notice.- Parameters:
strNotice
- The text notice to display in the ProgressWindow.bHideAbortButton
- will hide abort buttonbShowInStudioGlassPane
- will show in studio pane
-
-
Method Detail
-
runWithProgress
public static ProgressFeedback runWithProgress(String strNotice, IRunnableWithProgress task)
A helper method that executes a task in a worker thread and displays feedback in a progress windows.- Parameters:
strNotice
- The text notice to display in the ProgressWindow.task
- The task to execute in a separate (worker) thread.
-
runWithProgress
public static ProgressFeedback runWithProgress(String strNotice, IRunnableWithProgress task, boolean bHideAbortBtn)
-
runWithProgress
public static ProgressFeedback runWithProgress(String strNotice, IRunnableWithProgress task, boolean bHideAbortBtn, boolean bShowInStudioGlassPane)
-
runWithProgress
protected static ProgressFeedback runWithProgress(IRunnableWithProgress task, ProgressFeedback progressFeedback)
-
runWithPossibleDialog
public static <T> T runWithPossibleDialog(Callable<T> callable, String message)
-
setLength
public void setLength(int iLength)
Description copied from interface:IProgressCallback
How long is this operation in units? For a StagedProgressFeedback, this moves to the next stage- Specified by:
setLength
in interfaceIProgressCallback
- Parameters:
iLength
- The number of units the operation is expected to execute.
-
updateProgress
public boolean updateProgress(int iProgress, String strMessage, String... args)
Description copied from interface:IProgressCallback
Call this when a unit of progress completes.- Specified by:
updateProgress
in interfaceIProgressCallback
- Parameters:
iProgress
- The unit of progress completed.strMessage
- A short message describing the progress.- Returns:
- Whether or not the operation should abort. True to abort operation.
-
incrementProgress
public boolean incrementProgress(String strMessage, String... args)
- Specified by:
incrementProgress
in interfaceIProgressCallback
-
updateProgress
public boolean updateProgress(String strMessage, String... args)
Description copied from interface:IProgressCallback
Call this to update the progress message without modifying the amount of progress completed.- Specified by:
updateProgress
in interfaceIProgressCallback
-
getProgress
public int getProgress()
- Specified by:
getProgress
in interfaceIProgressCallback
-
isAbort
public boolean isAbort()
Description copied from interface:IProgressCallback
Should the operation abort?- Specified by:
isAbort
in interfaceIProgressCallback
- Returns:
- True if the operation should abort.
-
actionPerformed
public void actionPerformed(ActionEvent e)
- Specified by:
actionPerformed
in interfaceActionListener
-
operationComplete
public void operationComplete()
Description copied from interface:IProgressCallback
Signals that the operation is complete- Specified by:
operationComplete
in interfaceIProgressCallback
-
-