1 /***
2 * TaskActivityMonitor.java
3 *
4 * This file is part of the creme library.
5 * The creme library intends to ease the development effort of large
6 * applications by providing easy to use support classes.
7 *
8 * Copyright (C) 2002 Denis Bregeon
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * contact information: dbregeon@sourceforge.net
25 */
26 package org.jcreme.processing;
27
28 import java.beans.PropertyChangeListener;
29 import java.util.Date;
30
31 /***
32 * This interface describes an activity monitor. Objects of classes implementing
33 * this interface can then be used to display information about how the task is
34 * doing.
35 *
36 * @author $Author: dbregeon $
37 * @version $Revision: 1.2 $
38 */
39 public interface TaskActivityMonitor {
40 /***
41 * The name of the property for TaskName.
42 */
43 static final String TASK_NAME_PROPERTY = "TaskName";
44
45 /***
46 * The name of the property for CompletionPercentage.
47 */
48 static final String COMPLETION_PERCENTAGE_PROPERTY = "CompletionPercentage";
49
50 /***
51 * The name of the property for StartDate.
52 */
53 static final String START_DATE_PROPERTY = "StartDate";
54
55 /***
56 * The name of the property for EndDate.
57 */
58 static final String END_DATE_PROPERTY = "EndDate";
59
60 /***
61 * Gives access to the task's name.
62 *
63 * @return a name associated to the task.
64 */
65 String getTaskName();
66
67 /***
68 * Gives access to the completion percentage of the task.
69 *
70 * @return A percentage of completion for the task.
71 */
72 Double getCompletionPercentage();
73
74 /***
75 * Gives access to the date when the task started.
76 *
77 * @return the date when the task was started or null if the task has not
78 * started.
79 */
80 Date getStartDate();
81
82 /***
83 * Gives access to the task's completion date.
84 *
85 * @return the date when the task was finished or null if the task is not
86 * finished.
87 */
88 Date getEndDate();
89
90 /***
91 * Provides the elapsed time since the task started.
92 *
93 * @return the difference between the start date and the end date. Null when
94 * the getStartDate method returns null. The difference between a
95 * newly created Date and the start date if the getEndDate method
96 * returns null and the getStartDate does not.
97 */
98 Long getElapsedTime();
99
100 /***
101 * @param listener
102 * a property change listener as defined by the beans
103 * conventions. It should at least be reported any change to the
104 * following properties: completionPercentage, startDate,
105 * endDate.
106 */
107 void addPropertyChangeListener(PropertyChangeListener listener);
108
109 /***
110 * @param propertyName
111 * the name of a property that the listener has to monitor.
112 * @param listener
113 * a property change listener as defined by the beans
114 * conventions.
115 */
116 void addPropertyChangeListener(String propertyName,
117 PropertyChangeListener listener);
118
119 /***
120 * @param listener
121 * the listener that must be removed from the event diffusion
122 * list.
123 */
124 void removePropertyChangeListener(PropertyChangeListener listener);
125
126 /***
127 * @param propertyName
128 * the property for which changes won't be monitored anymore.
129 * @param listener
130 * the listener that must be removed from the event diffusion
131 * list for that property.
132 */
133 void removePropertyChangeListener(String propertyName,
134 PropertyChangeListener listener);
135 }
136