com.compomics.util.gui.waiting
Class ProgressDialog

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

public class ProgressDialog
extends javax.swing.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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ProgressDialog(javax.swing.JFrame aParent, java.lang.String aTitle, java.lang.String aMessage)
          Deprecated. use ProgressDialogX instead
 
Method Summary
 int getMaximumValue()
          Returns the current maximum value for the progressbar.
 int getMinimumValue()
          Returns the current minimum value for the progressbar.
 int getProgress()
          This method reports on the current progress of the progressdialog.
 boolean isIndeterminate()
          This method signals whether the progressdialog is currently in indeterminate ('true') or determinate ('false') mode.
 boolean isProgressBarValid()
          This method reports on whether this instance can be controlled in a multithreaded environment.
 void setDeterminate(int aMin, int aMax)
          This method sets the progressbar to determinate mode, with the specified minimum and maximum values.
 void setIndeterminate()
          This method makes the progressbar indeterminate.
 void setMessage(java.lang.String aMessage)
          This method allows the caller to set a message on the progressbar.
 void setProgress(int aValue)
          This method sets the progress to the specified value.
 void setProgress(int aValue, java.lang.String aMessage)
          This method allows the caller to set the progress on the progressbar to the specified value, along with the specified message.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgressDialog

public ProgressDialog(javax.swing.JFrame aParent,
                      java.lang.String aTitle,
                      java.lang.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 Detail

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,
                        java.lang.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(java.lang.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.


Copyright © 2013. All Rights Reserved.