]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - base/runtime/org.argeo.util/src/main/java/org/argeo/ArgeoMonitor.java
4 * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without
7 public interface ArgeoMonitor
{
9 * Constant indicating an unknown amount of work.
11 public final static int UNKNOWN
= -1;
14 * Notifies that the main task is beginning. This must only be called once
15 * on a given progress monitor instance.
18 * the name (or description) of the main task
20 * the total number of work units into which the main task is
21 * been subdivided. If the value is <code>UNKNOWN</code> the
22 * implementation is free to indicate progress in a way which
23 * doesn't require the total number of work units in advance.
25 public void beginTask(String name
, int totalWork
);
28 * Notifies that the work is done; that is, either the main task is
29 * completed or the user canceled it. This method may be called more than
30 * once (implementations should be prepared to handle this case).
35 * Returns whether cancelation of current operation has been requested.
36 * Long-running operations should poll to see if cancelation has been
39 * @return <code>true</code> if cancellation has been requested, and
40 * <code>false</code> otherwise
41 * @see #setCanceled(boolean)
43 public boolean isCanceled();
46 * Sets the cancel state to the given value.
49 * <code>true</code> indicates that cancelation has been
50 * requested (but not necessarily acknowledged);
51 * <code>false</code> clears this flag
54 public void setCanceled(boolean value
);
57 * Sets the task name to the given value. This method is used to restore the
58 * task label after a nested operation was executed. Normally there is no
59 * need for clients to call this method.
62 * the name (or description) of the main task
63 * @see #beginTask(java.lang.String, int)
65 public void setTaskName(String name
);
68 * Notifies that a subtask of the main task is beginning. Subtasks are
69 * optional; the main task might not have subtasks.
72 * the name (or description) of the subtask
74 public void subTask(String name
);
77 * Notifies that a given number of work unit of the main task has been
78 * completed. Note that this amount represents an installment, as opposed to
79 * a cumulative amount of work done to date.
82 * a non-negative number of work units just completed
84 public void worked(int work
);