|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Changeable
This is an interface for objects that support change requests that can be deferred. A change request is any modification to a model that might be performed during execution of the model, but where there might only be certain phases of execution during which it is safe to make the modification. Such changes are also called mutations.
A change request is typically made by instantiating a subclass of ChangeRequest (possibly using an anonymous inner class) and then passing it to the requestChange() method of an object implementing this interface. That object may delegate the request (for example, it might consolidate all such requests at the top level of the hierarchy by passing the request to its container). If it does delegate, then it is expected to consistently delegate all commands to the same object.
When a change request is made, if it is safe to do so, then an implementor of this interface is free to immediately execute the request, unless setDeferringChangeRequests(true) has been called. It is never safe to execute a change request if the implementor is already in the middle of executing a change request (that execution may have triggered the request).
ChangeRequest| Method Summary | |
|---|---|
void |
addChangeListener(ChangeListener listener)
Add a change listener. |
void |
executeChangeRequests()
Execute requested changes. |
boolean |
isDeferringChangeRequests()
Return true if setDeferringChangeRequests(true) has been called to specify that change requests should be deferred. |
void |
removeChangeListener(ChangeListener listener)
Remove a change listener, if it is present, and otherwise do nothing. |
void |
requestChange(ChangeRequest change)
Request that the given change be executed. |
boolean |
setDeferringChangeRequests(boolean isDeferring)
Specify whether change requests made by calls to requestChange() should be executed immediately. |
| Method Detail |
|---|
void addChangeListener(ChangeListener listener)
listener - The listener to add.removeChangeListener(ChangeListener),
requestChange(ChangeRequest)void executeChangeRequests()
addChangeListener(ChangeListener),
requestChange(ChangeRequest),
setDeferringChangeRequests(boolean)boolean isDeferringChangeRequests()
setDeferringChangeRequests(boolean)void removeChangeListener(ChangeListener listener)
listener - The listener to remove.addChangeListener(ChangeListener)void requestChange(ChangeRequest change)
change - The requested change.executeChangeRequests(),
setDeferringChangeRequests(boolean)boolean setDeferringChangeRequests(boolean isDeferring)
isDeferring - If true, defer change requests.
addChangeListener(ChangeListener),
executeChangeRequests(),
isDeferringChangeRequests(),
requestChange(ChangeRequest)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||