Class ProgressDialog

java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
com.compomics.util.gui.waiting.waitinghandlers.ProgressDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ProgressDialog
extends JDialog
This class implements a modal dialog that is displayed during a longer-lasting task.
Version:
$Id: ProgressDialog.java,v 1.1 2009/08/02 13:23:46 lennart Exp $
Author:
Lennatr Martens
See Also:
Serialized Form
  • Constructor Details

    • ProgressDialog

      public ProgressDialog()
      Empty default constructor
    • ProgressDialog

      public ProgressDialog​(JFrame aParent, String aTitle, String aMessage)
      Deprecated.
      use ProgressDialogX instead
      Creates an indeterminate ProgressDialog by default, with the specified title and message. The methods 'setDeterminate()' and 'setIndeterminate()' allow the caller to set the type of progressbar. A determinate progressbar can report meaningfully on the progress.
      Parameters:
      aParent - aParent to link this dialog to.
      aTitle - String with the title for this dialog.
      aMessage - String with the message to display, can be 'null' for no message.
  • Method Details

    • setIndeterminate

      public void setIndeterminate()
      This method makes the progressbar indeterminate.
    • setDeterminate

      public void setDeterminate​(int aMin, int aMax)
      This method sets the progressbar to determinate mode, with the specified minimum and maximum values. It will also set the current value to the minimum.
      Parameters:
      aMin - int with the minimal value for the progress.
      aMax - int with the maximal value for the progress.
    • getMaximumValue

      public int getMaximumValue()
      Returns the current maximum value for the progressbar. Only returns sensible information if the progressdialog is in determinate mode.
      Returns:
      int with the maximum value for the progressbar.
    • getMinimumValue

      public int getMinimumValue()
      Returns the current minimum value for the progressbar. Only returns sensible information if the progressdialog is in determinate mode.
      Returns:
      int with the minimum value for the progressbar.
    • isIndeterminate

      public boolean isIndeterminate()
      This method signals whether the progressdialog is currently in indeterminate ('true') or determinate ('false') mode.
      Returns:
      boolean that indicates whether the progressdialog is currently in indeterminate ('true') or determinate ('false') mode.
    • setProgress

      public void setProgress​(int aValue, String aMessage)
      This method allows the caller to set the progress on the progressbar to the specified value, along with the specified message. The message can be 'null' for no message. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!
      Parameters:
      aValue - int with the value to set the progress to. Will throw IllegalArgumentException if this value is out of bounds (less than 'getMinimumValue()' or more than 'getMaximumValue()'. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!
      aMessage - String with the message to set on the progressbar, or 'null' for no message.
    • setMessage

      public void setMessage​(String aMessage)
      This method allows the caller to set a message on the progressbar. Specify a 'null' to remove any messages.
      Parameters:
      aMessage - String with message, or 'null' to remove any message.
    • isProgressBarValid

      public boolean isProgressBarValid()
      This method reports on whether this instance can be controlled in a multithreaded environment. While this method returns 'false', it is dangerous to alter any settings on this porgressdialog, as the component is not fully drawn and initialized yet!
      Returns:
      boolean that indicates whether it is safe ('true') or not ('false') for callers to interact with this progressdialog.
    • setProgress

      public void setProgress​(int aValue)
      This method sets the progress to the specified value. This method is only useful if the progressbar is in determinate mode. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!
      Parameters:
      aValue - int with the value to set the progress to. Will throw IllegalArgumentException if this value is out of bounds (less than 'getMinimumValue()' or more than 'getMaximumValue()'. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!
    • getProgress

      public int getProgress()
      This method reports on the current progress of the progressdialog. This method can only be relied on when the progressdialog is in determinate mode.
      Returns:
      int with the current value of the progress.