Class RetargetedAjaxBehavior
- java.lang.Object
-
- jakarta.faces.component.behavior.BehaviorBase
-
- jakarta.faces.component.behavior.ClientBehaviorBase
-
- jakarta.faces.component.behavior.AjaxBehavior
-
- com.sun.faces.facelets.tag.composite.RetargetedAjaxBehavior
-
- All Implemented Interfaces:
Behavior,ClientBehavior,PartialStateHolder,StateHolder
public class RetargetedAjaxBehavior extends AjaxBehavior
Basically represents<f:ajax>which is retargeted by<cc:clientBehavior>inAjaxHandlerand checked inAjaxBehaviorRenderer. We should probably introduceAjaxBehaviorWrapperin Faces.next to reduce boilerplate like this. - https://github.com/jakartaee/faces/issues/1567 - https://github.com/eclipse-ee4j/mojarra/issues/5032
-
-
Field Summary
-
Fields inherited from class jakarta.faces.component.behavior.AjaxBehavior
BEHAVIOR_ID
-
-
Constructor Summary
Constructors Constructor Description RetargetedAjaxBehavior(AjaxBehavior retargeted)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAjaxBehaviorListener(AjaxBehaviorListener listener)Add the specifiedAjaxBehaviorListenerto the set of listeners registered to receive event notifications from thisAjaxBehavior.voidbroadcast(BehaviorEvent event)Default implementation ofBehavior.broadcast(jakarta.faces.event.BehaviorEvent).voidclearInitialState()Clears the initial state flag, causing the behavior to revert from partial to full state saving.voiddecode(FacesContext context, UIComponent component)Default implementation of ofClientBehavior.decode(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent).booleanequals(Object obj)StringgetDelay()Returns the delay value, ornullif no value was set.Collection<String>getExecute()Return a non-emptyCollection<String>of component identifiers that will be used to identify components that should be processed during theexecutephase of the request processing lifecycle.Set<ClientBehaviorHint>getHints()StringgetOnerror()Return theStringof JavaScript function name that will be used to identify the client callback function that should be run in the event of an error.StringgetOnevent()Return theStringof JavaScript function name that will be used to identify the client callback function that should be run on the occurance of a client-side event.Collection<String>getRender()Return a non-emptyCollection<String>of component identifiers that will be used to identify components that should be processed during therenderphase of the request processing lifecycle.StringgetRendererType()Returns the renderer type of theClientBehaviorRendererto use for the behavior.StringgetScript(ClientBehaviorContext behaviorContext)Default implementation of ofClientBehavior.getScript(jakarta.faces.component.behavior.ClientBehaviorContext).jakarta.el.ValueExpressiongetValueExpression(String name)Returns theValueExpressionused to calculate the value for the specified property name, if any.inthashCode()booleaninitialStateMarked()Implementation ofPartialStateHolder.initialStateMarked().booleanisDisabled()Return the disabled status of this behavior.booleanisImmediate()Return the immediate status of this behavior.booleanisImmediateSet()Tests whether the immediate attribute is specified.booleanisResetValues()Return the resetValues status of this behavior.booleanisResetValuesSet()Tests whether the resetValues attribute is specified.booleanisTransient()Implementation ofStateHolder.isTransient().voidmarkInitialState()Implementation ofPartialStateHolder.markInitialState().voidremoveAjaxBehaviorListener(AjaxBehaviorListener listener)Remove the specifiedAjaxBehaviorListenerfrom the set of listeners registered to receive event notifications from thisAjaxBehavior.voidrestoreState(FacesContext context, Object state)ObjectsaveState(FacesContext context)Implementation ofStateHolder.saveState(jakarta.faces.context.FacesContext).voidsetDelay(String delay)If less than delay milliseconds elapses between calls to request() only the most recent one is sent and all other requests are discarded.voidsetDisabled(boolean disabled)Sets the disabled status of this behavior.voidsetExecute(Collection<String> execute)Sets the component identifiers that will be used to identify components that should be processed during theexecutephase of the request processing lifecycle.voidsetImmediate(boolean immediate)Sets the immediate status of this behavior.voidsetOnerror(String onerror)Sets the JavaScript function name that will be used to identify the client callback function that should be run in the event of an error.voidsetOnevent(String onevent)Sets the JavaScript function name that will be used to identify the client callback function that should be run in response to event activity.voidsetRender(Collection<String> render)Sets the component identifiers that will be used to identify components that should be processed during therenderphase of the request processing lifecycle.voidsetResetValues(boolean resetValues)Set the resetValues status of this behavior.voidsetTransient(boolean transientFlag)Implementation ofStateHolder.setTransient(boolean).voidsetValueExpression(String name, jakarta.el.ValueExpression binding)Sets theValueExpressionused to calculate the value for the specified property name.StringtoString()-
Methods inherited from class jakarta.faces.component.behavior.ClientBehaviorBase
getRenderer
-
Methods inherited from class jakarta.faces.component.behavior.BehaviorBase
addBehaviorListener, removeBehaviorListener
-
-
-
-
Constructor Detail
-
RetargetedAjaxBehavior
public RetargetedAjaxBehavior(AjaxBehavior retargeted)
-
-
Method Detail
-
getScript
public String getScript(ClientBehaviorContext behaviorContext)
Description copied from class:ClientBehaviorBaseDefault 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- Overrides:
getScriptin classClientBehaviorBase- Parameters:
behaviorContext- theClientBehaviorContext- Returns:
- the script provided by the associated ClientBehaviorRenderer, or null if no ClientBehaviorRenderer is available.
-
broadcast
public void broadcast(BehaviorEvent event) throws AbortProcessingException
Description copied from class:BehaviorBaseDefault implementation of
Behavior.broadcast(jakarta.faces.event.BehaviorEvent). Delivers the specifiedBehaviorEventto all registeredBehaviorListenerevent listeners who have expressed an interest in events of this type. Listeners are called in the order in which they were registered (added).- Specified by:
broadcastin interfaceBehavior- Overrides:
broadcastin classBehaviorBase- Parameters:
event- TheBehaviorEventto be broadcast- Throws:
AbortProcessingException- Signal the Jakarta Faces implementation that no further processing on the current event should be performed
-
getRendererType
public String getRendererType()
Description copied from class:ClientBehaviorBaseReturns 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 overrideClientBehaviorBase.getScript(jakarta.faces.component.behavior.ClientBehaviorContext)and perform script rendering locally in theClientBehaviorimplementation.- Overrides:
getRendererTypein classAjaxBehavior- Returns:
- the default renderer type, which is null.
-
decode
public void decode(FacesContext context, UIComponent component)
Description copied from class:ClientBehaviorBaseDefault 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- Overrides:
decodein classClientBehaviorBase- Parameters:
context-FacesContextfor the request we are processingcomponent-UIComponentthe component associated with thisClientBehavior
-
isTransient
public boolean isTransient()
Description copied from class:BehaviorBaseImplementation of
StateHolder.isTransient().- Specified by:
isTransientin interfaceStateHolder- Overrides:
isTransientin classBehaviorBase- Returns:
trueif transient,falseotherwise.
-
getHints
public Set<ClientBehaviorHint> getHints()
Description copied from class:AjaxBehaviorThis method returns an unmodifiable
Setcontaining theClientBehaviorHintSUBMITTING.- Specified by:
getHintsin interfaceClientBehavior- Overrides:
getHintsin classAjaxBehavior- Returns:
- unmodifiable set containing the hint
ClientBehaviorHintSUBMITTING.
-
setTransient
public void setTransient(boolean transientFlag)
Description copied from class:BehaviorBaseImplementation of
StateHolder.setTransient(boolean).- Specified by:
setTransientin interfaceStateHolder- Overrides:
setTransientin classBehaviorBase- Parameters:
transientFlag- boolean passtrueif this Object will not participate in state saving or restoring, otherwise passfalse.
-
getOnerror
public String getOnerror()
Description copied from class:AjaxBehaviorReturn the
Stringof JavaScript function name that will be used to identify the client callback function that should be run in the event of an error.- Overrides:
getOnerrorin classAjaxBehavior- Returns:
- the JavaScript function name of
ONERROR.
-
setOnerror
public void setOnerror(String onerror)
Description copied from class:AjaxBehaviorSets the JavaScript function name that will be used to identify the client callback function that should be run in the event of an error.
- Overrides:
setOnerrorin classAjaxBehavior- Parameters:
onerror- the error handling function name
-
getOnevent
public String getOnevent()
Description copied from class:AjaxBehaviorReturn the
Stringof JavaScript function name that will be used to identify the client callback function that should be run on the occurance of a client-side event.- Overrides:
getOneventin classAjaxBehavior- Returns:
- the JavaScript function name of
ONEVENT.
-
setOnevent
public void setOnevent(String onevent)
Description copied from class:AjaxBehaviorSets the JavaScript function name that will be used to identify the client callback function that should be run in response to event activity.
- Overrides:
setOneventin classAjaxBehavior- Parameters:
onevent- the event handling function name
-
markInitialState
public void markInitialState()
Description copied from class:BehaviorBaseImplementation of
PartialStateHolder.markInitialState().- Specified by:
markInitialStatein interfacePartialStateHolder- Overrides:
markInitialStatein classBehaviorBase
-
initialStateMarked
public boolean initialStateMarked()
Description copied from class:BehaviorBaseImplementation of
PartialStateHolder.initialStateMarked().- Specified by:
initialStateMarkedin interfacePartialStateHolder- Overrides:
initialStateMarkedin classBehaviorBase- Returns:
trueif the initial state is marked,falseotherwise.
-
getExecute
public Collection<String> getExecute()
Description copied from class:AjaxBehaviorReturn a non-empty
Collection<String>of component identifiers that will be used to identify components that should be processed during theexecutephase of the request processing lifecycle.Note that the returned collection may be unmodifiable. Modifications should be performed by calling
AjaxBehavior.setExecute(java.util.Collection<java.lang.String>).- Overrides:
getExecutein classAjaxBehavior- Returns:
- the JavaScript function name of
EXECUTE.
-
clearInitialState
public void clearInitialState()
Description copied from class:BehaviorBaseClears the initial state flag, causing the behavior to revert from partial to full state saving.
- Specified by:
clearInitialStatein interfacePartialStateHolder- Overrides:
clearInitialStatein classBehaviorBase
-
setExecute
public void setExecute(Collection<String> execute)
Description copied from class:AjaxBehaviorSets the component identifiers that will be used to identify components that should be processed during the
executephase of the request processing lifecycle.- Overrides:
setExecutein classAjaxBehavior- Parameters:
execute- the ids of components to execute
-
getDelay
public String getDelay()
Description copied from class:AjaxBehaviorReturns the delay value, or
nullif no value was set.- Overrides:
getDelayin classAjaxBehavior- Returns:
- the delay value.
-
setDelay
public void setDelay(String delay)
Description copied from class:AjaxBehaviorIf less than delay milliseconds elapses between calls to request() only the most recent one is sent and all other requests are discarded. The default value of this option is 300. If the value of delay is the literal string
'none'without the quotes, no delay is used.- Overrides:
setDelayin classAjaxBehavior- Parameters:
delay- the ajax delay value
-
getRender
public Collection<String> getRender()
Description copied from class:AjaxBehaviorReturn a non-empty
Collection<String>of component identifiers that will be used to identify components that should be processed during therenderphase of the request processing lifecycle.Note that the returned collection may be unmodifiable. Modifications should be performed by calling
AjaxBehavior.setRender(java.util.Collection<java.lang.String>).- Overrides:
getRenderin classAjaxBehavior- Returns:
- the ids of components to render.
-
setRender
public void setRender(Collection<String> render)
Description copied from class:AjaxBehaviorSets the component identifiers that will be used to identify components that should be processed during the
renderphase of the request processing lifecycle.- Overrides:
setRenderin classAjaxBehavior- Parameters:
render- the ids of components to render
-
isResetValues
public boolean isResetValues()
Description copied from class:AjaxBehaviorReturn the resetValues status of this behavior.
- Overrides:
isResetValuesin classAjaxBehavior- Returns:
- the resetValues status.
-
setResetValues
public void setResetValues(boolean resetValues)
Description copied from class:AjaxBehaviorSet the resetValues status of this behavior.
- Overrides:
setResetValuesin classAjaxBehavior- Parameters:
resetValues- the resetValues status.
-
isDisabled
public boolean isDisabled()
Description copied from class:AjaxBehaviorReturn the disabled status of this behavior.
- Overrides:
isDisabledin classAjaxBehavior- Returns:
- the disabled status of this behavior.
-
setDisabled
public void setDisabled(boolean disabled)
Description copied from class:AjaxBehaviorSets the disabled status of this behavior.
- Overrides:
setDisabledin classAjaxBehavior- Parameters:
disabled- the flag to be set.
-
isImmediate
public boolean isImmediate()
Description copied from class:AjaxBehaviorReturn the immediate status of this behavior.
- Overrides:
isImmediatein classAjaxBehavior- Returns:
- the immediate status.
-
setImmediate
public void setImmediate(boolean immediate)
Description copied from class:AjaxBehaviorSets the immediate status of this behavior.
- Overrides:
setImmediatein classAjaxBehavior- Parameters:
immediate- the flag to be set.
-
isImmediateSet
public boolean isImmediateSet()
Description copied from class:AjaxBehaviorTests whether the immediate attribute is specified. Returns true if the immediate attribute is specified, either as a locally set property or as a value expression. This information allows an associated client behavior renderer to fall back on the parent component's immediate status when immediate is not explicitly specified on the
AjaxBehavior.- Overrides:
isImmediateSetin classAjaxBehavior- Returns:
- the flag whether the immediate attribute is specified.
-
isResetValuesSet
public boolean isResetValuesSet()
Description copied from class:AjaxBehaviorTests whether the resetValues attribute is specified. Returns true if the resetValues attribute is specified, either as a locally set property or as a value expression.
- Overrides:
isResetValuesSetin classAjaxBehavior- Returns:
- the flag whether the resetValues attribute is specified.
-
getValueExpression
public jakarta.el.ValueExpression getValueExpression(String name)
Description copied from class:AjaxBehaviorReturns the
ValueExpressionused to calculate the value for the specified property name, if any.- Overrides:
getValueExpressionin classAjaxBehavior- Parameters:
name- Name of the property for which to retrieve aValueExpression- Returns:
- the
ValueExpression.
-
setValueExpression
public void setValueExpression(String name, jakarta.el.ValueExpression binding)
Description copied from class:AjaxBehaviorSets the
ValueExpressionused to calculate the value for the specified property name.- Overrides:
setValueExpressionin classAjaxBehavior- Parameters:
name- Name of the property for which to set aValueExpressionbinding- TheValueExpressionto set, ornullto remove any currently setValueExpression
-
addAjaxBehaviorListener
public void addAjaxBehaviorListener(AjaxBehaviorListener listener)
Description copied from class:AjaxBehaviorAdd the specified
AjaxBehaviorListenerto the set of listeners registered to receive event notifications from thisAjaxBehavior.- Overrides:
addAjaxBehaviorListenerin classAjaxBehavior- Parameters:
listener- TheAjaxBehaviorListenerto be registered
-
removeAjaxBehaviorListener
public void removeAjaxBehaviorListener(AjaxBehaviorListener listener)
Description copied from class:AjaxBehaviorRemove the specified
AjaxBehaviorListenerfrom the set of listeners registered to receive event notifications from thisAjaxBehavior.- Overrides:
removeAjaxBehaviorListenerin classAjaxBehavior- Parameters:
listener- TheAjaxBehaviorListenerto be removed
-
saveState
public Object saveState(FacesContext context)
Description copied from class:BehaviorBaseImplementation of
StateHolder.saveState(jakarta.faces.context.FacesContext).- Specified by:
saveStatein interfaceStateHolder- Overrides:
saveStatein classAjaxBehavior- Parameters:
context- the Faces context.- Returns:
- the saved state.
-
restoreState
public void restoreState(FacesContext context, Object state)
Description copied from class:BehaviorBase- Specified by:
restoreStatein interfaceStateHolder- Overrides:
restoreStatein classAjaxBehavior- Parameters:
context- the Faces context.state- the state.
-
-