public abstract class IlvAbstractResource extends Object implements IlvResource, Serializable
IlvAbstractResource
is the superclass of all IlvResource
implementations. It provides a basic framework of event and property support
that can be used by all concrete subclasses. All resource events are routed
to the Gantt data model where interested listeners can register. Resources do
not handle listener subscription and notification directly. Subclasses should
always use the method fireEvent(ilog.views.gantt.event.ResourceEvent)
to fire ResourceEvent
instances so that generated events will be routed properly.Constructor and Description |
---|
IlvAbstractResource()
Creates a new
IlvAbstractResource . |
Modifier and Type | Method and Description |
---|---|
protected void |
fireEvent(ResourceEvent event)
Fires an event from this resource.
|
protected ResourceIDEvent |
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 ResourceNameEvent |
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 ResourceQuantityEvent |
fireQuantityAboutToChange(float newQuantity)
Fires a
quantityAboutToChange event and returns the event
after dispatching it to all listeners. |
protected void |
fireQuantityChanged(float oldQuantity)
Fires a
quantityChanged event. |
IlvUnaryPredicate<ResourceEvent> |
getChildEventFilter()
Returns a predicate that will be used to determine the events from this
resource's children that should be dispatched to this resource's
processChildEvent(ilog.views.gantt.event.ResourceEvent) method. |
protected IlvGanttModel |
getGanttModel()
Returns the data model that is managing this resource.
|
protected String |
paramString()
Returns a parameter string that represents the status of this resource.
|
void |
processChildEvent(ResourceEvent event)
This method is invoked by the
Gantt data model for
any events fired by the children of this resource and for which the
predicate returned by getChildEventFilter() evaluates to
true . |
void |
setGanttModelImpl(IlvGanttModel model)
This method is invoked by the
IlvGanttModel when the resource
is added or removed. |
String |
toString()
Returns a string representation of this resource.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getID, getName, getQuantity, setID, setName, setQuantity
public IlvAbstractResource()
IlvAbstractResource
.protected IlvGanttModel getGanttModel()
null
if this resource has not been added to a
data model yet.public void setGanttModelImpl(IlvGanttModel model)
IlvGanttModel
when the resource
is added or removed.
Warning: This method is considered to be part of an
IlvResource
'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 IlvResource
model
- The data model that this resource has been added to, or
null
if this resource has been removed from the data model.protected final void fireEvent(ResourceEvent 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.ResourceEvent)
method of the parent
resource.event
- The resource event.public IlvUnaryPredicate<ResourceEvent> getChildEventFilter()
processChildEvent(ilog.views.gantt.event.ResourceEvent)
method. The Gantt data
model
applies the predicate to all ResourceEvent
events fired by
the children of this resource. 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 resource 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 resource should not receive any
events from its children. Subclasses can override this method as needed.
getChildEventFilter
in interface IlvResource
public void processChildEvent(ResourceEvent event)
Gantt data model
for
any events fired by the children of this resource and for which the
predicate returned by getChildEventFilter()
evaluates to
true
.
This allows you to easily implement a parent resource 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 IlvResource
event
- The child resource event.protected ResourceIDEvent fireIDAboutToChange(String newID)
idAboutToChange
event and returns the event after
dispatching it to all listeners.newID
- The new identifier proposed for the resource.ResourceIDEvent
protected void fireIDChanged(String oldID)
idChanged
event.oldID
- The previous identifier of the resource.ResourceIDEvent
protected ResourceNameEvent fireNameAboutToChange(String newName)
nameAboutToChange
event and returns the event after
dispatching it to all listeners.newName
- The new name proposed for the resource.ResourceNameEvent
protected void fireNameChanged(String oldName)
nameChanged
event.oldName
- The previous name of the resource.ResourceNameEvent
protected ResourceQuantityEvent fireQuantityAboutToChange(float newQuantity)
quantityAboutToChange
event and returns the event
after dispatching it to all listeners.newQuantity
- The new quantity proposed for the resource.ResourceQuantityEvent
protected void fireQuantityChanged(float oldQuantity)
quantityChanged
event.oldQuantity
- The previous resource quantity.ResourceQuantityEvent
protected String paramString()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.