Top Description Inners Fields Constructors Methods
jakarta.faces.component.behavior

public abstract Class ClientBehaviorContext

extends Object
Class Inheritance
Known Direct Subclasses
jakarta.faces.component.behavior.ClientBehaviorContext.ClientBehaviorContextImpl
Imports
java.util.Collection, .Collections, jakarta.faces.component.UIComponent, jakarta.faces.context.FacesContext

ClientBehaviorContext provides context information that may be useful to jakarta.faces.component.behavior.ClientBehavior#getScript implementations.

Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
ClientBehaviorContext.Parameter

Parameter instances represent name/value pairs that "submitting" ClientBehavior implementations should include when posting back into the Faces lifecycle.

Field Summary

Modifier and TypeField and Description
public static final String
BEHAVIOR_EVENT_PARAM_NAME

The request parameter name whose request parameter value identifies the type of behavior event.

public static final String
BEHAVIOR_SOURCE_PARAM_NAME

The request parameter name whose request parameter value identifies the source component of behavior event.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ClientBehaviorContext

Returns:

a ClientBehaviorContext instance configured with the provided values.
createClientBehaviorContext
(FacesContext
the FacesContext for the current request.
context
,
UIComponent
the component instance to which the ClientBehavior is attached.
component
,
String
the name of the behavior event to which the ClientBehavior is attached.
eventName
,
String
the id to use as the ClientBehavior's "source".
sourceId
,
Collection<ClientBehaviorContext.Parameter>
the collection of parameters for submitting ClientBehaviors to include in the request.
parameters
)

Creates a ClientBehaviorContext instance.

public abstract UIComponent

Returns:

the component.
getComponent
()

Returns the UIComponent that is requesting the ClientBehavior script.

public abstract String

Returns:

the event name.
getEventName
()

Returns the name of the behavior event for which the ClientBehavior script is being requested.

public abstract FacesContext

Returns:

the FacesContext.
getFacesContext
()

Returns the FacesContext for the current request.

public abstract Collection<ClientBehaviorContext.Parameter>

Returns:

the parameters.
getParameters
()

Returns parameters that "submitting" ClientBehavior implementations should include when posting back data into the Faces lifecycle.

public abstract String

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.
getSourceId
()

Returns an id for use as the ClientBehavior source.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BEHAVIOR_EVENT_PARAM_NAMEback to summary
public static final String BEHAVIOR_EVENT_PARAM_NAME

The request parameter name whose request parameter value identifies the type of behavior event.

Since
2.3
BEHAVIOR_SOURCE_PARAM_NAMEback to summary
public static final String BEHAVIOR_SOURCE_PARAM_NAME

The request parameter name whose request parameter value identifies the source component of behavior event.

Since
2.3

Constructor Detail

ClientBehaviorContextback to summary
public ClientBehaviorContext()

Method Detail

createClientBehaviorContextback to summary
public static ClientBehaviorContext createClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters)

Creates a ClientBehaviorContext instance.

Parameters
context:FacesContext

the FacesContext for the current request.

component:UIComponent

the component instance to which the ClientBehavior is attached.

eventName:String

the name of the behavior event to which the ClientBehavior is attached.

sourceId:String

the id to use as the ClientBehavior's "source".

parameters:Collection<ClientBehaviorContext.Parameter>

the collection of parameters for submitting ClientBehaviors to include in the request.

Returns:ClientBehaviorContext

a ClientBehaviorContext instance configured with the provided values.

Exceptions
NullPointerException:
if context, component or eventName is null
Since
2.0
getComponentback to summary
public abstract UIComponent getComponent()

Returns the UIComponent that is requesting the ClientBehavior script.

Returns:UIComponent

the component.

Since
2.0
getEventNameback to summary
public abstract String getEventName()

Returns the name of the behavior event for which the ClientBehavior script is being requested.

Returns:String

the event name.

Since
2.0
getFacesContextback to summary
public abstract FacesContext getFacesContext()

Returns the FacesContext for the current request.

Returns:FacesContext

the FacesContext.

Since
2.0
getParametersback to summary
public abstract Collection<ClientBehaviorContext.Parameter> getParameters()

Returns parameters that "submitting" ClientBehavior implementations should include when posting back data into the Faces lifecycle. If no parameters are specified, this method returns an empty (non-null) collection.

Returns:Collection<ClientBehaviorContext.Parameter>

the parameters.

Since
2.0
getSourceIdback to summary
public abstract String getSourceId()

Returns an id for use as the ClientBehavior source. ClientBehavior implementations that submit back to the Faces lifecycle are required to identify which component triggered the ClientBehavior-initiated request via the jakarta.faces.source request 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. The ClientBehaviorContext#getSourceId method allows the component to pass this information into the ClientBehavior#getScript implementation.

