Class ProgressDialog

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class ProgressDialog extends JDialog implements ActionListener
A modal dialog box to display progress information to the user when a long-lived task is running. If the long-lived task can be cancelled by the user, this dialog will invoke the CancelEventTrigger when the user clicks the cancel button.
Author:
James Murty
See Also:
  • Constructor Details

    • ProgressDialog

      public ProgressDialog(Frame owner, String title, Properties applicationProperties)
      Constructs the progress dialog box.
      Parameters:
      owner - the Frame over which the progress dialog will be displayed and centred
      title - the title for the progress dialog
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • dispose

      public void dispose()
      Overrides:
      dispose in class Window
    • startDialog

      public void startDialog(String statusMessage, String detailsText, int minTaskValue, int maxTaskValue, CancelEventTrigger cancelEventListener, String cancelButtonText)
      Displays the progress dialog.
      Parameters:
      statusMessage - describes the status of a task text meaningful to the user, such as "3 files of 7 uploaded"
      detailsText - describes the status of a task in more detail, such as the current transfer rate and ETA.
      minTaskValue - the minimum progress value for a task, generally 0
      maxTaskValue - the maximum progress value for a task, such as the total number of threads or 100 if using percentage-complete as a metric.
      cancelEventListener - listener that is responsible for cancelling a long-lived task when the user clicks the cancel button. If a task cannot be cancelled this must be null.
      cancelButtonText - text displayed in the cancel button if a task can be cancelled
    • stopDialog

      public void stopDialog()
    • updateDialog

      public void updateDialog(String statusMessage, String detailsText, int progressValue)
      Updates the dialog's information.
      Parameters:
      statusMessage - text describing the status of a task text meaningful to the user, such as "3 files of 7 uploaded"
      detailsText - detailed description of the task's status, such as the current transfer rate and remaining time.
      progressValue - value representing how far through the task we are, somewhere between minTaskValue and maxTaskValue as set in the constructor.