com.compomics.util.gui.waiting.waitinghandlers
Class WaitingDialog

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.waitinghandlers.WaitingDialog
All Implemented Interfaces:
WaitingHandler, ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class WaitingDialog
extends JDialog
implements WaitingHandler

A dialog displaying progress details.

Author:
Marc Vaudel, Harald Barsnes
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
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
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
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.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 com.compomics.util.waiting.WaitingHandler
sdf, tab
 
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
WaitingDialog(Frame waitingHandlerParent, Image normalIcon, Image waitingIcon, boolean shakeWhenFinished, ArrayList<String> tips, String processName, String toolName, String toolVersion, boolean modal)
          Creates a new WaitingDialog.
WaitingDialog(Frame waitingHandlerParent, Image normalIcon, Image waitingIcon, boolean shakeWhenFinished, String processName, String toolName, String toolVersion, boolean modal)
          Creates a new WaitingDialog.
 
Method Summary
 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.
 void closeWhenComplete(boolean close)
          Set if the dialog is to be closed when the process is complete.
 String getLastSelectedFolder()
          Returns the last selected folder.
 int getMaxPrimaryProgressCounter()
          Returns the max primary progress counter.
 int getMaxSecondaryProgressCounter()
          Returns the max secondary progress counter.
 int getPrimaryProgressCounter()
          Returns the primary progress counter.
 String getReport(File aFile)
          Returns the report.
 JProgressBar getSecondaryProgressBar()
          Returns the secondary progress bar for updates from external processes.
 int getSecondaryProgressCounter()
          Returns the secondary progress counter.
 void increasePrimaryProgressCounter()
          Increase the progress bar value by one "counter".
 void increasePrimaryProgressCounter(int amount)
          Increase the progress bar value by the given amount.
 void increaseSecondaryProgressCounter()
          Increase the secondary progress bar value by one "counter".
 void increaseSecondaryProgressCounter(int amount)
          Increase the secondary progress bar value by the given amount.
 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 bar value to 0.
 void resetSecondaryProgressCounter()
          Reset the secondary progress bar value to 0.
 void setCloseDialogWhenImportCompletes(boolean closeWhenComplete, boolean enabled)
          Set if the value for if the dialog is to be closed when completed and if the option is enabled or not.
 void setLastSelectedFolder(String lastSelectedFolder)
          Sets the last selected folder.
 void setMaxPrimaryProgressCounter(int maxProgressValue)
          Set the maximum value of the progress bar.
 void setMaxSecondaryProgressCounter(int maxProgressValue)
          Set the maximum value of the secondary progress bar.
 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 setRunNotFinished()
          Set the run to not finished.
 void setSecondaryProgressCounter(int value)
          Sets the secondary progress bar to the given value.
 void setSecondaryProgressCounterIndeterminate(boolean indeterminate)
          Sets the secondary progress bar to indeterminate or not.
 void setSecondaryProgressText(String text)
          Set the secondary progress counter text.
 void setWaitingText(String text)
          Sets the text describing what is currently being waited for.
 void startShake()
          Make the dialog shake when the process has completed.
 
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

WaitingDialog

public WaitingDialog(Frame waitingHandlerParent,
                     Image normalIcon,
                     Image waitingIcon,
                     boolean shakeWhenFinished,
                     String processName,
                     String toolName,
                     String toolVersion,
                     boolean modal)
Creates a new WaitingDialog.

Parameters:
waitingHandlerParent - a reference to the handler parent
waitingIcon - the dialog/frame icon to use when waiting
normalIcon - the dialog/frame icon to use when done
shakeWhenFinished - shake when completed, mainly a PeptideShaker feature
processName - the name of the process we are waiting for, e.g., 'Import Data' or 'Search'
toolName - the name of the tool, need for the report
toolVersion - the version number of the tool, need for the report
modal -

WaitingDialog

public WaitingDialog(Frame waitingHandlerParent,
                     Image normalIcon,
                     Image waitingIcon,
                     boolean shakeWhenFinished,
                     ArrayList<String> tips,
                     String processName,
                     String toolName,
                     String toolVersion,
                     boolean modal)
Creates a new WaitingDialog.

Parameters:
waitingHandlerParent - a reference to the handler parent
waitingIcon - the dialog/frame icon to use when waiting
normalIcon - the dialog/frame icon to use when done
shakeWhenFinished - shake when completed, mainly a PeptideShaker feature
processName - the name of the process we are waiting for
modal -
toolName - the name of the tool, need for the report
toolVersion - the version number of the tool, need for the report
tips - the list of Tip of the day
Method Detail

closeWhenComplete

public void closeWhenComplete(boolean close)
Set if the dialog is to be closed when the process is complete.

Parameters:
close -

setMaxPrimaryProgressCounter

public void setMaxPrimaryProgressCounter(int maxProgressValue)
Set the maximum value of the progress bar.

Specified by:
setMaxPrimaryProgressCounter in interface WaitingHandler
Parameters:
maxProgressValue - the max value

increasePrimaryProgressCounter

public void increasePrimaryProgressCounter()
Increase the progress bar value by one "counter".

Specified by:
increasePrimaryProgressCounter in interface WaitingHandler

increasePrimaryProgressCounter

public void increasePrimaryProgressCounter(int amount)
Increase the progress bar value by the given amount.

Specified by:
increasePrimaryProgressCounter in interface WaitingHandler
Parameters:
amount - the amount to increase the value by

setMaxSecondaryProgressCounter

public void setMaxSecondaryProgressCounter(int maxProgressValue)
Set the maximum value of the secondary progress bar. And resets the value to 0.

Specified by:
setMaxSecondaryProgressCounter in interface WaitingHandler
Parameters:
maxProgressValue - the max value

resetSecondaryProgressCounter

public void resetSecondaryProgressCounter()
Reset the secondary progress bar value to 0.

Specified by:
resetSecondaryProgressCounter in interface WaitingHandler

resetPrimaryProgressCounter

public void resetPrimaryProgressCounter()
Reset the primary progress bar value to 0.

Specified by:
resetPrimaryProgressCounter in interface WaitingHandler

increaseSecondaryProgressCounter

public void increaseSecondaryProgressCounter()
Increase the secondary progress bar value by one "counter".

Specified by:
increaseSecondaryProgressCounter in interface WaitingHandler

setSecondaryProgressCounter

public void setSecondaryProgressCounter(int value)
Sets the secondary progress bar to the given value.

Specified by:
setSecondaryProgressCounter in interface WaitingHandler
Parameters:
value - the progress value

increaseSecondaryProgressCounter

public void increaseSecondaryProgressCounter(int amount)
Increase the secondary progress bar value by the given amount.

Specified by:
increaseSecondaryProgressCounter in interface WaitingHandler
Parameters:
amount - the amount to increase the value by

setSecondaryProgressCounterIndeterminate

public void setSecondaryProgressCounterIndeterminate(boolean indeterminate)
Sets the secondary progress bar to indeterminate or not.

Specified by:
setSecondaryProgressCounterIndeterminate in interface WaitingHandler
Parameters:
indeterminate - if true, set to indeterminate

getLastSelectedFolder

public String getLastSelectedFolder()
Returns the last selected folder. Null if none set.

Returns:
the last selected folder as string

setLastSelectedFolder

public void setLastSelectedFolder(String lastSelectedFolder)
Sets the last selected folder.

Parameters:
lastSelectedFolder - the last selected folder as string

setRunFinished

public void setRunFinished()
Set the process as finished.

Specified by:
setRunFinished in interface WaitingHandler

setRunCanceled

public void setRunCanceled()
Set the process as canceled.

Specified by:
setRunCanceled in interface WaitingHandler

appendReport

public void appendReport(String report,
                         boolean includeDate,
                         boolean addNewLine)
