]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.util/src/org/argeo/ArgeoMonitor.java
[maven-release-plugin] copy for tag argeo-commons-2.1.45
[lgpl/argeo-commons.git] / org.argeo.util / src / org / argeo / ArgeoMonitor.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 package org.argeo;
17
18 /**
19 * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without
20 * dependency to it.
21 *
22 * @deprecated use org.argeo.jcr.JcrMonitor instead
23 */
24 @Deprecated
25 public interface ArgeoMonitor {
26 /**
27 * Constant indicating an unknown amount of work.
28 */
29 public final static int UNKNOWN = -1;
30
31 /**
32 * Notifies that the main task is beginning. This must only be called once
33 * on a given progress monitor instance.
34 *
35 * @param name
36 * the name (or description) of the main task
37 * @param totalWork
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.
42 */
43 public void beginTask(String name, int totalWork);
44
45 /**
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).
49 */
50 public void done();
51
52 /**
53 * Returns whether cancelation of current operation has been requested.
54 * Long-running operations should poll to see if cancelation has been
55 * requested.
56 *
57 * @return <code>true</code> if cancellation has been requested, and
58 * <code>false</code> otherwise
59 * @see #setCanceled(boolean)
60 */
61 public boolean isCanceled();
62
63 /**
64 * Sets the cancel state to the given value.
65 *
66 * @param value
67 * <code>true</code> indicates that cancelation has been
68 * requested (but not necessarily acknowledged);
69 * <code>false</code> clears this flag
70 * @see #isCanceled()
71 */
72 public void setCanceled(boolean value);
73
74 /**
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.
78 *
79 * @param name
80 * the name (or description) of the main task
81 * @see #beginTask(java.lang.String, int)
82 */
83 public void setTaskName(String name);
84
85 /**
86 * Notifies that a subtask of the main task is beginning. Subtasks are
87 * optional; the main task might not have subtasks.
88 *
89 * @param name
90 * the name (or description) of the subtask
91 */
92 public void subTask(String name);
93
94 /**
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.
98 *
99 * @param work
100 * a non-negative number of work units just completed
101 */
102 public void worked(int work);
103
104 }