Package editor.util

Class ProgressFeedback

  • All Implemented Interfaces:
    IProgressCallback, java.awt.event.ActionListener, java.util.EventListener

    public class ProgressFeedback
    extends java.lang.Object
    implements IProgressCallback, java.awt.event.ActionListener
    A helper class for displaying a ProgressWindow while a task executes in a worker thread.
    • Field Detail

      • _strNotice

        private java.lang.String _strNotice
      • _bAbort

        private boolean _bAbort
      • _bHideAbortButton

        private boolean _bHideAbortButton
      • _bShowInStudioGlassPane

        private boolean _bShowInStudioGlassPane
      • _currentMessage

        private java.lang.String _currentMessage
      • _currentValue

        private int _currentValue
      • _length

        private int _length
      • _changeLength

        private boolean _changeLength
      • _timer

        private javax.swing.Timer _timer
    • Constructor Detail

      • ProgressFeedback

        protected ProgressFeedback​(java.lang.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 button
        bShowInStudioGlassPane - will show in studio pane
    • Method Detail

      • runWithProgress

        public static ProgressFeedback runWithProgress​(java.lang.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.
      • runWithPossibleDialog

        public static <T> T runWithPossibleDialog​(java.util.concurrent.Callable<T> callable,
                                                  java.lang.String message)
      • shortWait

        private static boolean shortWait​(long delay,
                                         boolean[] done)
      • waitForProgress

        private static void waitForProgress​(boolean[] done)
      • dispose

        void dispose()
        Hides and disposes the ProgressWindow.
      • startTimer

        private void startTimer()
      • stopTimer

        private void stopTimer()
      • 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 interface IProgressCallback
        Parameters:
        iLength - The number of units the operation is expected to execute.
      • updateProgress

        public boolean updateProgress​(int iProgress,
                                      java.lang.String strMessage,
                                      java.lang.String... args)
        Description copied from interface: IProgressCallback
        Call this when a unit of progress completes.
        Specified by:
        updateProgress in interface IProgressCallback
        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​(java.lang.String strMessage,
                                         java.lang.String... args)
        Specified by:
        incrementProgress in interface IProgressCallback
      • setCurrentMessage

        private void setCurrentMessage​(java.lang.String strMessage,
                                       java.lang.String[] args)
      • updateProgress

        public boolean updateProgress​(java.lang.String strMessage,
                                      java.lang.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 interface IProgressCallback
      • isAbort

        public boolean isAbort()
        Description copied from interface: IProgressCallback
        Should the operation abort?
        Specified by:
        isAbort in interface IProgressCallback
        Returns:
        True if the operation should abort.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener