public class ResourceQuantityEvent extends ResourcePropertyEvent
ResourceQuantityEvent
is fired by an IlvResource
both before and after its quantity is modified. Immediately before its
quantity is modified, an IlvResource
fires an
aboutToChange ResourceQuantityEvent
in all listeners
registered with the Gantt data model.
Listeners can modify or constrain the proposed quantity by invoking
setNewQuantity()
.
Alternatively, a listener can veto the proposed change by invoking
veto()
.
After its quantity is modified, an IlvResource
will fire a
changed ResourceQuantityEvent
in all listeners
registered with the Gantt data model. Listeners can access the old and new
values of the resource's quantity, but cannot modify them via the event
mechanism.
source
Constructor and Description |
---|
ResourceQuantityEvent(IlvResource resource,
float oldQuantity,
float newQuantity,
boolean aboutToChangeEvent)
Constructs a new
ResourceQuantityEvent generated
by the specified resource and with the specified old and new
quantity values. |
Modifier and Type | Method and Description |
---|---|
float |
getNewQuantity()
Returns the resource's new quantity.
|
float |
getOldQuantity()
Returns the resource's old quantity.
|
void |
setNewQuantity(float quantity)
Sets the resource's proposed new quantity.
|
getResource
getNewValue, getOldValue, isAboutToChangeEvent, isChangedEvent, isVetoed, setNewValue, veto
getSource, toString
public ResourceQuantityEvent(IlvResource resource, float oldQuantity, float newQuantity, boolean aboutToChangeEvent)
ResourceQuantityEvent
generated
by the specified resource and with the specified old and new
quantity values.resource
- the resource where the event originatedoldQuantity
- the resource's previous quantitynewQuantity
- the resource's new quantityaboutToChangeEvent
- true
if this is a
resourceQuantityAboutToChange
event or false
if
this is a resourceQuantityChanged
event.public float getOldQuantity()
resourceQuantityAboutToChange
event, then this will be the
same as the resource's current quantity since the change has not actually
occurred yet. If this is a resourceQuantityChanged
event, this
will be the resource's quantity prior to the current modification being
reported.public float getNewQuantity()
resourceQuantityAboutToChange
event, then this is will be
the resource's proposed value.
If this is a resourceQuantityChanged
event, this will be the resource's new quantity which is being reported.public void setNewQuantity(float quantity)
resourceQuantityAboutToChange
event. By using this
method, a listener can constrain changes to the resource's quantity.quantity
- The new quantity.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.