public abstract class SharedData extends Object
get as well as set methods for use in
circumstances where an object might prefer not to be notified
when data has changed but would prefer instead to choose its
own time of checking for changed data.
An object interested in sharing data in could then get shared-out data in
one or both of two ways. It could call the get method for
the type of data that it is interested in, or it could register itself
with the SharedDataManager as a listener and get informed
when an event of the matching type is fired. As
a matter of course you'll probably want to support both types of data
sharing. If you do this, then when adding a set method you
should also consider having the set method call this class's
fireSharedDataChangedNotification to pass the request along
to SharedDataManager to notify any interested listeners rather
than having the burden of having the SharedDataManager fire
the event fall on the shoulders the caller of the set method.SharedDataManager| Constructor and Description |
|---|
SharedData(SharedDataManager m)
Creates a shared data instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
fireSharedDataChangedNotification(String propertyName,
Object oldValue,
Object newValue)
Asks the shared data manager to report a bound property update
to any registered listeners.
|
protected void |
fireSharedDataVetoableNotification(String propertyName,
Object oldValue,
Object newValue)
Asks the shared data manager to fire a vetoable change notification
to any registered listeners.
|
abstract void |
recycle() |
public SharedData(SharedDataManager m)
m - The manager for this shared data.protected void fireSharedDataChangedNotification(String propertyName, Object oldValue, Object newValue)
propertyName - The programmatic name of the property that was
changedoldValue - The old value of the propertynewValue - The new value of the propertySharedDataManager.fireSharedDataChangedNotification(java.lang.String, java.lang.Object, java.lang.Object)protected void fireSharedDataVetoableNotification(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException
propertyName - The programmatic name of the property that may
be changingoldValue - The old value of the propertynewValue - The new value of the propertyPropertyVetoExceptionSharedDataManager.fireSharedDataChangedNotification(java.lang.String, java.lang.Object, java.lang.Object)public abstract void recycle()
Copyright © 2003, 2023, Oracle and/or its affiliates.