- 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
InvokeActionEventListener
will add support for new<f:event>
typespreInvokeAction
andpostInvokeAction
. Those events are published during the beforephase and afterphase ofINVOKE_APPLICATION
respectively.This event is supported on any
UIComponent
, includingUIViewRoot
,UIForm
,UIInput
andUICommand
components. This thus also provides the possibility to invoke multiple action listeners on a singleUIInput
andUICommand
component 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.xml
and 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 theDefaultPhaseListener
to hook onPhaseId.INVOKE_APPLICATION
and subscribes this instance as aSystemEventListener
to thePostValidateEvent
event.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPhase(PhaseEvent event)
Publish thePostInvokeActionEvent
event on the components which are been collected inprocessEvent(SystemEvent)
.void
beforePhase(PhaseEvent event)
Publish thePreInvokeActionEvent
event on the components which are been collected inprocessEvent(SystemEvent)
.boolean
isListenerForSource(Object source)
Returnstrue
only when the given source is anUIComponent
which has listeners forPreInvokeActionEvent
orPostInvokeActionEvent
.void
processEvent(SystemEvent event)
If the validation has not failed for the current faces context, then check if theUIComponent
which passed theisListenerForSource(Object)
check has any listeners for thePreInvokeActionEvent
and/orPostInvokeActionEvent
events 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 theDefaultPhaseListener
to hook onPhaseId.INVOKE_APPLICATION
and subscribes this instance as aSystemEventListener
to thePostValidateEvent
event. This allows collecting the components eligible forPreInvokeActionEvent
orPostInvokeActionEvent
inside theprocessEvent(SystemEvent)
method.
-
-
Method Detail
-
isListenerForSource
public boolean isListenerForSource(Object source)
Returnstrue
only when the given source is anUIComponent
which has listeners forPreInvokeActionEvent
orPostInvokeActionEvent
.- Specified by:
isListenerForSource
in interfaceSystemEventListener
-
processEvent
public void processEvent(SystemEvent event)
If the validation has not failed for the current faces context, then check if theUIComponent
which passed theisListenerForSource(Object)
check has any listeners for thePreInvokeActionEvent
and/orPostInvokeActionEvent
events and then add them to a set in the current faces context.- Specified by:
processEvent
in interfaceSystemEventListener
-
beforePhase
public void beforePhase(PhaseEvent event)
Publish thePreInvokeActionEvent
event on the components which are been collected inprocessEvent(SystemEvent)
.- Specified by:
beforePhase
in interfacePhaseListener
- Overrides:
beforePhase
in classDefaultPhaseListener
-
afterPhase
public void afterPhase(PhaseEvent event)
Publish thePostInvokeActionEvent
event on the components which are been collected inprocessEvent(SystemEvent)
.- Specified by:
afterPhase
in interfacePhaseListener
- Overrides:
afterPhase
in classDefaultPhaseListener
-
-