Interface EventHandler
- All Known Implementing Classes:
DefaultEventHandler,FilteredHandler
public interface EventHandler
Handler of content change events. Used to decouple processing of changes
from the content diff logic that detects them.
As the content diff recurses down the content tree, it will call the
getChildHandler(String, NodeState, NodeState) method to
specialize the handler instance for each node under which changes are
detected. The other handler methods always apply to the properties
and direct children of the node for which that handler instance is
specialized. The handler is expected to keep track of contextual
information like the path or identifier of the current node based on
the sequence of those specialization calls.
The events belonging to this instance should be delivered before events to other instance deeper down the tree are delivered.
All names and paths passed to handler methods use unmapped Oak names.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled before the given before and after states are compared.@Nullable EventHandlergetChildHandler(String name, NodeState before, NodeState after) Returns a handler of events within the given child node, ornullif changes within that child are not to be processed.voidCalled after the given before and after states are compared.voidNotification for an added nodevoidnodeDeleted(String name, NodeState before) Notification for a deleted nodevoidNotification for a moved nodevoidnodeReordered(String destName, String name, NodeState reordered) Notification for a reordered nodevoidpropertyAdded(PropertyState after) Notification for an added propertyvoidpropertyChanged(PropertyState before, PropertyState after) Notification for a changed propertyvoidpropertyDeleted(PropertyState before) Notification for a deleted property
-
Method Details
-
enter
Called before the given before and after states are compared. The implementation can use this method to initialize any internal state needed for processing the results of the comparison.- Parameters:
before- before state, non-existent if this node was addedafter- after state, non-existent if this node was removed
-
leave
Called after the given before and after states are compared. The implementation can use this method to post-process information collected during the content diff.- Parameters:
before- before state, non-existent if this node was addedafter- after state, non-existent if this node was removed
-
getChildHandler
Returns a handler of events within the given child node, ornullif changes within that child are not to be processed.- Parameters:
name- name of the child nodebefore- before state of the child node, possibly non-existentafter- after state of the child node, possibly non-existent- Returns:
- handler of events within the child node, or
null
-
propertyAdded
Notification for an added property- Parameters:
after- added property
-
propertyChanged
Notification for a changed property- Parameters:
before- property before the changeafter- property after the change
-
propertyDeleted
Notification for a deleted property- Parameters:
before- deleted property
-
nodeAdded
Notification for an added node- Parameters:
name- name of the nodeafter- added node
-
nodeDeleted
Notification for a deleted node- Parameters:
name- name of the deleted nodebefore- deleted node
-
nodeMoved
Notification for a moved node- Parameters:
sourcePath- source of the moved nodename- name of the moved nodemoved- moved node
-
nodeReordered
Notification for a reordered node- Parameters:
destName- name of theorderBefore()destination nodename- name of the moved nodereordered- moved node
-