Interface TaskMonitor


  • public interface TaskMonitor
    Used by a Task's implementation run method to inform users of the status of its execution.
    Author:
    Samad Lotia

    Module: work-api

    To use this in your app, include the following dependency in your POM:

    <dependency>
        <groupId>org.cytoscape</groupId>
        <artifactId>work-api</artifactId>
    </dependency>

    Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  TaskMonitor.Level
      Used by the showMessage method to indicate the severity of the message.
    • Method Detail

      • setTitle

        void setTitle​(String title)
        Sets the title of the Task. The title is a succinct, user-friendly description of the task's purpose.

        Titles should be user-friendly descriptions. Implementation-specific details and debugging information should be avoided in titles.

        Each task implementation should call this method and should typically be called once at the beginning of the run method.

        In the Swing task dialog, the appearance of the task's title depends on the task's position in the task iterator and the order of calls to setTitle(). If the task is the first in the task iterator, its title (as set by setTitle()) will be shown during the course of the entire task iterator's execution at the top of the dialog in large text. The title of a subsequent task (or a subsequent call to setTitle() in the first task) will be shown only during the course of its execution as the secondary title. The secondary title is smaller text underneath the primary title. The behavior of primary and secondary titles does not change the semantics of task titles. The behavior of primary and secondary task titles are subject to change in future Cytoscape releases.

        Parameters:
        title - Succinct description of the Task's purpose.
      • setProgress

        void setProgress​(double progress)
        Sets the progress completed by the Task.
        Parameters:
        progress - A value between 0.0 and 1.0. Any negative value sets the progress bar to an indefinite state.
      • setStatusMessage

        void setStatusMessage​(String statusMessage)
        Sets the status message that describes what the task is currently doing. Status messages are succinct, user-friendly descriptions of a stage of the task's execution. These messages should not contain formatting information such as HTML tags, since it is not guaranteed that the actual Task Monitor implementation will be able to render it (for instance, the messages may be displayed in a console). Status messages should not contain implementation details or debugging information either.

        This method is a shorthand for showMessage(Level.INFO, statusMessage).

        This method can be called throughout the course of the run method.

        In the Swing task dialog, status messages are shown temporarily at the bottom until another invocation of setStatusMessage or showMessage or until the end of the task's execution. All status messages can be recalled by the user by opening the task history window.

        Parameters:
        statusMessage - A succinct description of what the task is currently doing.
      • showMessage

        void showMessage​(TaskMonitor.Level level,
                         String message)
        Sets the status message that describes what the task is currently doing. Status messages are succinct, user-friendly descriptions of a stage of the task's execution. These messages should not contain formatting information such as HTML tags, since it is not guaranteed that the actual Task Monitor implementation will be able to render it (for instance, the messages may be displayed in a console). Status messages should not contain implementation details or debugging information either.

        This method can be called throughout the course of the run method.

        In the Swing task dialog, messages are shown temporarily at the bottom until another invocation of setStatusMessage or showMessage or until the end of the task's execution. All messages can be recalled by the user by opening the task history window.

        Parameters:
        level - The severity of the message
        message - A succinct description of what the task is currently doing.