org.jcreme.processing
Class BaseTaskActivityMonitor

java.lang.Object
  extended byorg.jcreme.processing.BaseTaskActivityMonitor
All Implemented Interfaces:
TaskActivityMonitor
Direct Known Subclasses:
RMITaskActivityMonitor

public class BaseTaskActivityMonitor
extends java.lang.Object
implements TaskActivityMonitor

This is a simple implementation of the TaskActivityMonitor interface. Objects of this class can be used to display information about how the task is doing.

Version:
$Revision: 1.2 $
Author:
$Author: dbregeon $

Field Summary
 
Fields inherited from interface org.jcreme.processing.TaskActivityMonitor
COMPLETION_PERCENTAGE_PROPERTY, END_DATE_PROPERTY, START_DATE_PROPERTY, TASK_NAME_PROPERTY
 
Constructor Summary
BaseTaskActivityMonitor()
          Creates new DefaultTaskActivityMonitor
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
          Fires a PropertyChangeEvent to the registered listener for an int property.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Fires a PropertyChangeEvent to the registered listener for an Object property.
 java.lang.Double getCompletionPercentage()
          Gives access to the completion percentage of the task.
 java.lang.Long getElapsedTime()
          Provides the elapsed time since the task started.
 java.util.Date getEndDate()
          Gives access to the task's completion date.
 java.util.Date getStartDate()
          Gives access to the date when the task started.
 java.lang.String getTaskName()
          Gives access to the task's name.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 void setCompletionPercentage(java.lang.Double value)
          Changes the completion percentage of the task.
 void setEndDate(java.util.Date value)
          Sets the end date of the task.
 void setStartDate(java.util.Date value)
          Sets the start date of the task.
 void setTaskName(java.lang.String value)
          Changes the name of the task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseTaskActivityMonitor

public BaseTaskActivityMonitor()
Creates new DefaultTaskActivityMonitor

Method Detail

getTaskName

public java.lang.String getTaskName()
Gives access to the task's name.

Specified by:
getTaskName in interface TaskActivityMonitor
Returns:
a name associated to the task.

setTaskName

public void setTaskName(java.lang.String value)
Changes the name of the task.

Parameters:
value - The name for the task.

getCompletionPercentage

public java.lang.Double getCompletionPercentage()
Gives access to the completion percentage of the task.

Specified by:
getCompletionPercentage in interface TaskActivityMonitor
Returns:
A percentage of completion for the task.

setCompletionPercentage

public void setCompletionPercentage(java.lang.Double value)
Changes the completion percentage of the task.

Parameters:
value - The new completion percentage for this task.

getStartDate

public java.util.Date getStartDate()
Gives access to the date when the task started.

Specified by:
getStartDate in interface TaskActivityMonitor
Returns:
the date when the task was started or null if the task has not started.

setStartDate

public void setStartDate(java.util.Date value)
Sets the start date of the task.

Parameters:
value - The start date.

getEndDate

public java.util.Date getEndDate()
Gives access to the task's completion date.

Specified by:
getEndDate in interface TaskActivityMonitor
Returns:
the date when the task was finished or null if the task is not finished.

setEndDate

public void setEndDate(java.util.Date value)
Sets the end date of the task.

Parameters:
value - The end date.

getElapsedTime

public java.lang.Long getElapsedTime()
Provides the elapsed time since the task started.

Specified by:
getElapsedTime in interface TaskActivityMonitor
Returns:
the difference between the start date and the end date. Null when the getStartDate method returns null. The difference between a newly created Date and the start date if the getEndDate method returns null and the getStartDate does not.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface TaskActivityMonitor
Parameters:
listener - a property change listener as defined by the beans conventions. It should at least be reported any change to the following properties: completionPercentage, startDate, endDate.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface TaskActivityMonitor
Parameters:
propertyName - the name of a property that the listener has to monitor.
listener - a property change listener as defined by the beans conventions.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface TaskActivityMonitor
Parameters:
listener - the listener that must be removed from the event diffusion list.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface TaskActivityMonitor
Parameters:
propertyName - the property for which changes won't be monitored anymore.
listener - the listener that must be removed from the event diffusion list for that property.

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
Fires a PropertyChangeEvent to the registered listener for an Object property.

Parameters:
propertyName - the property that was modified.
oldValue - the previous value for the property.
newValue - the new value for the property.

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  int oldValue,
                                  int newValue)
Fires a PropertyChangeEvent to the registered listener for an int property.

Parameters:
propertyName - the property that was modified.
oldValue - the previous value for the property.
newValue - the new value for the property.


Copyright 2006 null. All Rights Reserved.