public class IlvSimpleActivity extends IlvAbstractActivity
IlvSimpleActivity
is a relatively simple, memory-based
implementation of the IlvActivity
interface that can be
extended in a straightforward manner for more complex needs.
IlvSimpleActivity
does not provide any connection to a
persistent datastore itself.Constructor and Description |
---|
IlvSimpleActivity(String id,
String name,
Date start,
Date end)
Creates a new
IlvSimpleActivity from the specified ID,
name, and time interval. |
IlvSimpleActivity(String id,
String name,
Date start,
IlvDuration duration)
Creates a new
IlvSimpleActivity from the specified ID,
name, start time, and duration. |
IlvSimpleActivity(String id,
String name,
IlvTimeInterval interval)
Creates a new
IlvSimpleActivity from the specified ID,
name, and time interval. |
Modifier and Type | Method and Description |
---|---|
protected IlvTimeInterval |
computeTimeIntervalFromChildren()
Calculates this activity's time interval from its children.
|
boolean |
getAutoCalcTimeIntervalFromChildren()
Returns whether this activity, if it has children, automatically calculates
its time interval from its children.
|
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. |
String |
getID()
Returns the ID string of the activity.
|
String |
getName()
Returns the name of the activity.
|
IlvTimeInterval |
getTimeInterval()
Returns the time span between the start time and end time of the activity
as an interval.
|
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 |
setAutoCalcTimeIntervalFromChildren(boolean flag)
Sets whether this activity, if it has children, will automatically
calculate its time interval from its children.
|
void |
setGanttModelImpl(IlvGanttModel model)
This method is invoked by
IlvGanttModel when the activity
is added or removed. |
void |
setID(String id)
Sets the ID string of the activity.
|
void |
setName(String name)
Sets the name of the activity.
|
void |
setTimeInterval(IlvTimeInterval interval)
Sets the start time and end time of the activity.
|
protected void |
updateTimeInterval(IlvTimeInterval newInterval)
Updates the start time and end time of the activity, as a result of an
automatic computation.
|
fireEvent, fireIDAboutToChange, fireIDChanged, fireNameAboutToChange, fireNameChanged, fireTimeIntervalAboutToChange, fireTimeIntervalChanged, getDuration, getEndTime, getGanttModel, getStartTime, paramString, setDuration, setEndTime, setStartTime, setTimeInterval, toString
public IlvSimpleActivity(String id, String name, IlvTimeInterval interval)
IlvSimpleActivity
from the specified ID,
name, and time interval.public IlvSimpleActivity(String id, String name, Date start, Date end)
IlvSimpleActivity
from the specified ID,
name, and time interval.public IlvSimpleActivity(String id, String name, Date start, IlvDuration duration)
IlvSimpleActivity
from the specified ID,
name, start time, and duration.public String getID()
public void setID(String id)
id
- The activity's ID string.public String getName()
public void setName(String name)
name
- A descriptive name for this activity.public IlvTimeInterval getTimeInterval()
public void setTimeInterval(IlvTimeInterval interval)
interval
- The start and end times.protected void updateTimeInterval(IlvTimeInterval newInterval)
setTimeInterval(IlvTimeInterval)
, except that here the listeners
cannot veto the change nor modify the new interval.newInterval
- The start and end times.public boolean getAutoCalcTimeIntervalFromChildren()
public void setAutoCalcTimeIntervalFromChildren(boolean flag)
protected IlvTimeInterval computeTimeIntervalFromChildren()
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
, then 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.
If this activity
automatically calculates its
time interval from its children
, then a predicate that asks to receive
ActivityTimeIntervalEvent
s from this activity's children is
returned. Otherwise, a predicate that always evaluates to
false
is returned.
getChildEventFilter
in interface IlvActivity
getChildEventFilter
in class IlvAbstractActivity
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.processChildEvent
in interface IlvActivity
processChildEvent
in class IlvAbstractActivity
event
- The child activity event.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
setGanttModelImpl
in class IlvAbstractActivity
model
- The data model that this activity has been added to, or
null
if this activity has been removed from the data model.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.