|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.omnifaces.util.Events
public final class Events
Collection of utility methods for the JSF API with respect to working with Faces events.
Method Summary | |
---|---|
static void |
addAfterPhaseListener(javax.faces.event.PhaseId phaseId,
Callback.Void callback)
Adds a phase listener to the current view that invokes the given callback every time after given phase. |
static void |
addBeforePhaseListener(javax.faces.event.PhaseId phaseId,
Callback.Void callback)
Adds a phase listener to the current view that invokes the given callback every time before given phase ID. |
static void |
addPhaseListener(javax.faces.event.PhaseListener phaseListener)
Adds a phase listener to the current view root of the current faces context. |
static javax.faces.event.PhaseListener |
createAfterPhaseListener(javax.faces.event.PhaseId phaseId,
Callback.Void callback)
Creates a phase listener that invokes the given callback every time after the given phase. |
static javax.faces.event.PhaseListener |
createBeforePhaseListener(javax.faces.event.PhaseId phaseId,
Callback.Void callback)
Creates a phase listener that invokes the given callback every time before the given phase. |
static void |
removeCallbackPhaseListener()
Removes the one and only phase listener from callbacks by the global phase listener for the current request. |
static void |
removePhaseListener(javax.faces.event.PhaseListener phaseListener)
Removes a phase listener from the current view root of the current faces context. |
static void |
setCallbackAfterPhaseListener(javax.faces.event.PhaseId phaseId,
Callback.Void callback)
Sets a phase listener for callback by a global phase listener during the current request that invokes the given callback every time after given phase ID. |
static void |
setCallBackBeforePhaseListener(javax.faces.event.PhaseId phaseId,
Callback.Void callback)
Sets a phase listener for callback by a global phase listener during the current request that invokes the given callback every time before given phase ID. |
static void |
setCallbackPhaseListener(javax.faces.event.PhaseListener phaseListener)
Sets phase listener for callback by a global phase listener during the current request. |
static void |
subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent> type,
javax.faces.event.SystemEventListener listener)
Adds the given system event listener to the application that get invoked every time when the given system event type is published. |
static void |
subscribeToViewEvent(java.lang.Class<? extends javax.faces.event.SystemEvent> type,
Callback.Void callback)
Install the callback instance referenced by argument listener into the UIViewRoot as a listener for events of type systemEventClass. |
static void |
subscribeToViewEvent(java.lang.Class<? extends javax.faces.event.SystemEvent> type,
javax.faces.event.SystemEventListener listener)
Install the listener instance referenced by argument listener into the UIViewRoot as a listener for events of type systemEventClass. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void addPhaseListener(javax.faces.event.PhaseListener phaseListener)
phaseListener
- The phase listener to be added to the current view root of the current faces context.public static void removePhaseListener(javax.faces.event.PhaseListener phaseListener)
phaseListener
- The phase listener to be removed from the current view root of the current faces context.public static void setCallbackPhaseListener(javax.faces.event.PhaseListener phaseListener)
This differs in a few subtle ways from addPhaseListener(PhaseListener)
. Namely, the phase listener
registered here will be called via the global phase listener, which executes slightly earlier for its before phase
and slightly later for its after phase as compared to phase listeners attached to the view root.
Additionally, a phase listener registered via this method will not become part of the view state, but will execute only once. Phase listeners attached to the view root will come back after each postback and have to be remove manually (in Mojarra this can be difficult due to the fact iterators over listeners are kept 'open' during each phase).
Note: at the moment only 1 callback phase listener per request can be set.
phaseListener
- The phase listener to be set for callback during the current request.public static void removeCallbackPhaseListener()
public static void addBeforePhaseListener(javax.faces.event.PhaseId phaseId, Callback.Void callback)
phaseId
- The phase ID to invoke the given callback every time before.callback
- The callback to be invoked every time before the given phase ID of the current view.public static void addAfterPhaseListener(javax.faces.event.PhaseId phaseId, Callback.Void callback)
phaseId
- The phase ID to invoke the given callback every time after.callback
- The callback to be invoked every time after the given phase ID of the current view.public static void setCallBackBeforePhaseListener(javax.faces.event.PhaseId phaseId, Callback.Void callback)
phaseId
- The phase ID to invoke the given callback every time before.callback
- The callback to be invoked every time before the given phase ID of the current request.public static void setCallbackAfterPhaseListener(javax.faces.event.PhaseId phaseId, Callback.Void callback)
phaseId
- The phase ID to invoke the given callback every time after.callback
- The callback to be invoked every time after the given phase ID of the current request.public static javax.faces.event.PhaseListener createBeforePhaseListener(javax.faces.event.PhaseId phaseId, Callback.Void callback)
phaseId
- The phase ID to invoke the given callback every time before.callback
- The callback to be invoked every time before the given phase ID of the current view.
public static javax.faces.event.PhaseListener createAfterPhaseListener(javax.faces.event.PhaseId phaseId, Callback.Void callback)
phaseId
- The phase ID to invoke the given callback every time after.callback
- The callback to be invoked every time after the given phase ID of the current view.
public static void subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent> type, javax.faces.event.SystemEventListener listener)
type
- The system event type to listen on.listener
- The system event listener to be invoked.public static void subscribeToViewEvent(java.lang.Class<? extends javax.faces.event.SystemEvent> type, javax.faces.event.SystemEventListener listener)
type
- The system event type to listen on.listener
- The system event listener to be invoked.public static void subscribeToViewEvent(java.lang.Class<? extends javax.faces.event.SystemEvent> type, Callback.Void callback)
type
- The system event type to listen on.callback
- The callback to be invoked.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |