Class ProgressDialogX
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
com.compomics.util.gui.waiting.waitinghandlers.ProgressDialogX
- All Implemented Interfaces:
WaitingHandler
,ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
public class ProgressDialogX extends JDialog implements WaitingHandler
A dialog for displaying information about progress.
- Author:
- Harald Barsnes, Marc Vaudel
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface com.compomics.util.waiting.WaitingHandler
SIMPLE_DATA_FORMAT, TAB_HTML, TAB_NON_HTML
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
Constructors Constructor Description ProgressDialogX(boolean modal)
Opens a new ProgressDialog.ProgressDialogX(Frame waitingHandlerParent, Image normalIcon, Image waitingIcon, boolean modal)
Opens a new ProgressDialogX with a Frame as a parent.ProgressDialogX(JDialog waitingHandlerParent, Frame waitingHandlerParentFrame, Image normalIcon, Image waitingIcon, boolean modal)
Opens a new ProgressDialog with a JDialog as a parent. -
Method Summary
Modifier and Type Method Description void
addWaitingActionListener(WaitingActionListener waitingActionListener)
Adds a waiting action listener.void
appendReport(String report, boolean includeDate, boolean addNewLine)
Append text to the report.void
appendReportEndLine()
Append a new line to the report.void
appendReportNewLineNoDate()
Append two tabs to the report.boolean
getDisplayProgress()
Returns if the waiting handler is to show the progress for the current process or not.int
getMaxPrimaryProgressCounter()
Returns the max primary progress counter.int
getMaxSecondaryProgressCounter()
Returns the max secondary progress counter.int
getPrimaryProgressCounter()
Returns the primary progress counter.JProgressBar
getProgressBar()
Returns the progress bar for updates from external processes.int
getSecondaryProgressCounter()
Returns the secondary progress counter.void
increasePrimaryProgressCounter()
Increase the primary progress counter by one "counter".void
increasePrimaryProgressCounter(int increment)
Increase the primary progress counter by the given increment.void
increaseSecondaryProgressCounter()
Increase the secondary progress counter by one "counter".void
increaseSecondaryProgressCounter(int number)
Increase the secondary progress counter by the given value.boolean
isReport()
Indicates whether this waiting handler supports reports.boolean
isRunCanceled()
Returns true if the run is canceled.boolean
isRunFinished()
Returns true if the process is finished.void
resetPrimaryProgressCounter()
Reset the primary progress counter to 0.void
resetSecondaryProgressCounter()
Reset the secondary progress counter to 0.void
setDisplayProgress(boolean displayProgress)
Set if the waiting handler is to show the progress for the current process or not.void
setMaxPrimaryProgressCounter(int maxProgressValue)
Set the maximum value for the primary progress counter.void
setMaxSecondaryProgressCounter(int maxProgressValue)
Set the maximum value for the secondary progress counter.void
setPrimaryProgressCounter(int value)
Sets the primary progress counter to the given value.void
setPrimaryProgressCounterIndeterminate(boolean indeterminate)
Sets whether the primary progress counter is indeterminate or not.void
setRunCanceled()
Set the process as canceled.void
setRunFinished()
Set the process as finished.void
setSecondaryProgressCounter(int value)
Sets the secondary progress counter to the given value.void
setSecondaryProgressCounterIndeterminate(boolean indeterminate)
Sets the secondary progress counter to indeterminate or not.void
setSecondaryProgressText(String text)
Set the secondary progress counter text.void
setString(String displayString)
Sets the string to display in the progress bar.void
setUnstoppable(boolean unstoppable)
Set this to true of the process the progress bar is used for is not possible to stop, or not possible to stop nicely.void
setValue(int value)
Sets the progress bar value.void
setWaitingText(String text)
Sets the text describing what is currently being waited for.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, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
ProgressDialogX
public ProgressDialogX(Frame waitingHandlerParent, Image normalIcon, Image waitingIcon, boolean modal)Opens a new ProgressDialogX with a Frame as a parent.- Parameters:
waitingHandlerParent
- the waiting handler parentwaitingIcon
- the frame icon to use when waitingnormalIcon
- the frame icon to use when donemodal
- if the dialog is to be modal or not
-
ProgressDialogX
public ProgressDialogX(JDialog waitingHandlerParent, Frame waitingHandlerParentFrame, Image normalIcon, Image waitingIcon, boolean modal)Opens a new ProgressDialog with a JDialog as a parent.- Parameters:
waitingHandlerParent
- the waiting handler parentwaitingHandlerParentFrame
- the dialog's parent frame (needed to set the frame icons)waitingIcon
- the frame icon to use when waitingnormalIcon
- the frame icon to use when donemodal
- if the dialog is to be modal or not
-
ProgressDialogX
public ProgressDialogX(boolean modal)Opens a new ProgressDialog.- Parameters:
modal
- if the dialog is to be modal or not
-
-
Method Details
-
setValue
public void setValue(int value)Sets the progress bar value.- Parameters:
value
- the progress bar value
-
setPrimaryProgressCounterIndeterminate
public void setPrimaryProgressCounterIndeterminate(boolean indeterminate)Description copied from interface:WaitingHandler
Sets whether the primary progress counter is indeterminate or not.- Specified by:
setPrimaryProgressCounterIndeterminate
in interfaceWaitingHandler
- Parameters:
indeterminate
- a boolean indicating whether the primary progress counter is indeterminate or not
-
setString
Sets the string to display in the progress bar.- Parameters:
displayString
- the string to display
-
setUnstoppable
public void setUnstoppable(boolean unstoppable)Set this to true of the process the progress bar is used for is not possible to stop, or not possible to stop nicely. If the user still tries to close the progress bar the a warning message is first shown were the user has to confirm that he/she still wants to close the progress bar.- Parameters:
unstoppable
- if the current process is unstoppable
-
getProgressBar
Returns the progress bar for updates from external processes.- Returns:
- the progress bar
-
setMaxPrimaryProgressCounter
public void setMaxPrimaryProgressCounter(int maxProgressValue)Description copied from interface:WaitingHandler
Set the maximum value for the primary progress counter.- Specified by:
setMaxPrimaryProgressCounter
in interfaceWaitingHandler
- Parameters:
maxProgressValue
- the max value
-
increasePrimaryProgressCounter
public void increasePrimaryProgressCounter()Description copied from interface:WaitingHandler
Increase the primary progress counter by one "counter".- Specified by:
increasePrimaryProgressCounter
in interfaceWaitingHandler
-
increasePrimaryProgressCounter
public void increasePrimaryProgressCounter(int increment)Description copied from interface:WaitingHandler
Increase the primary progress counter by the given increment.- Specified by:
increasePrimaryProgressCounter
in interfaceWaitingHandler
- Parameters:
increment
- the increment to increase the value by
-
setMaxSecondaryProgressCounter
public void setMaxSecondaryProgressCounter(int maxProgressValue)Description copied from interface:WaitingHandler
Set the maximum value for the secondary progress counter.- Specified by:
setMaxSecondaryProgressCounter
in interfaceWaitingHandler
- Parameters:
maxProgressValue
- the max value
-
resetSecondaryProgressCounter
public void resetSecondaryProgressCounter()Description copied from interface:WaitingHandler
Reset the secondary progress counter to 0.- Specified by:
resetSecondaryProgressCounter
in interfaceWaitingHandler
-
setPrimaryProgressCounter
public void setPrimaryProgressCounter(int value)Description copied from interface:WaitingHandler
Sets the primary progress counter to the given value.- Specified by:
setPrimaryProgressCounter
in interfaceWaitingHandler
- Parameters:
value
- the progress value
-
increaseSecondaryProgressCounter
public void increaseSecondaryProgressCounter()Description copied from interface:WaitingHandler
Increase the secondary progress counter by one "counter".- Specified by:
increaseSecondaryProgressCounter
in interfaceWaitingHandler
-
setSecondaryProgressCounter
public void setSecondaryProgressCounter(int value)Description copied from interface:WaitingHandler
Sets the secondary progress counter to the given value.- Specified by:
setSecondaryProgressCounter
in interfaceWaitingHandler
- Parameters:
value
- the progress value
-
increaseSecondaryProgressCounter
public void increaseSecondaryProgressCounter(int number)Description copied from interface:WaitingHandler
Increase the secondary progress counter by the given value.- Specified by:
increaseSecondaryProgressCounter
in interfaceWaitingHandler
- Parameters:
number
- the value to increase the value by
-
setSecondaryProgressCounterIndeterminate
public void setSecondaryProgressCounterIndeterminate(boolean indeterminate)Description copied from interface:WaitingHandler
Sets the secondary progress counter to indeterminate or not.- Specified by:
setSecondaryProgressCounterIndeterminate
in interfaceWaitingHandler
- Parameters:
indeterminate
- if true, set to indeterminate
-
setRunFinished
public void setRunFinished()Description copied from interface:WaitingHandler
Set the process as finished.- Specified by:
setRunFinished
in interfaceWaitingHandler
-
setRunCanceled
public void setRunCanceled()Description copied from interface:WaitingHandler
Set the process as canceled.- Specified by:
setRunCanceled
in interfaceWaitingHandler
-
appendReport
Description copied from interface:WaitingHandler
Append text to the report.- Specified by:
appendReport
in interfaceWaitingHandler
- Parameters:
report
- the text to appendincludeDate
- if the date and time is to be added to the front of the textaddNewLine
- add a new line after the text?
-
appendReportNewLineNoDate
public void appendReportNewLineNoDate()Description copied from interface:WaitingHandler
Append two tabs to the report. No new line.- Specified by:
appendReportNewLineNoDate
in interfaceWaitingHandler
-
appendReportEndLine
public void appendReportEndLine()Description copied from interface:WaitingHandler
Append a new line to the report.- Specified by:
appendReportEndLine
in interfaceWaitingHandler
-
isRunCanceled
public boolean isRunCanceled()Description copied from interface:WaitingHandler
Returns true if the run is canceled.- Specified by:
isRunCanceled
in interfaceWaitingHandler
- Returns:
- true if the run is canceled
-
isRunFinished
public boolean isRunFinished()Description copied from interface:WaitingHandler
Returns true if the process is finished.- Specified by:
isRunFinished
in interfaceWaitingHandler
- Returns:
- true if the process is finished
-
setWaitingText
Description copied from interface:WaitingHandler
Sets the text describing what is currently being waited for.- Specified by:
setWaitingText
in interfaceWaitingHandler
- Parameters:
text
- a text describing what is currently waited for
-
isReport
public boolean isReport()Description copied from interface:WaitingHandler
Indicates whether this waiting handler supports reports.- Specified by:
isReport
in interfaceWaitingHandler
- Returns:
- a boolean indicating whether this waiting handler supports reports
-
addWaitingActionListener
Adds a waiting action listener.- Parameters:
waitingActionListener
- the waiting action listener
-
setSecondaryProgressText
Description copied from interface:WaitingHandler
Set the secondary progress counter text.- Specified by:
setSecondaryProgressText
in interfaceWaitingHandler
- Parameters:
text
- the text to set
-
resetPrimaryProgressCounter
public void resetPrimaryProgressCounter()Description copied from interface:WaitingHandler
Reset the primary progress counter to 0.- Specified by:
resetPrimaryProgressCounter
in interfaceWaitingHandler
-
getPrimaryProgressCounter
public int getPrimaryProgressCounter()Description copied from interface:WaitingHandler
Returns the primary progress counter.- Specified by:
getPrimaryProgressCounter
in interfaceWaitingHandler
- Returns:
- primary progress counter
-
getMaxPrimaryProgressCounter
public int getMaxPrimaryProgressCounter()Description copied from interface:WaitingHandler
Returns the max primary progress counter.- Specified by:
getMaxPrimaryProgressCounter
in interfaceWaitingHandler
- Returns:
- max primary progress counter
-
getSecondaryProgressCounter
public int getSecondaryProgressCounter()Description copied from interface:WaitingHandler
Returns the secondary progress counter.- Specified by:
getSecondaryProgressCounter
in interfaceWaitingHandler
- Returns:
- secondary progress counter
-
getMaxSecondaryProgressCounter
public int getMaxSecondaryProgressCounter()Description copied from interface:WaitingHandler
Returns the max secondary progress counter.- Specified by:
getMaxSecondaryProgressCounter
in interfaceWaitingHandler
- Returns:
- max secondary progress counter
-
setDisplayProgress
public void setDisplayProgress(boolean displayProgress)Description copied from interface:WaitingHandler
Set if the waiting handler is to show the progress for the current process or not. Useful when running subprocesses that one wants to be able to cancel but do not want to show the progress for.- Specified by:
setDisplayProgress
in interfaceWaitingHandler
- Parameters:
displayProgress
- if the waiting handler is to show the progress for the current process or not
-
getDisplayProgress
public boolean getDisplayProgress()Description copied from interface:WaitingHandler
Returns if the waiting handler is to show the progress for the current process or not. Useful when running subprocesses that one wants to be able to cancel but do not want to show the progress for.- Specified by:
getDisplayProgress
in interfaceWaitingHandler
- Returns:
- if the waiting handler is to show the progress for the current process or not
-