ilog.views.gantt.model
Class IlvAbstractActivity

java.lang.Object
  extended by ilog.views.gantt.model.IlvAbstractActivity
All Implemented Interfaces:
IlvActivity, IlvHierarchyNode, Serializable
Direct Known Subclasses:
IlvSimpleActivity, IlvTableActivity

public abstract class IlvAbstractActivity
extends Object
implements IlvActivity, Serializable

IlvAbstractActivity is the superclass of all IlvActivity implementations. It provides a basic framework of event and property support that can be used by all concrete subclasses. All activity events are routed to the Gantt data model where interested listeners can register. Activities do not handle listener subscription and notification directly. Subclasses should always use the fireEvent(ilog.views.gantt.event.ActivityEvent) methods to fire ActivityEvent events so that generated events will be routed properly.

Since:
JViews 5.5
See Also:
Serialized Form

Constructor Summary
IlvAbstractActivity()
          Creates a new IlvAbstractActivity.
 
Method Summary
protected  void fireEvent(ActivityEvent event)
          Fires an event from this activity.
protected  ActivityIDEvent fireIDAboutToChange(String newID)
          Fires an idAboutToChange event and returns the event after dispatching it to all listeners.
protected  void fireIDChanged(String oldID)
          Fires an idChanged event.
protected  ActivityNameEvent fireNameAboutToChange(String newName)
          Fires a nameAboutToChange event and returns the event after dispatching it to all listeners.
protected  void fireNameChanged(String oldName)
          Fires a nameChanged event.
protected  ActivityTimeIntervalEvent fireTimeIntervalAboutToChange(IlvTimeInterval newInterval)
          Fires a timeIntervalAboutToChange event and returns the event after dispatching it to all listeners.
protected  void fireTimeIntervalChanged(IlvTimeInterval oldInterval)
          Fires a timeIntervalChanged event.
 IlvUnaryPredicate getChildEventFilter()
          Returns a predicate that will be used to determine the events from this activity's children that should be dispatched to this activity's processChildEvent(ilog.views.gantt.event.ActivityEvent) method.
 IlvDuration getDuration()
          Returns the duration of the activity.
 Date getEndTime()
          Returns the end time of the activity.
protected  IlvGanttModel getGanttModel()
          Returns the data model that is managing this activity.
 Date getStartTime()
          Returns the start time of the activity.
protected  String paramString()
          Returns a parameter string that represents the state of this activity.
 void processChildEvent(ActivityEvent event)
          This method is invoked by the Gantt data model for any events fired by the children of this activity and for which the predicate returned by getChildEventFilter() evaluates to true.
 void setDuration(IlvDuration duration)
          Sets the duration of the activity.
 void setEndTime(Date t)
          Sets the end time of the activity.
 void setGanttModelImpl(IlvGanttModel model)
          This method is invoked by the IlvGanttModel when the activity is added or removed.
 void setStartTime(Date t)
          Sets the start time of the activity.
 void setTimeInterval(Date start, Date end)
          Sets the start time and end time of the activity.
 String toString()
          Returns a string representation of this activity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ilog.views.gantt.IlvActivity
getID, getName, getTimeInterval, setID, setName, setTimeInterval
 

Constructor Detail

IlvAbstractActivity

public IlvAbstractActivity()
Creates a new IlvAbstractActivity.

Method Detail

getGanttModel

protected IlvGanttModel getGanttModel()
Returns the data model that is managing this activity. This will be null if this activity has not been added to a data model yet.

Returns:
The Gantt data model managing the activity.

setGanttModelImpl

public void setGanttModelImpl(IlvGanttModel model)
This method is invoked by the IlvGanttModel when the activity is added or removed.

Warning: This method is considered to be part of an IlvActivity's internal implementation and is not a public API. You should only invoke this method directly if you have created your own IlvGanttModel implementation.

Specified by:
setGanttModelImpl in interface IlvActivity
Parameters:
model - The data model that this activity has been added to, or null if this activity has been removed from the data model.

fireEvent

protected final void fireEvent(ActivityEvent event)
Fires an event from this activity. Subclasses should always use this method to fire activity events because it properly routes the event. If the parent of the activity indicates, via the getChildEventFilter() method, that it is interested in the event, then the Gantt data model dispatches the event to the processChildEvent(ilog.views.gantt.event.ActivityEvent) method of the parent activity.

Parameters:
event - The activity event.

getChildEventFilter

