return eventListenerReference.isAsync();
}
public void perform(ExecutionImpl execution) {
EventImpl event = execution.getEvent();
ObservableElementImpl observableElement = event.getObservableElement();
int eventListenerIndex = execution.getEventListenerIndex();
List<EventListenerReference> eventListenerReferences = event.getListenerReferences();
if ( (eventListenerReferences!=null)
&& (!eventListenerReferences.isEmpty())
) {
EventListenerReference eventListenerReference = eventListenerReferences.get(eventListenerIndex);
ObservableElement eventSource = execution.getEventSource();
if ((eventSource == observableElement) || (eventListenerReference.isPropagationEnabled())) {
EventListener eventListener = eventListenerReference.getEventListener();
log.trace("executing " + eventListener + " for " + event);
try {
// TODO can/should this invocation be unified with the exception handler invocation of the event notification method?
eventListener.notify(execution);
} catch (Exception e) {
log.trace("exception during action: " + e);
execution.handleException((ObservableElementImpl) observableElement, event, eventListenerReference, e, "couldn't run action " + eventListener);
}
}
// increment the event listener index
eventListenerIndex++;
execution.setEventListenerIndex(eventListenerIndex);
}
// if there are more listeners in this event
if ( (eventListenerReferences!=null)
&& (eventListenerIndex < eventListenerReferences.size())
) {
// execute the next listener
execution.performAtomicOperation(AtomicOperation.EXECUTE_EVENT_LISTENER);
} else {
// there are no more listeners in this event
ObservableElementImpl parent = observableElement.getParent();
// find the next event with listeners
EventImpl propagatedEvent = ExecutionImpl.findEvent(parent, event.getName());
// if there is an propagated event with listeners
if (propagatedEvent != null) {