org.ajax4jsf.component.behavior

## Class AjaxBehavior

- java.lang.Object
- - javax.faces.component.behavior.BehaviorBase
  - - javax.faces.component.behavior.ClientBehaviorBase
    - - org.richfaces.component.behavior.ClientBehavior
      - - org.ajax4jsf.component.behavior.AjaxBehavior

- All Implemented Interfaces:
    javax.faces.component.behavior.Behavior, javax.faces.component.behavior.ClientBehavior, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, AjaxClientBehavior, AjaxActivatorProps, AjaxProps
  Direct Known Subclasses:
    ClientValidatorImpl

      public class AjaxBehavior
      extends ClientBehavior
      implements AjaxClientBehavior, AjaxProps

  The <a4j:ajax> behavior allows Ajax capability to be added to a non-Ajax component. The non-Ajax component must implement the ClientBehaviorHolder interface for all the event attributes that support behavior rendering.

  Author:
    Anton Belevich

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BEHAVIOR_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AjaxBehavior()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAjaxBehaviorListener(javax.faces.event.AjaxBehaviorListener listener)`
    `void` | `broadcast(javax.faces.event.BehaviorEvent event)`
    `Object` | `getData()` Serialized (on default with JSON) data passed to the client by a developer on an AJAX request.
    `String` | `getEvent()` Name of JavaScript event property (click, change, etc.) of parent component that triggers the behavior.
    `Object` | `getExecute()` Ids of components that will participate in the "execute" portion of the Request Processing Lifecycle.
    `Set<javax.faces.component.behavior.ClientBehaviorHint>` | `getHints()`
    `javax.el.MethodExpression` | `getListener()` Method expression referencing a method that will be called when an AjaxBehaviorEvent has been broadcast for the listener.
    `String` | `getOnbeforedomupdate()` The client-side script method to be called after the ajax response comes back, but before the DOM is updated
    `String` | `getOnbeforesubmit()` The client-side script method to be called before the AJAX request is submitted
    `String` | `getOnbegin()` The client-side script method to be called before an ajax request.
    `String` | `getOncomplete()` The client-side script method to be called after the DOM is updated
    `String` | `getOnerror()` The client-side script method to be called when an error has occurred during Ajax communications
    `String` | `getQueueId()` Identify the name of the destination queue
    `Object` | `getRender()` Ids of components that will participate in the "render" portion of the Request Processing Lifecycle.
    `String` | `getRendererType()`
    `String` | `getStatus()` Name of the request status component that will indicate the status of the Ajax request
    `boolean` | `isBypassUpdates()` If "true", after process validations phase it skips updates of model beans on a force render response.
    `boolean` | `isDisabled()` If "true", do not initiate an ajax request when the associated event is observed
    `boolean` | `isImmediate()` Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase.
    `boolean` | `isLimitRender()` If "true", render only those ids specified in the "render" attribute, forgoing the render of the auto-rendered panels
    `boolean` | `isResetValues()` If true, indicate that this particular Ajax transaction is a value reset transaction.
    `void` | `removeAjaxBehaviorListener(javax.faces.event.AjaxBehaviorListener listener)`
    `void` | `restoreState(javax.faces.context.FacesContext context, Object state)`
    `Object` | `saveState(javax.faces.context.FacesContext context)`
    `void` | `setBypassUpdates(boolean bypassUpdates)`
    `void` | `setData(Object data)`
    `void` | `setDisabled(boolean disabled)`
    `void` | `setEvent(String event)`
    `void` | `setExecute(Object execute)`
    `void` | `setImmediate(boolean immediate)`
    `void` | `setLimitRender(boolean limitRender)`
    `void` | `setListener(javax.el.MethodExpression listener)`
    `void` | `setLiteralAttribute(String name, Object value)`
    `void` | `setOnbeforedomupdate(String onbeforedomupdate)`
    `void` | `setOnbeforesubmit(String onbeforesubmit)`
    `void` | `setOnbegin(String onbegin)`
    `void` | `setOncomplete(String oncomplete)`
    `void` | `setOnerror(String onerror)`
    `void` | `setQueueId(String queueId)`
    `void` | `setRender(Object render)`
    `void` | `setResetValues(boolean resetValues)`
    `void` | `setStatus(String status)`

    - ### Methods inherited from class org.richfaces.component.behavior.ClientBehavior

      `compare, getFacesContext, getStateHelper, getValueExpression, setLiteralValue, setValueExpression`

    - ### Methods inherited from class javax.faces.component.behavior.ClientBehaviorBase

      `decode, getRenderer, getScript`

    - ### Methods inherited from class javax.faces.component.behavior.BehaviorBase

      `addBehaviorListener, 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.ClientBehavior

      `decode, getScript`

