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.Constructor and Description |
---|
IlvAbstractActivity()
Creates a new
IlvAbstractActivity . |
Modifier and Type | Method and Description |
---|---|
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<ActivityEvent> |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getID, getName, getTimeInterval, setID, setName, setTimeInterval
public IlvAbstractActivity()
IlvAbstractActivity
.protected IlvGanttModel getGanttModel()
null
if this activity has not been added to a
data model yet.public void setGanttModelImpl(IlvGanttModel model)
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.
setGanttModelImpl
in interface IlvActivity
model
- The data model that this activity has been added to, or
null
if this activity has been removed from the data model.protected final void fireEvent(ActivityEvent event)
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.event
- The activity event.public IlvUnaryPredicate<ActivityEvent> getChildEventFilter()
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.
getChildEventFilter
in interface IlvActivity
public void processChildEvent(ActivityEvent event)
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.
processChildEvent
in interface IlvActivity
event
- The child activity event.protected ActivityIDEvent fireIDAboutToChange(String newID)
idAboutToChange
event and returns the event after
dispatching it to all listeners.newID
- The new identifier proposed for the activity.ActivityIDEvent
protected void fireIDChanged(String oldID)
idChanged
event.oldID
- The previous identifier of the activity.ActivityIDEvent
protected ActivityNameEvent fireNameAboutToChange(String newName)
nameAboutToChange
event and returns the event after
dispatching it to all listeners.newName
- The new name proposed for the activity.ActivityNameEvent
protected void fireNameChanged(String oldName)
nameChanged
event.oldName
- The previous name of the activity.ActivityNameEvent
protected ActivityTimeIntervalEvent fireTimeIntervalAboutToChange(IlvTimeInterval newInterval)
timeIntervalAboutToChange
event and returns the event
after dispatching it to all listeners.newInterval
- The new time interval proposed for the activity.ActivityTimeIntervalEvent
protected void fireTimeIntervalChanged(IlvTimeInterval oldInterval)
timeIntervalChanged
event.oldInterval
- The previous time interval of the activity.ActivityTimeIntervalEvent
public Date getStartTime()
getStartTime
in interface IlvActivity
public void setStartTime(Date t)
t > getEndTime()
, t
will actually become the
new end time and the previous end time will become the new start
time.setStartTime
in interface IlvActivity
t
- The start time.public Date getEndTime()
getEndTime
in interface IlvActivity
public void setEndTime(Date t)
t < getStartTime()
, t
will actually become the
new start time and the previous start time will become the new
end time.setEndTime
in interface IlvActivity
t
- The end time.public IlvDuration getDuration()
public void setDuration(IlvDuration duration)
duration
is negative, the previous start time will become the
new end time.duration
- The duration.public void setTimeInterval(Date start, Date end)
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.setTimeInterval
in interface IlvActivity
start
- The start time.end
- The end time.protected String paramString()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.