public abstract class IlvPropertyEvent extends EventObject
IlvPropertyEvent
is an abstract class that can be used to represent
both aboutToChange and changed events for arbitrary object
properties. Basic support is provided for storing the property old and new
values, along with veto capabilities for aboutToChange events.
Concrete subclasses should provide typesafe accessors for the property values.
For example:
class FooEvent extends IlvPropertyEvent { public FooEvent(Object source, Foo oldVal, Foo newVal, boolean aboutToChangeEvent) { super(source, oldVal, newVal, aboutToChangeEvent); } public Foo getOldFoo() { return (Foo)getOldValue(); } public Foo getNewFoo() { return (Foo)getNewValue(); } public void setNewFoo(Foo newVal) { setNewValue(newVal); } }
source
Constructor and Description |
---|
IlvPropertyEvent(Object source,
Object oldValue,
Object newValue,
boolean aboutToChangeEvent)
Creates a new
IlvPropertyEvent generated by the
specified source object. |
Modifier and Type | Method and Description |
---|---|
protected Object |
getNewValue()
Returns the new value of the property.
|
protected Object |
getOldValue()
Returns the old value of the property.
|
boolean |
isAboutToChangeEvent()
Returns whether this is a property aboutToChange event.
|
boolean |
isChangedEvent()
Returns whether this is a property changed event.
|
boolean |
isVetoed()
Returns whether the property aboutToChange event has been
vetoed.
|
protected void |
setNewValue(Object newValue)
Sets the proposed new value of the property.
|
void |
veto()
Vetoes the property aboutToChange event.
|
getSource, toString
public IlvPropertyEvent(Object source, Object oldValue, Object newValue, boolean aboutToChangeEvent)
IlvPropertyEvent
generated by the
specified source object.source
- Where the event originated.oldValue
- The previous value of the property.newValue
- The new value of the property.aboutToChangeEvent
- true
if this is a property
aboutToChange event or false
if this is a property
changed event.protected Object getOldValue()
protected Object getNewValue()
protected void setNewValue(Object newValue)
newValue
- The new value of the property.public final boolean isAboutToChangeEvent()
public final boolean isChangedEvent()
public boolean isVetoed()
true
if the event was explicitly vetoed via
veto
or the proposed new value of the property has been
constrained to equal its previous value.veto()
public void veto()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.