public interface Changeable
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
Modifier and Type | Method and Description |
---|---|
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.
|
void |
setDeferringChangeRequests(boolean isDeferring)
Specify whether change requests made by calls to requestChange()
should be executed immediately.
|
void addChangeListener(ChangeListener listener)
listener
- The listener to add.removeChangeListener(ChangeListener)
,
requestChange(ChangeRequest)
void executeChangeRequests()
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)
void setDeferringChangeRequests(boolean isDeferring)
isDeferring
- If true, defer change requests.addChangeListener(ChangeListener)
,
executeChangeRequests()
,
isDeferringChangeRequests()
,
requestChange(ChangeRequest)