Class InvokeActionEventListener
- java.lang.Object
-
- org.omnifaces.eventlistener.DefaultPhaseListener
-
- org.omnifaces.eventlistener.InvokeActionEventListener
-
- All Implemented Interfaces:
FacesListener,PhaseListener,SystemEventListener,Serializable,EventListener
public class InvokeActionEventListener extends DefaultPhaseListener implements SystemEventListener
The
InvokeActionEventListenerwill add support for new<f:event>typespreInvokeActionandpostInvokeAction. Those events are published during the beforephase and afterphase ofINVOKE_APPLICATIONrespectively.This event is supported on any
UIComponent, includingUIViewRoot,UIForm,UIInputandUICommandcomponents. This thus also provides the possibility to invoke multiple action listeners on a singleUIInputandUICommandcomponent on an easy manner.As this phase listener has totally no impact on a webapp's default behavior, this phase listener is already registered by OmniFaces own
faces-config.xmland thus gets auto-initialized when the OmniFaces JAR is bundled in a webapp, so endusers do not need to register this phase listener explicitly themselves.- Since:
- 1.1
- Author:
- Bauke Scholtz
- See Also:
PreInvokeActionEvent,PostInvokeActionEvent, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description InvokeActionEventListener()This constructor instructs theDefaultPhaseListenerto hook onPhaseId.INVOKE_APPLICATIONand subscribes this instance as aSystemEventListenerto thePostValidateEventevent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPhase(PhaseEvent event)Publish thePostInvokeActionEventevent on the components which are been collected inprocessEvent(SystemEvent).voidbeforePhase(PhaseEvent event)Publish thePreInvokeActionEventevent on the components which are been collected inprocessEvent(SystemEvent).booleanisListenerForSource(Object source)Returnstrueonly when the given source is anUIComponentwhich has listeners forPreInvokeActionEventorPostInvokeActionEvent.voidprocessEvent(SystemEvent event)If the validation has not failed for the current faces context, then check if theUIComponentwhich passed theisListenerForSource(Object)check has any listeners for thePreInvokeActionEventand/orPostInvokeActionEventevents and then add them to a set in the current faces context.-
Methods inherited from class org.omnifaces.eventlistener.DefaultPhaseListener
getPhaseId
-
-
-
-
Constructor Detail
-
InvokeActionEventListener
public InvokeActionEventListener()
This constructor instructs theDefaultPhaseListenerto hook onPhaseId.INVOKE_APPLICATIONand subscribes this instance as aSystemEventListenerto thePostValidateEventevent. This allows collecting the components eligible forPreInvokeActionEventorPostInvokeActionEventinside theprocessEvent(SystemEvent)method.
-
-
Method Detail
-
isListenerForSource
public boolean isListenerForSource(Object source)
Returnstrueonly when the given source is anUIComponentwhich has listeners forPreInvokeActionEventorPostInvokeActionEvent.- Specified by:
isListenerForSourcein interfaceSystemEventListener
-
processEvent
public void processEvent(SystemEvent event)
If the validation has not failed for the current faces context, then check if theUIComponentwhich passed theisListenerForSource(Object)check has any listeners for thePreInvokeActionEventand/orPostInvokeActionEventevents and then add them to a set in the current faces context.- Specified by:
processEventin interfaceSystemEventListener
-
beforePhase
public void beforePhase(PhaseEvent event)
Publish thePreInvokeActionEventevent on the components which are been collected inprocessEvent(SystemEvent).- Specified by:
beforePhasein interfacePhaseListener- Overrides:
beforePhasein classDefaultPhaseListener
-
afterPhase
public void afterPhase(PhaseEvent event)
Publish thePostInvokeActionEventevent on the components which are been collected inprocessEvent(SystemEvent).- Specified by:
afterPhasein interfacePhaseListener- Overrides:
afterPhasein classDefaultPhaseListener
-
-