public class AjaxBehavior extends ClientBehaviorBase
An instance of this class
is added as a ClientBehavior
to a component using the ClientBehaviorHolder.addClientBehavior(java.lang.String, javax.faces.component.behavior.ClientBehavior)
contract that components implement. The presence of this ClientBehavior
will cause the rendering of JavaScript that produces
an Ajax
request using the specification public
JavaScript API when the component is rendered.
If the component is an instance
of EditableValueHolder
, Where at all
possible, the component must have the UI register the ajax event when
the initial value is changed, not when focus is lost on the
component.
Modifier and Type | Field and Description |
---|---|
static String |
BEHAVIOR_ID
The standard id for this behavior. |
Constructor and Description |
---|
AjaxBehavior() |
Modifier and Type | Method and Description |
---|---|
void |
addAjaxBehaviorListener(AjaxBehaviorListener listener)
Add the specified |
String |
getDelay()
Returns the delay value, or |
Collection<String> |
getExecute()
Return a non-empty
|
Set<ClientBehaviorHint> |
getHints()
This method returns an unmodifiable |
String |
getOnerror()
Return the |
String |
getOnevent()
Return the |
Collection<String> |
getRender()
Return a non-empty
|
String |
getRendererType()
Returns the renderer type of the
|
ValueExpression |
getValueExpression(String name)
Returns the |
boolean |
isDisabled()
Return the disabled status of this behavior. |
boolean |
isImmediate()
Return the immediate status of this behavior. |
boolean |
isImmediateSet()
Tests whether the immediate attribute is specified. |
boolean |
isResetValues()
Return the resetValues status of this behavior. |
boolean |
isResetValuesSet()
Tests whether the resetValues attribute is specified. |
void |
removeAjaxBehaviorListener(AjaxBehaviorListener listener)
Remove the specified |
void |
restoreState(FacesContext context,
Object state)
Implementation of
|
Object |
saveState(FacesContext context)
Implementation of
|
void |
setDelay(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. |
void |
setDisabled(boolean disabled)
Sets the disabled status of this behavior. |
void |
setExecute(Collection<String> execute)
Sets the component identifiers that
will be used to identify components that should be
processed during the |
void |
setImmediate(boolean immediate)
Sets the immediate status of this behavior. |
void |
setOnerror(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. |
void |
setOnevent(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. |
void |
setRender(Collection<String> render)
Sets the component identifiers that
will be used to identify components that should be
processed during the |
void |
setResetValues(boolean resetValues)
Set the resetValues status of this behavior. |
void |
setValueExpression(String name,
ValueExpression binding)
Sets the |
decode, getRenderer, getScript
addBehaviorListener, broadcast, clearInitialState, initialStateMarked, isTransient, markInitialState, removeBehaviorListener, setTransient
public static final String BEHAVIOR_ID
The standard id for this behavior.
public String getRendererType()
ClientBehaviorBase
Returns the renderer type of the
ClientBehaviorRenderer
to use for the behavior. The default
implementation returns null. Subclasses should either override this
method to return a string that identifies the type of
ClientBehaviorRenderer
to use, or should override
ClientBehaviorBase.getScript(javax.faces.component.behavior.ClientBehaviorContext)
and perform script rendering locally in the
ClientBehavior
implementation.
getRendererType
in class ClientBehaviorBase
public Set<ClientBehaviorHint> getHints()
This method returns an unmodifiable Set
containing
the ClientBehaviorHint
SUBMITTING
.
getHints
in interface ClientBehavior
getHints
in class ClientBehaviorBase
ClientBehaviorHint
SUBMITTING
.public String getOnerror()
Return the String
of
JavaScript function name that will be used to identify
the client callback function that should be run in the event of
an error.
ONERROR
.public void setOnerror(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.
onerror
- the error handling function namepublic String getOnevent()
Return the String
of
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.
ONEVENT
.public void setOnevent(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.
onevent
- the event handling function namepublic Collection<String> getExecute()
Return a non-empty
Collection<String>
of component
identifiers that will be used to identify components that should be
processed during the execute
phase of the request
processing lifecycle.
Note that the returned collection may be unmodifiable. Modifications
should be performed by calling setExecute(java.util.Collection<java.lang.String>)
.
EXECUTE
.public void setExecute(Collection<String> execute)
Sets the component identifiers that
will be used to identify components that should be
processed during the execute
phase of the request
processing lifecycle.
execute
- the ids of components to executepublic String getDelay()
Returns the delay value, or null
if no value was set.
public void setDelay(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. 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.
delay
- the ajax delay valuepublic Collection<String> getRender()
Return a non-empty
Collection<String>
of component
identifiers that will be used to identify components that should be
processed during the render
phase of the request
processing lifecycle.
Note that the returned collection may be unmodifiable. Modifications
should be performed by calling setRender(java.util.Collection<java.lang.String>)
.
public void setRender(Collection<String> render)
Sets the component identifiers that
will be used to identify components that should be
processed during the render
phase of the request
processing lifecycle.
render
- the ids of components to renderpublic boolean isResetValues()
Return the resetValues status of this behavior.
public void setResetValues(boolean resetValues)
Set the resetValues status of this behavior.
resetValues
- the resetValues status.public boolean isDisabled()
Return the disabled status of this behavior.
public void setDisabled(boolean disabled)
Sets the disabled status of this behavior.
disabled
- the flag to be set.public boolean isImmediate()
Return the immediate status of this behavior.
public void setImmediate(boolean immediate)
Sets the immediate status of this behavior.
immediate
- the flag to be set.public boolean isImmediateSet()
Tests 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
.
public boolean isResetValuesSet()
Tests 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.
public ValueExpression getValueExpression(String name)
Returns the ValueExpression
used to calculate the value for the specified property name, if any.
name
- Name of the property for which to retrieve a
ValueExpression
ValueExpression
.NullPointerException
- if name
is null
public void setValueExpression(String name, ValueExpression binding)
Sets the ValueExpression
used to calculate the value for the specified property name.
name
- Name of the property for which to set a
ValueExpression
binding
- The ValueExpression
to set, or null
to remove any currently set ValueExpression
NullPointerException
- if name
is null
public void addAjaxBehaviorListener(AjaxBehaviorListener listener)
Add the specified AjaxBehaviorListener
to the set of listeners registered to receive event notifications
from this AjaxBehavior
.
listener
- The AjaxBehaviorListener
to be registeredNullPointerException
- if listener
is null
public void removeAjaxBehaviorListener(AjaxBehaviorListener listener)
Remove the specified AjaxBehaviorListener
from the set of listeners registered to receive event notifications
from this AjaxBehavior
.
listener
- The AjaxBehaviorListener
to be removedNullPointerException
- if listener
is null
public Object saveState(FacesContext context)
BehaviorBase
Implementation of
StateHolder.saveState(javax.faces.context.FacesContext)
.
saveState
in interface StateHolder
saveState
in class BehaviorBase
context
- the Faces context.public void restoreState(FacesContext context, Object state)
BehaviorBase
Implementation of
StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)
.
restoreState
in interface StateHolder
restoreState
in class BehaviorBase
context
- the Faces context.state
- the state.Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.