Class ProgressDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, Accessible, RootPaneContainer, WindowConstants, StatusListener

public class ProgressDialog extends JDialog implements StatusListener, Runnable
This class implements a generalized progress dialog with a progress bar.
Author:
Andrew Pavlin, KA2DDO, James Palmer, AG5VQ
See Also:
  • Constructor Details

    • ProgressDialog

      public ProgressDialog(Window owner, String title, boolean modal)
      Display a GUI progress dialog.
      Parameters:
      owner - the parent Window owning the progress dialog
      title - the already-localized title string for the progress dialog
      modal - boolean true if dialog should be modal for its parent window hierarchy
  • Method Details

    • setAbortListener

      public void setAbortListener(AbortListener abortListener)
      Register an asynchronous callback to indicate the user requested cancellation.
      Specified by:
      setAbortListener in interface StatusListener
      Parameters:
      abortListener - AbortListener to call from UI thread when cancellation is requested, or null to remove cancellation
    • updateMessage

      public void updateMessage(String msg) throws UserAbort
      Update the status message for this operation.
      Specified by:
      updateMessage in interface StatusListener
      Parameters:
      msg - String message to display
      Throws:
      UserAbort - if user wants to stop long-running operation
    • updateProgress

      public void updateProgress(double percent) throws UserAbort
      Update the progress percentage for this operation.
      Specified by:
      updateProgress in interface StatusListener
      Parameters:
      percent - percent complete in the range 0 to 100.
      Throws:
      UserAbort - if user wants to stop long-running operation
    • updateStatus

      public void updateStatus(String msg, double percent) throws UserAbort
      Update the status message and progress percentage for this operation.
      Specified by:
      updateStatus in interface StatusListener
      Parameters:
      msg - String message to display
      percent - percent complete in the range 0 to 100.
      Throws:
      UserAbort - if user wants to stop long-running operation
    • updateStatusSynchronously

      public void updateStatusSynchronously(String msg, double percent) throws UserAbort
      Update the status message and progress percentage for this operation, blocking until the GUI is updated.
      Specified by:
      updateStatusSynchronously in interface StatusListener
      Parameters:
      msg - String message to display
      percent - percent complete in the range 0 to 100.
      Throws:
      UserAbort - if user wants to stop long-running operation
    • setOperationComplete

      public void setOperationComplete()
      Report that the long-running operation is done.
      Specified by:
      setOperationComplete in interface StatusListener
    • isOperationComplete

      public boolean isOperationComplete()
      Test whether the operation monitored by this StatusListener is done. Used to allow one thread to test the result of another thread's execution.
      Specified by:
      isOperationComplete in interface StatusListener
      Returns:
      boolean true if operation has been reported complete
    • isAborted

      public boolean isAborted()
      Test whether the user has requested that the long-running operation be aborted. This is useful so that threads other than the one that received a UserAbort exception can also clean up.
      Specified by:
      isAborted in interface StatusListener
      Returns:
      boolean true if operation has been aborted by user
    • run

      public void run()
      Do not call. Callback for updating progress dialog on the GUI thread.
      Specified by:
      run in interface Runnable