]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.jcr/src/org/argeo/jcr/JcrMonitor.java
5 * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without
8 public interface JcrMonitor
{
10 * Constant indicating an unknown amount of work.
12 public final static int UNKNOWN
= -1;
15 * Notifies that the main task is beginning. This must only be called once
16 * on a given progress monitor instance.
19 * the name (or description) of the main task
21 * the total number of work units into which the main task is
22 * been subdivided. If the value is <code>UNKNOWN</code> the
23 * implementation is free to indicate progress in a way which
24 * doesn't require the total number of work units in advance.
26 public void beginTask(String name
, int totalWork
);
29 * Notifies that the work is done; that is, either the main task is
30 * completed or the user canceled it. This method may be called more than
31 * once (implementations should be prepared to handle this case).
36 * Returns whether cancelation of current operation has been requested.
37 * Long-running operations should poll to see if cancelation has been
40 * @return <code>true</code> if cancellation has been requested, and
41 * <code>false</code> otherwise
42 * @see #setCanceled(boolean)
44 public boolean isCanceled();
47 * Sets the cancel state to the given value.
50 * <code>true</code> indicates that cancelation has been
51 * requested (but not necessarily acknowledged);
52 * <code>false</code> clears this flag
55 public void setCanceled(boolean value
);
58 * Sets the task name to the given value. This method is used to restore the
59 * task label after a nested operation was executed. Normally there is no
60 * need for clients to call this method.
63 * the name (or description) of the main task
64 * @see #beginTask(java.lang.String, int)
66 public void setTaskName(String name
);
69 * Notifies that a subtask of the main task is beginning. Subtasks are
70 * optional; the main task might not have subtasks.
73 * the name (or description) of the subtask
75 public void subTask(String name
);
78 * Notifies that a given number of work unit of the main task has been
79 * completed. Note that this amount represents an installment, as opposed to
80 * a cumulative amount of work done to date.
83 * a non-negative number of work units just completed
85 public void worked(int work
);