public IlvUnaryPredicate getChildEventFilter()
Returns a predicate that will be used to determine the events from this activity's children that should be dispatched to this activity's processChildEvent(ilog.views.gantt.event.ActivityEvent) method. The Gantt data model applies the predicate to all ActivityEvent events fired by the children of this activity. If the predicate evaluates to true, the Gantt data model dispatches the child's event to the processChildEvent() method. This allows you to easily implement a parent activity property that is automatically computed from one or more properties of its children.

This default implementation returns a predicate that always evaluates to false, indicating that this activity should not receive any events from its children. Subclasses can override this method as needed.

Specified by:
getChildEventFilter in interface IlvActivity
Returns:
The predicate used to filter events from the activity's children.

processChildEvent

public void processChildEvent(ActivityEvent event)
This method is invoked by the Gantt data model for any events fired by the children of this activity and for which the predicate returned by getChildEventFilter() evaluates to true. This allows you to easily implement a parent activity property that is automatically computed from one or more properties of its children.

This default implementation does nothing. Subclasses can override this method as needed.

Specified by:
processChildEvent in interface IlvActivity
Parameters:
event - The child activity event.

fireIDAboutToChange

protected ActivityIDEvent fireIDAboutToChange(String newID)
Fires an idAboutToChange event and returns the event after dispatching it to all listeners.

Parameters:
newID - The new identifier proposed for the activity.
Returns:
The event after dispatching to all listeners.
See Also:
ActivityIDEvent

fireIDChanged

protected void fireIDChanged(String oldID)
Fires an idChanged event.

Parameters:
oldID - The previous identifier of the activity.
See Also:
ActivityIDEvent

fireNameAboutToChange

protected ActivityNameEvent fireNameAboutToChange(String newName)
Fires a nameAboutToChange event and returns the event after dispatching it to all listeners.

Parameters:
newName - The new name proposed for the activity.
Returns:
The event after dispatching to all listeners.
See Also:
ActivityNameEvent

fireNameChanged

protected void fireNameChanged(String oldName)
Fires a nameChanged event.

Parameters:
oldName - The previous name of the activity.
See Also:
ActivityNameEvent

fireTimeIntervalAboutToChange

protected ActivityTimeIntervalEvent fireTimeIntervalAboutToChange(IlvTimeInterval newInterval)
Fires a timeIntervalAboutToChange event and returns the event after dispatching it to all listeners.

Parameters:
newInterval - The new time interval proposed for the activity.
Returns:
The event after dispatching to all listeners.
See Also:
ActivityTimeIntervalEvent

fireTimeIntervalChanged

protected void fireTimeIntervalChanged(IlvTimeInterval oldInterval)
Fires a timeIntervalChanged event.

Parameters:
oldInterval - The previous time interval of the activity.
See Also:
ActivityTimeIntervalEvent

getStartTime

public Date getStartTime()
Returns the start time of the activity.

Specified by:
getStartTime in interface IlvActivity
Returns:
The activity start time.

setStartTime

public void setStartTime(Date t)
Sets the start time of the activity. The invariant is maintained whereby the start time must always be prior or equal to the end time. Therefore, if t > getEndTime(), t will actually become the new end time and the previous end time will become the new start time.

Specified by:
setStartTime in interface IlvActivity
Parameters:
t - The start time.

getEndTime

public Date getEndTime()
Returns the end time of the activity.

Specified by:
getEndTime in interface IlvActivity
Returns:
The activity end time.

setEndTime

public void setEndTime(Date t)
Sets the end time of the activity. The invariant is maintained whereby the start time must always be prior or equal to the end time. Therefore, if t < getStartTime(), t will actually become the new start time and the previous start time will become the new end time.

Specified by:
setEndTime in interface IlvActivity
Parameters:
t - The end time.

getDuration

public IlvDuration getDuration()
Returns the duration of the activity.

Returns:
The activity duration.

setDuration

public void setDuration(IlvDuration duration)
Sets the duration of the activity. The invariant is maintained whereby the start time must always be prior or equal to the end time. Therefore, if duration is negative, the previous start time will become the new end time.

Parameters:
duration - The duration.

setTimeInterval

public void setTimeInterval(Date start,
                            Date end)
Sets the start time and end time of the activity. The invariant is maintained whereby the start time must always be prior or equal to its end time. Therefore, if end < start, the values will be silently swapped and start will actually become the new end time while end will become the new start time.

Specified by:
setTimeInterval in interface IlvActivity
Parameters:
start - The start time.
end - The end time.

paramString

protected String paramString()
Returns a parameter string that represents the state of this activity.

Returns:
A string representing the status of the activity.

toString

public String toString()
Returns a string representation of this activity.

Overrides:
toString in class Object
Returns:
A string representing the activity.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.