public interface TaskMonitor
Task
's implementation run
method
to inform users of the status of its execution.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>
Modifier and Type | Interface and Description |
---|---|
static class |
TaskMonitor.Level
Used by the
showMessage method to indicate the severity of the message. |
Modifier and Type | Method and Description |
---|---|
void |
setProgress(double progress)
Sets the progress completed by the
Task . |
void |
setStatusMessage(String statusMessage)
Sets the status message that describes what the task is currently doing.
|
void |
setTitle(String title)
Sets the title of the
Task . |
void |
showMessage(TaskMonitor.Level level,
String message)
Sets the status message that describes what the task is currently doing.
|
void setTitle(String title)
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.
title
- Succinct description of the Task's purpose.void setProgress(double progress)
Task
.progress
- A value between 0.0
and 1.0
. Any negative value
sets the progress bar to an indefinite state.void setStatusMessage(String statusMessage)
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.
statusMessage
- A succinct description of what the task is currently doing.void showMessage(TaskMonitor.Level level, String message)
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.
level
- The severity of the messagemessage
- A succinct description of what the task is currently doing.Copyright 2011-2015 Cytoscape Consortium. All rights reserved.