Interface MonitorReceiver


public interface MonitorReceiver
The subscriber side of a published TaskMonitor

This only gives a subset of the expected task monitor interface. This is the subset a user would need to monitor and/or cancel the task. All the mechanisms for updating the monitor are only available to the publishing client.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Request the task be cancelled
    long
    Get the maximum value of progress
    Get the current message for the monitor
    long
    Get the progress value, if applicable
    boolean
    Check if the task can be cancelled
    boolean
    Check if the task is cancelled
    boolean
    Check if the monitor indicates progress at all
    boolean
    Check if the monitor should be rendered with the progress value
    boolean
    Check if the monitor is still valid
  • Method Details

    • getMessage

      String getMessage()
      Get the current message for the monitor
      Returns:
      the message
    • isIndeterminate

      boolean isIndeterminate()
      Check if the monitor indicates progress at all

      If the task is indeterminate, then its getMaximum() and getProgress() methods are meaningless.

      Returns:
      true if indeterminate (no progress shown), false if determinate (progress shown)
    • getMaximum

      long getMaximum()
      Get the maximum value of progress

      The implication is that when getProgress() returns the maximum, the task is complete.

      Returns:
      the maximum progress
    • getProgress

      long getProgress()
      Get the progress value, if applicable
      Returns:
      the progress, or TaskMonitor.NO_PROGRESS_VALUE if un-set or not applicable
    • isCancelEnabled

      boolean isCancelEnabled()
      Check if the task can be cancelled
      Returns:
      true if cancel is enabled, false if not
    • cancel

      void cancel()
      Request the task be cancelled

      Note it is up to the client publishing the task to adhere to this request. In general, the computation should occasionally call TaskMonitor.checkCancelled(). In particular, the subscribing client cannot presume the task is cancelled purely by virtue of calling this method successfully. Instead, it should listen for ProgressListener.monitorDisposed(MonitorReceiver, Disposal).

    • isCancelled

      boolean isCancelled()
      Check if the task is cancelled
      Returns:
      true if cancelled, false if not
    • isValid

      boolean isValid()
      Check if the monitor is still valid

      A monitor becomes invalid when it is closed or cleaned.

      Returns:
      true if still valid, false if invalid
    • isShowProgressValue

      boolean isShowProgressValue()
      Check if the monitor should be rendered with the progress value

      Regardless of this value, the monitor will render a progress bar and a numeric percentage. If this is set to true (the default), the it will also display "{progress} of {maximum}" in text.

      Returns:
      true to render the actual progress value, false for only a percentage.