Description copied from interface: WaitingHandler
Append text to the report.

Specified by:
appendReport in interface WaitingHandler
Parameters:
report - the text to append
includeDate - if the date and time is to be added to the front of the text
addNewLine - add a new line after the text?

appendReportNewLineNoDate

public void appendReportNewLineNoDate()
Append two tabs to the report. No new line.

Specified by:
appendReportNewLineNoDate in interface WaitingHandler

appendReportEndLine

public void appendReportEndLine()
Append a new line to the report.

Specified by:
appendReportEndLine in interface WaitingHandler

isRunCanceled

public boolean isRunCanceled()
Returns true if the run is canceled.

Specified by:
isRunCanceled in interface WaitingHandler
Returns:
true if the run is canceled

startShake

public void startShake()
Make the dialog shake when the process has completed.


getSecondaryProgressBar

public JProgressBar getSecondaryProgressBar()
Returns the secondary progress bar for updates from external processes.

Returns:
the secondary progress bar

setWaitingText

public void setWaitingText(String text)
Description copied from interface: WaitingHandler
Sets the text describing what is currently being waited for.

Specified by:
setWaitingText in interface WaitingHandler
Parameters:
text - a text describing what is currently waited for

isRunFinished

public boolean isRunFinished()
Description copied from interface: WaitingHandler
Returns true if the process is finished.

Specified by:
isRunFinished in interface WaitingHandler
Returns:
true if the process is finished

getReport

public String getReport(File aFile)
Returns the report.

Parameters:
aFile - The file to send the report to. Note that only the name is used her and included in the report, the report is not sent to the file. Can be null.
Returns:
the report

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 interface WaitingHandler
Parameters:
indeterminate - a boolean indicating whether the primary progress counter is indeterminate or not

setCloseDialogWhenImportCompletes

public void setCloseDialogWhenImportCompletes(boolean closeWhenComplete,
                                              boolean enabled)
Set if the value for if the dialog is to be closed when completed and if the option is enabled or not.

Parameters:
closeWhenComplete - if true, the dialog closes when completed
enabled - enable or disable the check box

setRunNotFinished

public void setRunNotFinished()
Set the run to not finished.


isReport

public boolean isReport()
Description copied from interface: WaitingHandler
Indicates whether this waiting handler supports reports.

Specified by:
isReport in interface WaitingHandler
Returns:
a boolean indicating whether this waiting handler supports reports

addWaitingActionListener

public void addWaitingActionListener(WaitingActionListener waitingActionListener)
Adds a waiting action listener.

Parameters:
waitingActionListener -

setSecondaryProgressText

public void setSecondaryProgressText(String text)
Description copied from interface: WaitingHandler
Set the secondary progress counter text.

Specified by:
setSecondaryProgressText in interface WaitingHandler
Parameters:
text - the text to set

getPrimaryProgressCounter

public int getPrimaryProgressCounter()
Description copied from interface: WaitingHandler
Returns the primary progress counter.

Specified by:
getPrimaryProgressCounter in interface WaitingHandler
Returns:
primary progress counter

getMaxPrimaryProgressCounter

public int getMaxPrimaryProgressCounter()
Description copied from interface: WaitingHandler
Returns the max primary progress counter.

Specified by:
getMaxPrimaryProgressCounter in interface WaitingHandler
Returns:
max primary progress counter

getSecondaryProgressCounter

public int getSecondaryProgressCounter()
Description copied from interface: WaitingHandler
Returns the secondary progress counter.

Specified by:
getSecondaryProgressCounter in interface WaitingHandler
Returns:
secondary progress counter

getMaxSecondaryProgressCounter

public int getMaxSecondaryProgressCounter()
Description copied from interface: WaitingHandler
Returns the max secondary progress counter.

Specified by:
getMaxSecondaryProgressCounter in interface WaitingHandler
Returns:
max secondary progress counter


Copyright © 2013. All Rights Reserved.