Returns:String

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
jakarta.faces.component.behavior back to summary

private final Class ClientBehaviorContext.ClientBehaviorContextImpl

extends ClientBehaviorContext
Class Inheritance

Field Summary

Modifier and TypeField and Description
private UIComponent
private FacesContext
private String
private Collection<ClientBehaviorContext.Parameter>
private String
Inherited from jakarta.faces.component.behavior.ClientBehaviorContext:
BEHAVIOR_EVENT_PARAM_NAMEBEHAVIOR_SOURCE_PARAM_NAME

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public UIComponent
public String
getEventName()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getEventName.

Returns the name of the behavior event for which the ClientBehavior script is being requested.

public FacesContext
public Collection<ClientBehaviorContext.Parameter>
getParameters()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getParameters.

Returns parameters that "submitting" ClientBehavior implementations should include when posting back data into the Faces lifecycle.

public String
getSourceId()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getSourceId.

Returns an id for use as the ClientBehavior source.

Inherited from jakarta.faces.component.behavior.ClientBehaviorContext:
createClientBehaviorContext

Field Detail

componentback to summary
private UIComponent component
contextback to summary
private FacesContext context
eventNameback to summary
private String eventName
parametersback to summary
private Collection<ClientBehaviorContext.Parameter> parameters
sourceIdback to summary
private String sourceId

Constructor Detail

ClientBehaviorContextImplback to summary
private ClientBehaviorContextImpl(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters)

Method Detail

getComponentback to summary
public UIComponent getComponent()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getComponent.

Doc from jakarta.faces.component.behavior.ClientBehaviorContext.getComponent.

Returns the UIComponent that is requesting the ClientBehavior script.

Returns:UIComponent

the component.

Annotations
@Override
getEventNameback to summary
public String getEventName()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getEventName.

Doc from jakarta.faces.component.behavior.ClientBehaviorContext.getEventName.

Returns the name of the behavior event for which the ClientBehavior script is being requested.

Returns:String

the event name.

Annotations
@Override
getFacesContextback to summary
public FacesContext getFacesContext()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getFacesContext.

Doc from jakarta.faces.component.behavior.ClientBehaviorContext.getFacesContext.

Returns the FacesContext for the current request.

Returns:FacesContext

the FacesContext.

Annotations
@Override
getParametersback to summary
public Collection<ClientBehaviorContext.Parameter> getParameters()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getParameters.

Doc from jakarta.faces.component.behavior.ClientBehaviorContext.getParameters.

Returns parameters that "submitting" ClientBehavior implementations should include when posting back data into the Faces lifecycle. If no parameters are specified, this method returns an empty (non-null) collection.

Returns:Collection<ClientBehaviorContext.Parameter>

the parameters.

Annotations
@Override
getSourceIdback to summary
public String getSourceId()

Implements abstract jakarta.faces.component.behavior.ClientBehaviorContext.getSourceId.

Doc from jakarta.faces.component.behavior.ClientBehaviorContext.getSourceId.

Returns an id for use as the ClientBehavior source. ClientBehavior implementations that submit back to the Faces lifecycle are required to identify which component triggered the ClientBehavior-initiated request via the jakarta.faces.source request 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. The ClientBehaviorContext#getSourceId method allows the component to pass this information into the ClientBehavior#getScript implementation.

Returns:String

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.

Annotations
@Override
jakarta.faces.component.behavior back to summary

public Class ClientBehaviorContext.Parameter

extends Object
Class Inheritance
  • java.lang.Object
  • jakarta.faces.component.behavior.ClientBehaviorContext.Parameter

Parameter instances represent name/value pairs that "submitting" ClientBehavior implementations should include when posting back into the Faces lifecycle. ClientBehavior implementations can determine which Parameters to include by calling ClientBehaviorContext.getParameters().

Since
2.0

Field Summary

Modifier and TypeField and Description
private String
private Object

Constructor Summary

AccessConstructor and Description
public
Parameter(String
the name of the parameter
name
,
Object
the value of the parameter
value
)

Creates a Parameter instance.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the parameter's name.
getName
()

Returns the Parameter's name.

public Object

Returns:

the parameter's value.
getValue
()

Returns the Parameter's value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private String name
valueback to summary
private Object value

Constructor Detail

Parameterback to summary
public Parameter(String name, Object value)

Creates a Parameter instance.

Parameters
name:String

the name of the parameter

value:Object

the value of the parameter

Exceptions
NullPointerException:
if name is null.
Since
2.0

Method Detail

getNameback to summary
public String getName()

Returns the Parameter's name.

Returns:String

the parameter's name.

Since
2.0
getValueback to summary
public Object getValue()

Returns the Parameter's value.

Returns:Object

the parameter's value.

Since
2.0