Interface SimpleProgressMonitor

All Known Implementing Classes:
CommandLineTaskRunner.CommandLineProgressMonitor

public interface SimpleProgressMonitor
Class for monitoring the process of a plugin and displaying feedback to the user.

Implementing classes receive notifications from the plugin as it executes, and should display these in an appropriate way - such as with a dialog box and progress bar, or logging the progress to the system output. Classes may also choose to send cancel requests to the plugin, e.g. if the user presses a 'cancel' button.

SimpleProgressMonitor are not intended for reuse, i.e. the startMonitoring method should only be called once.

Author:
Pete Bankhead
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if cancel has been requested, for example by the user pressing a 'cancel' button.
    void
    Notify the monitor that the plugin has completed its work.
    void
    startMonitoring(String message, int maxProgress, boolean mayCancel)
    Set the plugin to monitor, and begin monitoring.
    void
    updateProgress(int increment, String message, ImageRegion region)
    Update the displayed progress, and optionally inform the PluginRunner that data related to a specified image region has been updated.
  • Method Details

    • startMonitoring

      void startMonitoring(String message, int maxProgress, boolean mayCancel)
      Set the plugin to monitor, and begin monitoring. Note that since SimpleProgressMonitor are not intended for reuse, this method should only be called once.
      Parameters:
      message - The message to display
      maxProgress - The progress value considered complete.
      mayCancel -
    • updateProgress

      void updateProgress(int increment, String message, ImageRegion region)
      Update the displayed progress, and optionally inform the PluginRunner that data related to a specified image region has been updated. If progress >= 1 this indicates that the task is finished, and the monitor may stop.
      Parameters:
      increment - update progress by the specified increment
      message - optional message that may be displayed to reflect the current progress status.
      region - optional region of the image that has been changed; in interactive mode, this region may be repainted.
    • pluginCompleted

      void pluginCompleted(String message)
      Notify the monitor that the plugin has completed its work. This is called automatically by updateProgress if progress >= 1, but may also be called if the plugin was cancelled or otherwise terminated abnormally.
      Parameters:
      message - message to show upon completion.
    • cancelled

      boolean cancelled()
      Returns true if cancel has been requested, for example by the user pressing a 'cancel' button.
      Returns: