Class ClientBehaviorBase
- java.lang.Object
-
- jakarta.faces.component.behavior.BehaviorBase
-
- jakarta.faces.component.behavior.ClientBehaviorBase
-
- All Implemented Interfaces:
Behavior,ClientBehavior,PartialStateHolder,StateHolder
- Direct Known Subclasses:
AjaxBehavior
public class ClientBehaviorBase extends BehaviorBase implements ClientBehavior
ClientBehaviorBase is a convenience base class that implements the default concrete behavior of all methods defined by
ClientBehavior.Subclasses should either override getRendererType() to identify the
ClientBehaviorRendererto delegate to, or they should overridegetScript()to locally generate the desired Behavior script, anddecode().- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description ClientBehaviorBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecode(FacesContext context, UIComponent component)Default implementation of ofClientBehavior.decode(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).Set<ClientBehaviorHint>getHints()Default implementation ofClientBehavior.getHints().protected ClientBehaviorRenderergetRenderer(FacesContext context)Convenience method to return theClientBehaviorRendererinstance associated with thisClientBehavior, if any; otherwise, returnnull.StringgetRendererType()Returns the renderer type of theClientBehaviorRendererto use for the behavior.StringgetScript(ClientBehaviorContext behaviorContext)Default implementation of ofClientBehavior.getScript(jakarta.faces.component.behavior.ClientBehaviorContext).-
Methods inherited from class jakarta.faces.component.behavior.BehaviorBase
addBehaviorListener, broadcast, clearInitialState, initialStateMarked, isTransient, markInitialState, removeBehaviorListener, restoreState, saveState, setTransient
-
-
-
-
Method Detail
-
getScript
public String getScript(ClientBehaviorContext behaviorContext)
Default implementation of of
ClientBehavior.getScript(jakarta.faces.component.behavior.ClientBehaviorContext). If aClientBehaviorRendereris available for the specified behavior renderer type, this method delegates to theClientBehaviorRenderer.getScript(jakarta.faces.component.behavior.ClientBehaviorContext, jakarta.faces.component.behavior.ClientBehavior)method. Otherwise, this method returns null.- Specified by:
getScriptin interfaceClientBehavior- Parameters:
behaviorContext- theClientBehaviorContext- Returns:
- the script provided by the associated ClientBehaviorRenderer, or null if no ClientBehaviorRenderer is available.
- Throws:
NullPointerException- ifbehaviorContextisnull- Since:
- 2.0
-
decode
public void decode(FacesContext context, UIComponent component)
Default implementation of of
ClientBehavior.decode(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent). If aClientBehaviorRendereris available for the specified behavior renderer type, this method delegates to the ClientBehaviorRenderer's decode() method. Otherwise, no decoding is performed.- Specified by:
decodein interfaceClientBehavior- Parameters:
context-FacesContextfor the request we are processingcomponent-UIComponentthe component associated with thisClientBehavior- Throws:
NullPointerException- ifcontextorcomponentisnull.- Since:
- 2.0
-
getRendererType
public String getRendererType()
Returns the renderer type of the
ClientBehaviorRendererto use for the behavior. The default implementation returns null. Subclasses should either override this method to return a string that identifies the type ofClientBehaviorRendererto use, or should overridegetScript(jakarta.faces.component.behavior.ClientBehaviorContext)and perform script rendering locally in theClientBehaviorimplementation.- Returns:
- the default renderer type, which is null.
- Since:
- 2.0
-
getHints
public Set<ClientBehaviorHint> getHints()
Default implementation of
ClientBehavior.getHints(). By default, no hints are specified, and this method returns an empty, umodifiable set.- Specified by:
getHintsin interfaceClientBehavior- Returns:
- an empty, unmodifiable set of
ClientBehaviorHints. - Since:
- 2.0
-
getRenderer
protected ClientBehaviorRenderer getRenderer(FacesContext context)
Convenience method to return the
ClientBehaviorRendererinstance associated with thisClientBehavior, if any; otherwise, returnnull.- Parameters:
context-FacesContextfor the request we are processing- Returns:
ClientBehaviorRendererinstance from the currentRenderKitor null.- Throws:
NullPointerException- ifcontextis null.- Since:
- 2.0
-
-