- - ### Field Detail

    - #### BEHAVIOR_ID

          public static final String BEHAVIOR_ID

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AjaxBehavior

          public AjaxBehavior()

  - ### Method Detail

    - #### setLiteralAttribute

          public void setLiteralAttribute(String name,
                                          Object value)

      Specified by:
        `setLiteralAttribute` in class `ClientBehavior`

    - #### getData

          public Object getData()

      Serialized (on default with JSON) data passed to the client by a developer on an AJAX request. It's accessible via "event.data" syntax. Both primitive types and complex types such as arrays and collections can be serialized and used with data
      Specified by:
        `getData` in interface `AjaxClientBehavior`
      Specified by:
        `getData` in interface `AjaxActivatorProps`

    - #### setData

          public void setData(Object data)

      Specified by:
        `setData` in interface `AjaxClientBehavior`

    - #### getEvent

          public String getEvent()

      Name of JavaScript event property (click, change, etc.) of parent component that triggers the behavior. If the event attribute is not defined, the behavior is triggered on the event that normally provides interaction behavior for the parent component

    - #### setEvent

          public void setEvent(String event)

    - #### getListener

          public javax.el.MethodExpression getListener()

      Method expression referencing a method that will be called when an AjaxBehaviorEvent has been broadcast for the listener.

    - #### setListener

          public void setListener(javax.el.MethodExpression listener)

    - #### getExecute

          public Object getExecute()

      Ids of components that will participate in the "execute" portion of the Request Processing Lifecycle. Can be a single id, a space or comma separated list of Id's, or an EL Expression evaluating to an array or Collection. Any of the keywords "@this", "@form", "@all", "@none", "@region" may be specified in the identifier list. Some components make use of additional keywords
      Specified by:
        `getExecute` in interface `AjaxClientBehavior`
      Specified by:
        `getExecute` in interface `AjaxProps`

    - #### setExecute

          public void setExecute(Object execute)

      Specified by:
        `setExecute` in interface `AjaxClientBehavior`

    - #### getOnbeforedomupdate

          public String getOnbeforedomupdate()

      The client-side script method to be called after the ajax response comes back, but before the DOM is updated
      Specified by:
        `getOnbeforedomupdate` in interface `AjaxClientBehavior`
      Specified by:
        `getOnbeforedomupdate` in interface `AjaxActivatorProps`

    - #### setOnbeforedomupdate

          public void setOnbeforedomupdate(String onbeforedomupdate)

      Specified by:
        `setOnbeforedomupdate` in interface `AjaxClientBehavior`

    - #### getOnbegin

          public String getOnbegin()

      The client-side script method to be called before an ajax request.
      Specified by:
        `getOnbegin` in interface `AjaxClientBehavior`
      Specified by:
        `getOnbegin` in interface `AjaxProps`

    - #### setOnbegin

          public void setOnbegin(String onbegin)

      Specified by:
        `setOnbegin` in interface `AjaxClientBehavior`

    - #### getOnbeforesubmit

          public String getOnbeforesubmit()

      The client-side script method to be called before the AJAX request is submitted
      Specified by:
        `getOnbeforesubmit` in interface `AjaxClientBehavior`

    - #### setOnbeforesubmit

          public void setOnbeforesubmit(String onbeforesubmit)

      Specified by:
        `setOnbeforesubmit` in interface `AjaxClientBehavior`

    - #### getOncomplete

          public String getOncomplete()

      The client-side script method to be called after the DOM is updated
      Specified by:
        `getOncomplete` in interface `AjaxClientBehavior`
      Specified by:
        `getOncomplete` in interface `AjaxActivatorProps`

    - #### setOncomplete

          public void setOncomplete(String oncomplete)

      Specified by:
        `setOncomplete` in interface `AjaxClientBehavior`

    - #### getOnerror

          public String getOnerror()

      The client-side script method to be called when an error has occurred during Ajax communications
      Specified by:
        `getOnerror` in interface `AjaxClientBehavior`

    - #### setOnerror

          public void setOnerror(String onerror)

      Specified by:
        `setOnerror` in interface `AjaxClientBehavior`

    - #### getQueueId

          public String getQueueId()

      Identify the name of the destination queue
      Specified by:
        `getQueueId` in interface `AjaxClientBehavior`

    - #### setQueueId

          public void setQueueId(String queueId)

      Specified by:
        `setQueueId` in interface `AjaxClientBehavior`

    - #### getRender

          public Object getRender()

      Ids of components that will participate in the "render" portion of the Request Processing Lifecycle. Can be a single id, a space or comma separated list of Id's, or an EL Expression evaluating to an array or Collection. Any of the keywords "@this", "@form", "@all", "@none", "@region" may be specified in the identifier list. Some components make use of additional keywords
      Specified by:
        `getRender` in interface `AjaxClientBehavior`
      Specified by:
        `getRender` in interface `AjaxActivatorProps`

    - #### setRender

          public void setRender(Object render)

      Specified by:
        `setRender` in interface `AjaxClientBehavior`

    - #### getStatus

          public String getStatus()

      Name of the request status component that will indicate the status of the Ajax request
      Specified by:
        `getStatus` in interface `AjaxClientBehavior`
      Specified by:
        `getStatus` in interface `AjaxProps`

    - #### setStatus

          public void setStatus(String status)

      Specified by:
        `setStatus` in interface `AjaxClientBehavior`

    - #### isDisabled

          public boolean isDisabled()

      If "true", do not initiate an ajax request when the associated event is observed
      Specified by:
        `isDisabled` in interface `AjaxClientBehavior`

    - #### setDisabled

          public void setDisabled(boolean disabled)

      Specified by:
        `setDisabled` in interface `AjaxClientBehavior`

    - #### isLimitRender

          public boolean isLimitRender()

      If "true", render only those ids specified in the "render" attribute, forgoing the render of the auto-rendered panels
      Specified by:
        `isLimitRender` in interface `AjaxClientBehavior`
      Specified by:
        `isLimitRender` in interface `AjaxActivatorProps`

    - #### setLimitRender

          public void setLimitRender(boolean limitRender)

      Specified by:
        `setLimitRender` in interface `AjaxClientBehavior`

    - #### isImmediate

          public boolean isImmediate()

      Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase.

    - #### setImmediate

          public void setImmediate(boolean immediate)

    - #### isBypassUpdates

          public boolean isBypassUpdates()

      If "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input

    - #### setBypassUpdates

          public void setBypassUpdates(boolean bypassUpdates)

    - #### isResetValues

          public boolean isResetValues()

      If true, indicate that this particular Ajax transaction is a value reset transaction. This will cause resetValue() to be called on any EditableValueHolder instances encountered as a result of this ajax transaction. If not specified, or the value is false, no such indication is made.
      Specified by:
        `isResetValues` in interface `AjaxClientBehavior`
      Specified by:
        `isResetValues` in interface `AjaxActivatorProps`

    - #### setResetValues

          public void setResetValues(boolean resetValues)

      Specified by:
        `setResetValues` in interface `AjaxClientBehavior`

    - #### getRendererType

          public String getRendererType()

      Overrides:
        `getRendererType` in class `javax.faces.component.behavior.ClientBehaviorBase`

    - #### getHints

          public Set<javax.faces.component.behavior.ClientBehaviorHint> getHints()

      Specified by:
        `getHints` in interface `javax.faces.component.behavior.ClientBehavior`
      Overrides:
        `getHints` in class `javax.faces.component.behavior.ClientBehaviorBase`

    - #### addAjaxBehaviorListener

          public void addAjaxBehaviorListener(javax.faces.event.AjaxBehaviorListener listener)

      Specified by:
        `addAjaxBehaviorListener` in interface `AjaxClientBehavior`

    - #### removeAjaxBehaviorListener

          public void removeAjaxBehaviorListener(javax.faces.event.AjaxBehaviorListener listener)

      Specified by:
        `removeAjaxBehaviorListener` in interface `AjaxClientBehavior`

    - #### broadcast

          public void broadcast(javax.faces.event.BehaviorEvent event)
                         throws javax.faces.event.AbortProcessingException

      Specified by:
        `broadcast` in interface `javax.faces.component.behavior.Behavior`
      Overrides:
        `broadcast` in class `javax.faces.component.behavior.BehaviorBase`
      Throws:
        `javax.faces.event.AbortProcessingException`

    - #### restoreState

          public void restoreState(javax.faces.context.FacesContext context,
                                   Object state)

      Specified by:
        `restoreState` in interface `javax.faces.component.StateHolder`
      Overrides:
        `restoreState` in class `ClientBehavior`

    - #### saveState

          public Object saveState(javax.faces.context.FacesContext context)

      Specified by:
        `saveState` in interface `javax.faces.component.StateHolder`
      Overrides:
        `saveState` in class `ClientBehavior`

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.