]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.util/src/org/argeo/ArgeoMonitor.java
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without
22 * @deprecated use org.argeo.jcr.JcrMonitor instead
25 public interface ArgeoMonitor
{
27 * Constant indicating an unknown amount of work.
29 public final static int UNKNOWN
= -1;
32 * Notifies that the main task is beginning. This must only be called once
33 * on a given progress monitor instance.
36 * the name (or description) of the main task
38 * the total number of work units into which the main task is
39 * been subdivided. If the value is <code>UNKNOWN</code> the
40 * implementation is free to indicate progress in a way which
41 * doesn't require the total number of work units in advance.
43 public void beginTask(String name
, int totalWork
);
46 * Notifies that the work is done; that is, either the main task is
47 * completed or the user canceled it. This method may be called more than
48 * once (implementations should be prepared to handle this case).
53 * Returns whether cancelation of current operation has been requested.
54 * Long-running operations should poll to see if cancelation has been
57 * @return <code>true</code> if cancellation has been requested, and
58 * <code>false</code> otherwise
59 * @see #setCanceled(boolean)
61 public boolean isCanceled();
64 * Sets the cancel state to the given value.
67 * <code>true</code> indicates that cancelation has been
68 * requested (but not necessarily acknowledged);
69 * <code>false</code> clears this flag
72 public void setCanceled(boolean value
);
75 * Sets the task name to the given value. This method is used to restore the
76 * task label after a nested operation was executed. Normally there is no
77 * need for clients to call this method.
80 * the name (or description) of the main task
81 * @see #beginTask(java.lang.String, int)
83 public void setTaskName(String name
);
86 * Notifies that a subtask of the main task is beginning. Subtasks are
87 * optional; the main task might not have subtasks.
90 * the name (or description) of the subtask
92 public void subTask(String name
);
95 * Notifies that a given number of work unit of the main task has been
96 * completed. Note that this amount represents an installment, as opposed to
97 * a cumulative amount of work done to date.
100 * a non-negative number of work units just completed
102 public void worked(int work
);