]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.jcr/src/org/argeo/jcr/JcrMonitor.java
3 import org
.argeo
.ArgeoMonitor
;
6 * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without
9 @SuppressWarnings("deprecation")
10 public interface JcrMonitor
extends ArgeoMonitor
{
12 * Constant indicating an unknown amount of work.
14 public final static int UNKNOWN
= -1;
17 * Notifies that the main task is beginning. This must only be called once
18 * on a given progress monitor instance.
21 * the name (or description) of the main task
23 * the total number of work units into which the main task is
24 * been subdivided. If the value is <code>UNKNOWN</code> the
25 * implementation is free to indicate progress in a way which
26 * doesn't require the total number of work units in advance.
28 public void beginTask(String name
, int totalWork
);
31 * Notifies that the work is done; that is, either the main task is
32 * completed or the user canceled it. This method may be called more than
33 * once (implementations should be prepared to handle this case).
38 * Returns whether cancelation of current operation has been requested.
39 * Long-running operations should poll to see if cancelation has been
42 * @return <code>true</code> if cancellation has been requested, and
43 * <code>false</code> otherwise
44 * @see #setCanceled(boolean)
46 public boolean isCanceled();
49 * Sets the cancel state to the given value.
52 * <code>true</code> indicates that cancelation has been
53 * requested (but not necessarily acknowledged);
54 * <code>false</code> clears this flag
57 public void setCanceled(boolean value
);
60 * Sets the task name to the given value. This method is used to restore the
61 * task label after a nested operation was executed. Normally there is no
62 * need for clients to call this method.
65 * the name (or description) of the main task
66 * @see #beginTask(java.lang.String, int)
68 public void setTaskName(String name
);
71 * Notifies that a subtask of the main task is beginning. Subtasks are
72 * optional; the main task might not have subtasks.
75 * the name (or description) of the subtask
77 public void subTask(String name
);
80 * Notifies that a given number of work unit of the main task has been
81 * completed. Note that this amount represents an installment, as opposed to
82 * a cumulative amount of work done to date.
85 * a non-negative number of work units just completed
87 public void worked(int work
);