javax.faces.component.behavior
Class AjaxBehavior

java.lang.Object
  extended by javax.faces.component.behavior.BehaviorBase
      extended by javax.faces.component.behavior.ClientBehaviorBase
          extended by javax.faces.component.behavior.AjaxBehavior
All Implemented Interfaces:
Behavior, ClientBehavior, PartialStateHolder, StateHolder

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.

Since:
2.0

Field Summary
static java.lang.String BEHAVIOR_ID
          

The standard id for this behavior.

 
Constructor Summary
AjaxBehavior()
           
 
Method Summary
 void addAjaxBehaviorListener(AjaxBehaviorListener listener)
          

Add the specified AjaxBehaviorListener to the set of listeners registered to receive event notifications from this AjaxBehavior.

 java.util.Collection<java.lang.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.

 java.util.Set<ClientBehaviorHint> getHints()
          

This method returns an unmodifiable Set containing the ClientBehaviorHint SUBMITTING.

 java.lang.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.

 java.lang.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.

 java.util.Collection<java.lang.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.

 java.lang.String getRendererType()
          

Returns the renderer type of the ClientBehaviorRenderer to use for the behavior.

 javax.el.ValueExpression getValueExpression(java.lang.String name)
          

Returns the ValueExpression used to calculate the value for the specified property name, if any.

 boolean isDisabled()
          

Return the disabled status of this behavior.

 boolean isImmediate()
          

Return the immediate status of this behaivor.

 boolean isImmediateSet()
          

Tests whether the immediate attribute is specified.

 void removeAjaxBehaviorListener(AjaxBehaviorListener listener)
          

Remove the specified AjaxBehaviorListener from the set of listeners registered to receive event notifications from this AjaxBehavior.

 void restoreState(FacesContext context, java.lang.Object state)
          

Implementation of StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object).

 java.lang.Object saveState(FacesContext context)
          

Implementation of StateHolder.saveState(javax.faces.context.FacesContext).

 void setDisabled(boolean disabled)
          

Sets the disabled status of this behavior.

 void setExecute(java.util.Collection<java.lang.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.

 void setImmediate(boolean immediate)
          

Sets the immediate status of this behavior.

 void setOnerror(java.lang.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(java.lang.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(java.util.Collection<java.lang.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.

 void setValueExpression(java.lang.String name, javax.el.ValueExpression binding)
          

Sets the ValueExpression used to calculate the value for the specified property name.

 
Methods inherited from class javax.faces.component.behavior.ClientBehaviorBase
decode, getRenderer, getScript
 
Methods inherited from class javax.faces.component.behavior.BehaviorBase
addBehaviorListener, broadcast, clearInitialState, initialStateMarked, isTransient, markInitialState, removeBehaviorListener, setTransient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.behavior.Behavior
broadcast
 

Field Detail

BEHAVIOR_ID

public static final java.lang.String BEHAVIOR_ID

The standard id for this behavior.

See Also:
Constant Field Values
Constructor Detail

AjaxBehavior

public AjaxBehavior()
Method Detail

getRendererType

public java.lang.String getRendererType()
Description copied from class: 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.

Overrides:
getRendererType in class ClientBehaviorBase
Returns:
the default renderer type, which is null.

getHints

public java.util.Set<ClientBehaviorHint> getHints()

This method returns an unmodifiable Set containing the ClientBehaviorHint SUBMITTING.

Specified by:
getHints in interface ClientBehavior
Overrides:
getHints in class ClientBehaviorBase
Returns:
unmodifiable set containing the hint ClientBehaviorHint SUBMITTING.
Since:
2.0

getOnerror

public java.lang.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.

Since:
2.0

setOnerror

public void setOnerror(java.lang.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.

Parameters:
onerror - the error handling function name
Since:
2.0

getOnevent

public java.lang.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.

Since:
2.0

setOnevent

public void setOnevent(java.lang.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.

Parameters:
onevent - the event handling function name
Since:
2.0

getExecute

public java.util.Collection<java.lang.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).

Since:
2.0

setExecute

public void setExecute(java.util.Collection<java.lang.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.

Parameters:
execute - the ids of components to execute
Since:
2.0

getRender

public java.util.Collection<java.lang.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).

Since:
2.0

setRender

public void setRender(java.util.Collection<java.lang.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.

Parameters:
render - the ids of components to render
Since:
2.0

isDisabled

public boolean isDisabled()

Return the disabled status of this behavior.

Since:
2.0

setDisabled

public void setDisabled(boolean disabled)

Sets the disabled status of this behavior.

Since:
2.0

isImmediate

public boolean isImmediate()

Return the immediate status of this behaivor.

Since:
2.0

setImmediate

public void setImmediate(boolean immediate)

Sets the immediate status of this behavior.

Since:
2.0

isImmediateSet

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.

Since:
2.0

getValueExpression

public javax.el.ValueExpression getValueExpression(java.lang.String name)

Returns the ValueExpression used to calculate the value for the specified property name, if any.

Parameters:
name - Name of the property for which to retrieve a ValueExpression
Throws:
java.lang.NullPointerException - if name is null

setValueExpression

public void setValueExpression(java.lang.String name,
                               javax.el.ValueExpression binding)

Sets the ValueExpression used to calculate the value for the specified property name.

Parameters:
name - Name of the property for which to set a ValueExpression
binding - The ValueExpression to set, or null to remove any currently set ValueExpression
Throws:
java.lang.NullPointerException - if name is null

addAjaxBehaviorListener

public void addAjaxBehaviorListener(AjaxBehaviorListener listener)

Add the specified AjaxBehaviorListener to the set of listeners registered to receive event notifications from this AjaxBehavior.

Parameters:
listener - The AjaxBehaviorListener to be registered
Throws:
java.lang.NullPointerException - if listener is null
Since:
2.0

removeAjaxBehaviorListener

public void removeAjaxBehaviorListener(AjaxBehaviorListener listener)

Remove the specified AjaxBehaviorListener from the set of listeners registered to receive event notifications from this AjaxBehavior.

Parameters:
listener - The AjaxBehaviorListener to be removed
Throws:
java.lang.NullPointerException - if listener is null
Since:
2.0

saveState

public java.lang.Object saveState(FacesContext context)
Description copied from class: BehaviorBase

Implementation of StateHolder.saveState(javax.faces.context.FacesContext).

Specified by:
saveState in interface StateHolder
Overrides:
saveState in class BehaviorBase

restoreState

public void restoreState(FacesContext context,
                         java.lang.Object state)
Description copied from class: BehaviorBase

Implementation of StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object).

Specified by:
restoreState in interface StateHolder
Overrides:
restoreState in class BehaviorBase


Copyright 2002-2010 Oracle America Inc, Inc. All Rights Reserved.