private void processChangeEvent
(ODOMObservable node, ODOMChangeEvent event) {
// Get the event source and node in typesafe form (we know the node
// is an element because we only listen on sources)
final ODOMObservable eventSrc = event.getSource();
final ODOMElement nodeEle = (ODOMElement)node;
// Switch on change type
if (event.getChangeQualifier() == ChangeQualifier.HIERARCHY) {
// Just delegate to attribute or element hierarchy event handler
if (eventSrc instanceof ODOMElement) {
processElementHierarchyEvent(nodeEle, event);
} else if (eventSrc instanceof ODOMAttribute) {
processAttribHierarchyEvent(event);
} else if (eventSrc instanceof ODOMText) {
processTextHierarchyEvent(event);
}
} else if (event.getChangeQualifier() == ChangeQualifier.NAME) {
// If the source is an element, check whether it's a target;
// otherwise ensure that target attributes can't change
if (eventSrc instanceof ODOMElement) {
if (sourceTargetPairs.isTargetElement((Element)eventSrc)) {
proxiedElementsUpdated(ProxyElementDetails.ELEMENT_NAMES);
}
} else if (eventSrc instanceof ODOMAttribute) {
// TODO: throw an IllegalStateException if a target attribute
// has changed name
}
} else if (event.getChangeQualifier() ==
ChangeQualifier.ATTRIBUTE_VALUE) {
// Does the attribute belong to a target, and is its name in the
// list of supported attributes - if so the proxy elements have
// been updated in a notifiable way
if (sourceTargetPairs.isTargetElement(eventSrc.getParent()) &&
proxyElementDetails.isAttributeName(eventSrc.getName())) {
proxiedElementsUpdated(ProxyElementDetails.ATTRIB_VALUES);
}
} else if (event.getChangeQualifier() ==
ChangeQualifier.TEXT) {
if (sourceTargetPairs.isTargetElement(eventSrc.getParent())) {
proxiedElementsUpdated(ProxyElementDetails.TEXT_VALUE);
}
}
}