*/
protected AbstractEvent[] getRetargettedEvents(NodeEventTarget target,
NodeEventTarget[] ancestors,
AbstractEvent e) {
boolean singleScope = isSingleScopeEvent(e);
AbstractNode targetNode = (AbstractNode) target;
AbstractEvent[] es = new AbstractEvent[ancestors.length];
if (ancestors.length > 0) {
int index = ancestors.length - 1;
Node boundElement = targetNode.getXblBoundElement();
AbstractNode ancestorNode = (AbstractNode) ancestors[index];
if (!singleScope &&
ancestorNode.getXblBoundElement() != boundElement) {
es[index] = retargetEvent(e, ancestors[index]);
} else {
es[index] = e;
}
while (--index >= 0) {
ancestorNode = (AbstractNode) ancestors[index + 1];
boundElement = ancestorNode.getXblBoundElement();
AbstractNode nextAncestorNode = (AbstractNode) ancestors[index];
Node nextBoundElement = nextAncestorNode.getXblBoundElement();
if (!singleScope && nextBoundElement != boundElement) {
es[index] = retargetEvent(es[index + 1], ancestors[index]);
} else {
es[index] = es[index + 1];
}