public class IlvBasicFilterGanttModel extends IlvFilterGanttModel
IlvBasicFilterGanttModel
provides a filtered view of an underlying
data model's activities and resources. The activity and resource filters are specified
by providing implementations of the IlvFilter
interface.
IlvBasicFilterGanttModel
does not support activities or resources
that are moved within the hierarchy of the data model. The model will throw
an UnsupportedOperationException
in this case. Instead, remove and then re-add
the activity or resource and all of its children at the new position in the hierarchy.
IlvFilterGanttModel.ActivityEventHandler, IlvFilterGanttModel.ActivityHierarchyEventHandler, IlvFilterGanttModel.ConstraintEventHandler, IlvFilterGanttModel.GanttModelPropertyEventHandler, IlvFilterGanttModel.ReservationEventHandler, IlvFilterGanttModel.ResourceEventHandler, IlvFilterGanttModel.ResourceHierarchyEventHandler
ADJUSTING_PROPERTY, BATCHING_PROPERTY
Constructor and Description |
---|
IlvBasicFilterGanttModel()
Creates a new filtering model with no filters and no filtered model specified.
|
IlvBasicFilterGanttModel(IlvGanttModel filteredModel)
Creates a new filtering model that encapsulates the specified filtered
model.
|
IlvBasicFilterGanttModel(IlvGanttModel filteredModel,
IlvFilter<IlvActivity> activityFilter,
IlvFilter<IlvResource> resourceFilter)
Creates a new filtering model that encapsulates the specified filtered
model.
|
Modifier and Type | Method and Description |
---|---|
void |
addActivity(IlvActivity newActivity,
IlvActivity parent,
int index)
Adds
newActivity as a child of parent activity
at the specified location in its list of child activities. |
void |
addResource(IlvResource newResource,
IlvResource parent,
int index)
Adds
newResource as a child of the parent
resource at the specified location in its list of child resources. |
Iterator<IlvConstraint> |
constraintIterator()
Returns an iterator over all the constraints in the data model.
|
Iterator<IlvConstraint> |
constraintIteratorFromActivity(IlvActivity fromActivity)
Returns an iterator over the constraints in the data model that have the
specified activity as their source or from activity.
|
Iterator<IlvConstraint> |
constraintIteratorToActivity(IlvActivity toActivity)
Returns an iterator over the constraints in the data model that have the
specified activity as their target or to activity.
|
boolean |
contains(IlvConstraint constraint)
Returns whether the specified constraint is a member of the data model.
|
boolean |
contains(IlvHierarchyNode activityOrResource)
Returns whether the specified activity or resource is a member of the
data model.
|
boolean |
contains(IlvReservation reservation)
Returns whether the specified reservation is a member of the data model.
|
protected ActivityListener |
createActivityEventHandler()
Returns the event listener that will be used to handle
activity events fired by the filtered model that
this data model encapsulates.
|
protected ActivityHierarchyListener |
createActivityHierarchyEventHandler()
Returns the event listener that will be used to handle
activity hierarchy events fired by the
filtered model that this data model encapsulates.
|
protected ConstraintListener |
createConstraintEventHandler()
Returns the event listener that will be used to handle
constraint events fired by the filtered model that
this data model encapsulates.
|
protected ReservationListener |
createReservationEventHandler()
Returns the event listener that will be used to handle
reservation events fired by the filtered model that
this data model encapsulates.
|
protected ResourceListener |
createResourceEventHandler()
Returns the event listener that will be used to handle
resource events fired by the filtered model that
this data model encapsulates.
|
protected ResourceHierarchyListener |
createResourceHierarchyEventHandler()
Returns the event listener that will be used to handle
resource hierarchy events fired by the
filtered model that this data model encapsulates.
|
IlvFilter<IlvActivity> |
getActivityFilter()
Returns the activity filter set on the encapsulated
data model.
|
IlvActivity |
getChildActivity(IlvActivity parent,
int index)
Returns the child of the specified parent activity at index
index . |
int |
getChildActivityCount(IlvActivity parent)
Returns the number of children of the specified parent activity.
|
int |
getChildActivityIndex(IlvActivity parent,
IlvActivity child)
Returns the index of the specified child in the parent activity's list
of children.
|
IlvResource |
getChildResource(IlvResource parent,
int index)
Returns the child of the specified parent resource at index
index . |
int |
getChildResourceCount(IlvResource parent)
Returns the number of children of the specified parent resource.
|
int |
getChildResourceIndex(IlvResource parent,
IlvResource child)
Returns the index of the specified child in the parent resource's list
of children.
|
int |
getParentActivityIndex(IlvActivity activity)
Returns the index of the specified activity within its parent activity.
|
int |
getParentResourceIndex(IlvResource resource)
Returns the index of the specified resource within its parent resource.
|
IlvFilter<IlvResource> |
getResourceFilter()
Returns the resource filter set on the encapsulated
data model.
|
IlvActivity |
getRootActivity()
Returns the root activity of the data model, or
null if the
data model contains no activities. |
IlvResource |
getRootResource()
Returns the root resource of the data model, or
null if the
data model contains no resources. |
void |
moveActivity(IlvActivity activity,
IlvActivity newParent,
int newIndex)
This method throws an
UnsupportedOperationException because
IlvBasicFilterGanttModel does not support activities that are moved
within the hierarchy. |
void |
moveResource(IlvResource resource,
IlvResource newParent,
int newIndex)
This method throws an
UnsupportedOperationException because
IlvBasicFilterGanttModel does not support resources that are moved
within the hierarchy. |
void |
removeActivity(IlvActivity activity)
Removes the specified child
activity from its parent. |
void |
removeActivity(IlvActivity parent,
int index)
Removes the child activity from
parent that is at the
specified location in its list of child activities. |
void |
removeResource(IlvResource resource)
Removes the specified child
resource from its parent. |
void |
removeResource(IlvResource parent,
int index)
Removes the child resource from
parent that is at the
specified location in its list of child resources. |
Iterator<IlvReservation> |
reservationIterator()
Returns an iterator over all the reservations in the data model.
|
Iterator<IlvReservation> |
reservationIterator(IlvActivity activity)
Returns an iterator over all the reservations in the data model
that are associated with the specified activity.
|
Iterator<IlvReservation> |
reservationIterator(IlvResource resource)
Returns an iterator over all the reservations in the data model
that are associated with the specified resource.
|
Iterator<IlvReservation> |
reservationIterator(IlvResource resource,
IlvTimeInterval interval)
Returns an iterator over all the reservations in the data model
that are associated with the specified resource and where the assigned
activity intersects the specified time interval.
|
void |
setActivityFilter(IlvFilter<IlvActivity> filter)
Sets the specified activity filter on the encapsulated
data model.
|
void |
setFilteredModel(IlvGanttModel model)
Sets the filtered model that this model encapsulates.
|
void |
setResourceFilter(IlvFilter<IlvResource> filter)
Sets the specified resource filter on the encapsulated
data model.
|
addConstraint, addReservation, createGanttModelPropertyEventHandler, fireActivityEvent, fireResourceEvent, getFilteredModel, getParentActivity, getParentResource, isAdjusting, isBatching, removeConstraint, removeReservation, setAdjusting, setBatching, setRootActivity, setRootResource
activityPreorderIterator, activityPreorderIterator, addActivity, addActivityHierarchyListener, addActivityListener, addConstraintListener, addGanttModelPropertyListener, addReservationListener, addResource, addResourceHierarchyListener, addResourceListener, childActivityIterator, childResourceIterator, clear, fireActivitiesInserted, fireActivitiesInserted, fireActivitiesRemoved, fireActivitiesRemoved, fireActivityInserted, fireActivityMoved, fireActivityRemoved, fireConstraintEvent, fireConstraintInserted, fireConstraintRemoved, fireConstraintRemoved, fireGanttModelPropertyEvent, fireReservationEvent, fireReservationInserted, fireReservationRemoved, fireReservationRemoved, fireResourceInserted, fireResourceMoved, fireResourceRemoved, fireResourcesInserted, fireResourcesInserted, fireResourcesRemoved, fireResourcesRemoved, getActivityHierarchyListeners, getActivityListeners, getChild, getChildCount, getChildIndex, getParent, getParentIndex, getResourceHierarchyListeners, getResourceListeners, registerEventListener, removeActivityHierarchyListener, removeActivityListener, removeConstraintListener, removeGanttModelPropertyListener, removeReservationListener, removeResourceHierarchyListener, removeResourceListener, resourcePreorderIterator, resourcePreorderIterator, writeEventListeners
public IlvBasicFilterGanttModel()
setActivityFilter(ilog.views.util.filter.IlvFilter<ilog.views.gantt.IlvActivity>)
and setResourceFilter(ilog.views.util.filter.IlvFilter<ilog.views.gantt.IlvResource>)
to set the activity and
resource filters, respectively. Call setFilteredModel(ilog.views.gantt.IlvGanttModel)
to specify the
encapsulated filtered model.public IlvBasicFilterGanttModel(IlvGanttModel filteredModel)
setActivityFilter(ilog.views.util.filter.IlvFilter<ilog.views.gantt.IlvActivity>)
and setResourceFilter(ilog.views.util.filter.IlvFilter<ilog.views.gantt.IlvResource>)
to set the
activity and resource filters, respectively.filteredModel
- The model that this filtering model encapsulates. If
null
, then you will need to call setFilteredModel(ilog.views.gantt.IlvGanttModel)
to specify
the filtered model.public IlvBasicFilterGanttModel(IlvGanttModel filteredModel, IlvFilter<IlvActivity> activityFilter, IlvFilter<IlvResource> resourceFilter)
filteredModel
- The model that this filtering model encapsulates. If
null
, then you will need to call setFilteredModel(ilog.views.gantt.IlvGanttModel)
to specify
the filtered model.activityFilter
- The activity filter or null
.resourceFilter
- The resource filter or null
.public void setFilteredModel(IlvGanttModel model)
setFilteredModel
in class IlvFilterGanttModel
model
- The data model that this model encapsulates.IlvFilterGanttModel.getFilteredModel()
public boolean contains(IlvHierarchyNode activityOrResource)
contains
in interface IlvGanttModel
contains
in class IlvFilterGanttModel
activityOrResource
- The activity or resource.public IlvFilter<IlvActivity> getActivityFilter()
null
if there is no filter set.public void setActivityFilter(IlvFilter<IlvActivity> filter)
filter
- The activity filter or null
.public IlvActivity getRootActivity()
null
if the
data model contains no activities.getRootActivity
in interface IlvGanttModel
getRootActivity
in class IlvFilterGanttModel
null
.public int getParentActivityIndex(IlvActivity activity)
-1
is
returned.getParentActivityIndex
in interface IlvGanttModel
getParentActivityIndex
in class IlvFilterGanttModel
activity
- The activity.public int getChildActivityCount(IlvActivity parent)
getChildActivityCount
in interface IlvGanttModel
getChildActivityCount
in class IlvFilterGanttModel
parent
- The parent activity.public IlvActivity getChildActivity(IlvActivity parent, int index)
index
.getChildActivity
in interface IlvGanttModel
getChildActivity
in class IlvFilterGanttModel
parent
- The parent activity.index
- The child index.index
.public int getChildActivityIndex(IlvActivity parent, IlvActivity child)
getChildActivityIndex
in interface IlvGanttModel
getChildActivityIndex
in class IlvFilterGanttModel
parent
- The parent activity.child
- The child activity to find the index of.-1
if the
activity is not a child of parent
.public void addActivity(IlvActivity newActivity, IlvActivity parent, int index)
newActivity
as a child of parent
activity
at the specified location in its list of child activities. The current
child activity at index index
and any subsequent activities
are shifted to the right by having their indices incremented. After the
activity has been added, the data model will fire an
ActivitiesInsertedEvent
.addActivity
in interface IlvGanttModel
addActivity
in class IlvFilterGanttModel
newActivity
- The activity to add.parent
- The parent activity to which newActivity
is
added.index
- The location within the parent activity's list of children to
insert the new activity.
If index >= getChildActivityCount(parent)
,
then newActivity
is appended as the last child of
parent
.ActivityHierarchyListener.activitiesInserted(ilog.views.gantt.event.ActivitiesInsertedEvent)
public void removeActivity(IlvActivity activity)
activity
from its parent. All
constraints and reservations associated with the activity and its children
are also removed from the data model. After the activity has been removed,
the data model will first fire ConstraintRemovedEvent
s and
ReservationRemovedEvent
s for each removed constraint and
reservation. The removingActivity
property of these events
will be true
. Then, the data model will fire an
ActivitiesRemovedEvent
.
This method cannot be used to remove the data model's root activity. Use
setRootActivity(null)
for that purpose.removeActivity
in interface IlvGanttModel
removeActivity
in class IlvFilterGanttModel
activity
- The activity to remove. It must be a member of this data
model, but cannot be the root activity.ActivityHierarchyListener.activitiesRemoved(ilog.views.gantt.event.ActivitiesRemovedEvent)
public void removeActivity(IlvActivity parent, int index)
parent
that is at the
specified location in its list of child activities. Any subsequent child
activities are shifted to the left by having their indices decremented.
All constraints and reservations associated with the child activity and
its children are also removed from the data model. After the
activity has been removed, the data model will first fire
ConstraintRemovedEvent
s and ReservationRemovedEvent
s for
each removed constraint and reservation. The removingActivity
property of these events will be true
. Then, the data model
will fire an ActivitiesRemovedEvent
.removeActivity
in interface IlvGanttModel
removeActivity
in class IlvFilterGanttModel
parent
- The parent activity from which to remove the child activity.index
- The location within parent
's list of children to
remove the child activity.ActivityHierarchyListener.activitiesRemoved(ilog.views.gantt.event.ActivitiesRemovedEvent)
public void moveActivity(IlvActivity activity, IlvActivity newParent, int newIndex)
UnsupportedOperationException
because
IlvBasicFilterGanttModel
does not support activities that are moved
within the hierarchy. Instead, remove and then re-add the activity and all of its
children at the new position in the hierarchy.moveActivity
in interface IlvGanttModel
moveActivity
in class IlvFilterGanttModel
activity
- The activity to move. It must be a member of the data model, but
cannot be the root activity.newParent
- The parent activity to which activity
will be made a
child. It must be a member of the data model.newIndex
- The location within newParent
's list of children into
which activity
will be inserted. If newIndex
>= getChildActivityCount(newParent)
, then
activity
will be appended as the last child of
newParent
.ActivityHierarchyListener.activityMoved(ilog.views.gantt.event.ActivityMovedEvent)
protected ActivityListener createActivityEventHandler()
createActivityEventHandler
in class IlvFilterGanttModel
protected ActivityHierarchyListener createActivityHierarchyEventHandler()
createActivityHierarchyEventHandler
in class IlvFilterGanttModel
public IlvFilter<IlvResource> getResourceFilter()
null
if there is no filter set.public void setResourceFilter(IlvFilter<IlvResource> filter)
filter
- The resource filter or null
.public IlvResource getRootResource()
null
if the
data model contains no resources.getRootResource
in interface IlvGanttModel
getRootResource
in class IlvFilterGanttModel
null
.public int getParentResourceIndex(IlvResource resource)
-1
is
returned.getParentResourceIndex
in interface IlvGanttModel
getParentResourceIndex
in class IlvFilterGanttModel
resource
- The resource.public int getChildResourceCount(IlvResource parent)
getChildResourceCount
in interface IlvGanttModel
getChildResourceCount
in class IlvFilterGanttModel
parent
- The parent resource.public IlvResource getChildResource(IlvResource parent, int index)
index
.getChildResource
in interface IlvGanttModel
getChildResource
in class IlvFilterGanttModel
parent
- The parent resource.index
- The child index.index
.public int getChildResourceIndex(IlvResource parent, IlvResource child)
getChildResourceIndex
in interface IlvGanttModel
getChildResourceIndex
in class IlvFilterGanttModel
parent
- The parent resource.child
- The child resource to find the index of.-1
if the
resource is not a child of parent
.public void addResource(IlvResource newResource, IlvResource parent, int index)
newResource
as a child of the parent
resource at the specified location in its list of child resources. The
current child resource at index index
and any subsequent
resources are shifted to the right by having their indices incremented.
After the resource has been added, the data model will fire a
ResourcesInsertedEvent
.addResource
in interface IlvGanttModel
addResource
in class IlvFilterGanttModel
newResource
- The resource to add.parent
- The parent resource to which newResource
is
added.index
- The location within the parent resource's list of children
into which to insert the new resource.
If index >= parent.getChildCount()
then newResource
is appended as the last child of
parent
.ResourceHierarchyListener.resourcesInserted(ilog.views.gantt.event.ResourcesInsertedEvent)
public void removeResource(IlvResource resource)
resource
from its parent. All
reservations associated with the resource and its children are also
removed from the data model. After the resource has been removed, the data
model will first fire ReservationRemovedEvent
s for each removed
reservation. The removingResource
property of these events will be true
.
Then, the data model will fire a ResourcesRemovedEvent
. This
method cannot be used to remove the data model's root resource.
Use setRootResource(null)
for that purpose.removeResource
in interface IlvGanttModel
removeResource
in class IlvFilterGanttModel
resource
- The resource to remove. It must be a member of this data
model, but cannot be the root resource.ResourceHierarchyListener.resourcesRemoved(ilog.views.gantt.event.ResourcesRemovedEvent)
public void removeResource(IlvResource parent, int index)
parent
that is at the
specified location in its list of child resources. Any subsequent child
resources are shifted to the left by having their indices decremented.
All reservations associated with the child resource and its
children are also removed from the data model. After the resource has been
removed, the data model will first fire ReservationRemovedEvent
s
for each removed reservation.
The removingResource
property of these events will be true
. Then, the data model
will fire a ResourcesRemovedEvent
.removeResource
in interface IlvGanttModel
removeResource
in class IlvFilterGanttModel
parent
- The parent resource from which to remove the child resource.index
- The location within parent
's list of children
from which to remove the child resource.ResourceHierarchyListener.resourcesRemoved(ilog.views.gantt.event.ResourcesRemovedEvent)
public void moveResource(IlvResource resource, IlvResource newParent, int newIndex)
UnsupportedOperationException
because
IlvBasicFilterGanttModel
does not support resources that are moved
within the hierarchy. Instead, remove and then re-add the resource and all of its
children at the new position in the hierarchy.moveResource
in interface IlvGanttModel
moveResource
in class IlvFilterGanttModel
resource
- The resource to move. It must be a member of the data model, but
cannot be the root resource.newParent
- The parent resource to which resource
will be made a
child. It must be a member of the data model.newIndex
- The location within newParent
's list of children into
which resource
will be inserted. If newIndex
>= getChildResourceCount(newParent)
, then
resource
will be appended as the last child of
newParent
.ResourceHierarchyListener.resourceMoved(ilog.views.gantt.event.ResourceMovedEvent)
protected ResourceListener createResourceEventHandler()
createResourceEventHandler
in class IlvFilterGanttModel
protected ResourceHierarchyListener createResourceHierarchyEventHandler()
createResourceHierarchyEventHandler
in class IlvFilterGanttModel
public boolean contains(IlvConstraint constraint)
contains
in interface IlvGanttModel
contains
in class IlvFilterGanttModel
constraint
- The constraint.public Iterator<IlvConstraint> constraintIterator()
constraintIterator
in interface IlvGanttModel
constraintIterator
in class IlvFilterGanttModel
public Iterator<IlvConstraint> constraintIteratorFromActivity(IlvActivity fromActivity)
constraintIteratorFromActivity
in interface IlvGanttModel
constraintIteratorFromActivity
in class IlvFilterGanttModel
fromActivity
- The from activity.public Iterator<IlvConstraint> constraintIteratorToActivity(IlvActivity toActivity)
constraintIteratorToActivity
in interface IlvGanttModel
constraintIteratorToActivity
in class IlvFilterGanttModel
toActivity
- The to activity.protected ConstraintListener createConstraintEventHandler()
createConstraintEventHandler
in class IlvFilterGanttModel
public boolean contains(IlvReservation reservation)
contains
in interface IlvGanttModel
contains
in class IlvFilterGanttModel
reservation
- The reservation.public Iterator<IlvReservation> reservationIterator()
reservationIterator
in interface IlvGanttModel
reservationIterator
in class IlvFilterGanttModel
public Iterator<IlvReservation> reservationIterator(IlvActivity activity)
reservationIterator
in interface IlvGanttModel
reservationIterator
in class IlvFilterGanttModel
activity
- The activity.public Iterator<IlvReservation> reservationIterator(IlvResource resource)
reservationIterator
in interface IlvGanttModel
reservationIterator
in class IlvFilterGanttModel
resource
- The resource.public Iterator<IlvReservation> reservationIterator(IlvResource resource, IlvTimeInterval interval)
interval
by evaluating
anActivity.getTimeInterval().overlaps(interval)
.reservationIterator
in interface IlvGanttModel
reservationIterator
in class IlvFilterGanttModel
resource
- The resource.interval
- The activity time interval of interest.IlvActivity.getTimeInterval()
protected ReservationListener createReservationEventHandler()
createReservationEventHandler
in class IlvFilterGanttModel
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.