Search in sources :

Example 1 with EventInfo

use of com.sun.faces.application.applicationimpl.events.EventInfo in project mojarra by eclipse-ee4j.

the class Events method getListeners.

/**
 * @return the SystemEventListeners that should be used for the provided combination of SystemEvent and source.
 */
private Set<SystemEventListener> getListeners(Class<? extends SystemEvent> systemEvent, Class<?> sourceClass) {
    Set<SystemEventListener> listeners = null;
    EventInfo sourceInfo = systemEventHelper.getEventInfo(systemEvent, sourceClass);
    if (sourceInfo != null) {
        listeners = sourceInfo.getListeners();
    }
    return listeners;
}
Also used : SystemEventListener(jakarta.faces.event.SystemEventListener) EventInfo(com.sun.faces.application.applicationimpl.events.EventInfo)

Example 2 with EventInfo

use of com.sun.faces.application.applicationimpl.events.EventInfo in project mojarra by eclipse-ee4j.

the class Events method invokeComponentListenersFor.

/**
 * @return process any listeners for the specified SystemEventListenerHolder and return any SystemEvent that may have
 * been created as a side-effect of processing the listeners.
 */
private SystemEvent invokeComponentListenersFor(Class<? extends SystemEvent> systemEventClass, Object source) {
    if (source instanceof SystemEventListenerHolder) {
        List<SystemEventListener> listeners = ((SystemEventListenerHolder) source).getListenersForEventClass(systemEventClass);
        if (null == listeners) {
            return null;
        }
        EventInfo eventInfo = compSysEventHelper.getEventInfo(systemEventClass, source.getClass());
        return processListeners(listeners, null, source, eventInfo);
    }
    return null;
}
Also used : SystemEventListener(jakarta.faces.event.SystemEventListener) EventInfo(com.sun.faces.application.applicationimpl.events.EventInfo) SystemEventListenerHolder(jakarta.faces.event.SystemEventListenerHolder)

Example 3 with EventInfo

use of com.sun.faces.application.applicationimpl.events.EventInfo in project mojarra by eclipse-ee4j.

the class Events method invokeListenersFor.

/**
 * Traverse the <code>List</code> of listeners and invoke any that are relevent for the specified source.
 *
 * @throws jakarta.faces.event.AbortProcessingException propagated from the listener invocation
 */
private SystemEvent invokeListenersFor(Class<? extends SystemEvent> systemEventClass, SystemEvent event, Object source, Class<?> sourceBaseType, boolean useSourceLookup) throws AbortProcessingException {
    EventInfo eventInfo = systemEventHelper.getEventInfo(systemEventClass, source, sourceBaseType, useSourceLookup);
    if (eventInfo != null) {
        Set<SystemEventListener> listeners = eventInfo.getListeners();
        event = processListeners(listeners, event, source, eventInfo);
    }
    return event;
}
Also used : SystemEventListener(jakarta.faces.event.SystemEventListener) EventInfo(com.sun.faces.application.applicationimpl.events.EventInfo)

Example 4 with EventInfo

use of com.sun.faces.application.applicationimpl.events.EventInfo in project mojarra by eclipse-ee4j.

the class Events method invokeViewListenersFor.

private SystemEvent invokeViewListenersFor(FacesContext ctx, Class<? extends SystemEvent> systemEventClass, SystemEvent event, Object source) {
    SystemEvent result = event;
    if (listenerInvocationGuard.isGuardSet(ctx, systemEventClass)) {
        return result;
    }
    listenerInvocationGuard.setGuard(ctx, systemEventClass);
    UIViewRoot root = ctx.getViewRoot();
    try {
        if (root != null) {
            List<SystemEventListener> listeners = root.getViewListenersForEventClass(systemEventClass);
            if (null == listeners) {
                return null;
            }
            EventInfo rootEventInfo = systemEventHelper.getEventInfo(systemEventClass, UIViewRoot.class);
            // process view listeners
            result = processListenersAccountingForAdds(listeners, event, source, rootEventInfo);
        }
    } finally {
        listenerInvocationGuard.clearGuard(ctx, systemEventClass);
    }
    return result;
}
Also used : SystemEvent(jakarta.faces.event.SystemEvent) SystemEventListener(jakarta.faces.event.SystemEventListener) EventInfo(com.sun.faces.application.applicationimpl.events.EventInfo) UIViewRoot(jakarta.faces.component.UIViewRoot)

Aggregations

EventInfo (com.sun.faces.application.applicationimpl.events.EventInfo)4 SystemEventListener (jakarta.faces.event.SystemEventListener)4 UIViewRoot (jakarta.faces.component.UIViewRoot)1 SystemEvent (jakarta.faces.event.SystemEvent)1 SystemEventListenerHolder (jakarta.faces.event.SystemEventListenerHolder)1