Class 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:
  • Constructor Details

    • WaitingDialog

      public WaitingDialog()
      Empty default constructor
    • 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
      normalIcon - the dialog/frame icon to use when done
      waitingIcon - the dialog/frame icon to use when waiting
      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, needed for the report
      modal - if the dialog is to be modal or not
    • 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
      normalIcon - the dialog/frame icon to use when done
      waitingIcon - the dialog/frame icon to use when waiting
      shakeWhenFinished - shake when completed, mainly a PeptideShaker feature
      tips - the list of Tip of the day
      processName - the name of the process we are waiting for
      toolName - the name of the tool, need for the report
      toolVersion - the version number of the tool, needed for the report
      modal - if the dialog is to be modal or not
  • Method Details

    • closeWhenComplete

      public void closeWhenComplete(boolean close)
      Set if the dialog is to be closed when the process is complete.
      Parameters:
      close - if the dialog is to be closed when the process is complete
    • setPrimaryProgressCounter

      public void setPrimaryProgressCounter(int value)
      Description copied from interface: WaitingHandler
      Sets the primary progress counter to the given value.
      Specified by:
      setPrimaryProgressCounter in interface WaitingHandler
      Parameters:
      value - the progress value
    • setMaxPrimaryProgressCounter

      public void setMaxPrimaryProgressCounter(int maxProgressValue)
      Description copied from interface: WaitingHandler
      Set the maximum value for the primary progress counter.
      Specified by:
      setMaxPrimaryProgressCounter in interface WaitingHandler
      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 interface WaitingHandler
    • increasePrimaryProgressCounter

      public void increasePrimaryProgressCounter(int value)
      Description copied from interface: WaitingHandler
      Increase the primary progress counter by the given increment.
      Specified by:
      increasePrimaryProgressCounter in interface WaitingHandler
      Parameters:
      value - 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 interface WaitingHandler
      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 interface WaitingHandler
    • resetPrimaryProgressCounter

      public void resetPrimaryProgressCounter()
      Description copied from interface: WaitingHandler
      Reset the primary progress counter 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)
      Description copied from interface: WaitingHandler
      Sets the secondary progress counter to the given value.
      Specified by:
      setSecondaryProgressCounter in interface WaitingHandler
      Parameters:
      value - the progress value
    • increaseSecondaryProgressCounter

      public void increaseSecondaryProgressCounter(int value)
      Description copied from interface: WaitingHandler
      Increase the secondary progress counter by the given value.
      Specified by:
      increaseSecondaryProgressCounter in interface WaitingHandler
      Parameters:
      value - 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 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()
      Description copied from interface: WaitingHandler
      Set the process as finished.
      Specified by:
      setRunFinished in interface WaitingHandler
    • setRunCanceled

      public void setRunCanceled()
      Description copied from interface: WaitingHandler
      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()
      Description copied from interface: WaitingHandler
      Append two tabs to the report. No new line.
      Specified by:
      appendReportNewLineNoDate in interface WaitingHandler
    • appendReportEndLine

      public void appendReportEndLine()
      Description copied from interface: WaitingHandler
      Append a new line to the report.
      Specified by:
      appendReportEndLine in interface WaitingHandler
    • isRunCanceled

      public boolean isRunCanceled()
      Description copied from interface: WaitingHandler
      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 - the waiting action listener
    • 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
    • setVisible

      public void setVisible(boolean b)
      Overrides:
      setVisible in class Dialog
    • 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 interface WaitingHandler
      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 interface WaitingHandler
      Returns:
      if the waiting handler is to show the progress for the current process or not