Class ClientBehaviorContext
ClientBehaviorContext provides context information that may be useful
to ClientBehavior.getScript(jakarta.faces.component.behavior.ClientBehaviorContext) implementations.
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classParameter instances represent name/value pairs that "submitting" ClientBehavior implementations should include when posting back into the Faces lifecycle. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClientBehaviorContextcreateClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters) Creates a ClientBehaviorContext instance.abstract UIComponentReturns theUIComponentthat is requesting theClientBehaviorscript.abstract StringReturns the name of the behavior event for which the ClientBehavior script is being requested.abstract FacesContextReturns theFacesContextfor the current request.abstract Collection<ClientBehaviorContext.Parameter>Returns parameters that "submitting"ClientBehaviorimplementations should include when posting back data into the Faces lifecycle.abstract StringReturns an id for use as theClientBehaviorsource.
-
Field Details
-
BEHAVIOR_SOURCE_PARAM_NAME
The request parameter name whose request parameter value identifies the source component of behavior event.
- Since:
- 2.3
- See Also:
-
BEHAVIOR_EVENT_PARAM_NAME
The request parameter name whose request parameter value identifies the type of behavior event.
- Since:
- 2.3
- See Also:
-
-
Constructor Details
-
ClientBehaviorContext
public ClientBehaviorContext()
-
-
Method Details
-
createClientBehaviorContext
public static ClientBehaviorContext createClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters) Creates a ClientBehaviorContext instance.
- Parameters:
context- theFacesContextfor the current request.component- the component instance to which theClientBehavioris attached.eventName- the name of the behavior event to which theClientBehavioris attached.sourceId- the id to use as the ClientBehavior's "source".parameters- the collection of parameters for submitting ClientBehaviors to include in the request.- Returns:
- a
ClientBehaviorContextinstance configured with the provided values. - Throws:
NullPointerException- ifcontext,componentoreventNameisnull- Since:
- 2.0
-
getFacesContext
Returns the
FacesContextfor the current request.- Returns:
- the
FacesContext. - Since:
- 2.0
-
getComponent
Returns the
UIComponentthat is requesting theClientBehaviorscript.- Returns:
- the component.
- Since:
- 2.0
-
getEventName
Returns the name of the behavior event for which the ClientBehavior script is being requested.
- Returns:
- the event name.
- Since:
- 2.0
-
getSourceId
Returns an id for use as the
ClientBehaviorsource. ClientBehavior implementations that submit back to the Faces lifecycle are required to identify which component triggered the ClientBehavior-initiated request via thejakarta.faces.sourcerequest parameter. In most cases, th source id can be trivially derived from the element to which the behavior's client-side script is attached - ie. the source id is typically the id of this element. However, in components which produce more complex content, the behavior script may not be able to determine the correct id to use for the jakarta.faces.source value. ThegetSourceId()method allows the component to pass this information into theClientBehavior.getScript(jakarta.faces.component.behavior.ClientBehaviorContext)implementation.- Returns:
- the id for the behavior's script to use as the "source", or null if the Behavior's script can identify the source from the DOM.
- Since:
- 2.0
-
getParameters
Returns parameters that "submitting"
ClientBehaviorimplementations should include when posting back data into the Faces lifecycle. If no parameters are specified, this method returns an empty (non-null) collection.- Returns:
- the parameters.
- Since:
- 2.0
-