Class ProgressDialog

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JOptionPane
com.inductiveautomation.ignition.client.util.gui.ProgressDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ProgressDialog extends JOptionPane
A class that will asynchronously run a task out of the EDT, but will block with a JDialog until the task is finished, or the user cancels the task.

There are two ways to use it. The legacy method is to create a ProgressTask and call startTask().

The new method is to create an AsyncClientTask and send it to the ClientProgressManager.runTask, who will show the ProgressDialog if necessary.

See Also:
  • Field Details

    • CANCEL_OPTION

      public static String CANCEL_OPTION
  • Method Details

    • getLogger

      protected static org.apache.log4j.Logger getLogger()
    • startTask

      public static Object startTask(ProgressDialog.ProgressTask task, Component parent, String message, String title, String note)
    • startTask

      public static Object startTask(ProgressDialog.ProgressTask task, Component parent, String message, String title, String note, int max, boolean indeterminant)
      Starts running the given ProgressTask, and opens a JDialog to show progress tracking. This method will block until either the ProgressTask finishes, or the user cancels the action. If the task is canceled, then ProgressDialog.CANCEL_OPTION will be returned. If the task threw an Exception, that exception will be returned. Otherwise, the return value of the ProgressTask will be returned.
      Parameters:
      task - The task to run
      parent - The parent component for the dialog. If this is a JDesktopPane, an internal frame will be used for the dialog.
      message - The main message for the dialog
      title - The title for the dialog window
      note - A submessage, that may change as the progress advances. May be null to avoid having a submessage
      max - The maximum value that the progress will reach
      indeterminant - True if the task cannot be tracked - will show indeterminant animation
    • displayWithState

      public static void displayWithState(Component parent, TaskProgressState state)
    • closeIfPossible

      protected static void closeIfPossible()
      This function closes the dialog if there's nothing going on.
    • displayDialog

      protected static void displayDialog(Component parent, TaskProgressState state)
    • updateStateInternal

      protected void updateStateInternal(TaskProgressState state)
    • getMaxCharactersPerLineCount

      public int getMaxCharactersPerLineCount()
      Overrides:
      getMaxCharactersPerLineCount in class JOptionPane