org.das2.system.ChangesSupport

Support class for encapsulating implementation of pendingChanges and mutator locks. PendingChanges are a way of notifying the bean and other clients using the bean that changes are coming to the bean. mutatorLock() is a way for a client to get exclusive, read-only access to a bean. This also sets the valueAdjusting property. See http://das2.org/wiki/index.php/Pending_changes (Wiki was lost, but may be recoverable.)

ChangesSupport( java.beans.PropertyChangeSupport pcs, Object parent )

if the propertyChangeSupport is provided, then change messages will be sent to it directly. If null, then one is created with the parent as the source.


PROP_PENDINGCHANGES


PROP_VALUEADJUSTING


addPropertyChangeListener

addPropertyChangeListener( java.beans.PropertyChangeListener listener ) → void

Parameters

listener - a PropertyChangeListener

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


changePerformed

changePerformed( Object client, Object lockObject ) → void

the change is complete, and as far as the client is concerned, the canvas is valid.

Parameters

client - the object that is mutating the bean.
lockObject - an object identifying the change.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getChangesPending

getChangesPending( ) → Map

return a map listing the pending changes. This is a thread-safe read-only copy.

Returns:

a map listing the pending changes.

See Also:

pendingChanges


[search for examples] [view on GitHub] [view on old javadoc] [view source]


isPendingChanges

isPendingChanges( ) → boolean

true if someone has registered a pending change.

Returns:

true if someone has registered a pending change.

[search for examples] [view on GitHub] [view on old javadoc] [view source]

isPendingChanges( Object lockObject ) → boolean

isValueAdjusting

isValueAdjusting( ) → boolean

true when the bean state is rapidly changing.

Returns:

true when the bean state is rapidly changing.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


mutatorLock

mutatorLock( ) → Lock

one client will have write access to the bean, and when unlock is called, a "valueAdjusting" property change event is fired. In the future, this will return null if the lock is already out, but for now, clients should check the valueIsAdjusting property.

Returns:

the lock or null.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


pendingChanges

pendingChanges( java.util.Map changes ) → void

return a list of all the pending changes. These are returned in a Map that goes from pending change to change manager.

Parameters

changes - a Map to which the changes will be added.

Returns:

void (returns nothing)

See Also:

getChangesPending


[search for examples] [view on GitHub] [view on old javadoc] [view source]


performingChange

performingChange( Object client, Object lockObject ) → void

performingChange tells that the change is about to be performed. This is a place holder in case we use a mutator lock, but currently does nothing. If the change has not been registered, it will be registered implicitly. This will increment the internal count of how many times the change ought to occur.

Parameters

client - the object that is mutating the bean.
lockObject - an object identifying the change.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


registerPendingChange

registerPendingChange( Object client, Object lockObject ) → void

the client knows a change will be coming, and the canvas' clients should know that its current state will change soon. Example pending changes would be:

Note, it is okay to call this multiple times for the same client and lock object.

Parameters

client - the object that will perform the change. This allows the canvas (and developers) identify who has registered the change.
lockObject - object identifying the change.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


removePropertyChangeListener

removePropertyChangeListener( java.beans.PropertyChangeListener listener ) → void

Parameters

listener - a PropertyChangeListener

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]