org.richfaces.component.behavior

## Class ClientValidatorImpl

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

- All Implemented Interfaces:
    javax.faces.component.behavior.Behavior, javax.faces.component.behavior.ClientBehavior, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, ClientValidatorBehavior, org.richfaces.ui.ajax.ajax.AjaxClientBehavior

      public class ClientValidatorImpl
      extends org.ajax4jsf.component.behavior.AjaxBehavior
      implements ClientValidatorBehavior

  The <rich:validator> behavior adds client-side validation to a form input control based on registered server-side validators. It provides this validation without the need to reproduce the server-side annotations.

  The <rich:validator> behavior triggers all client validator annotations listed in the relevant managed bean.

  Author:
    asmirnov@exadel.com

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `ClientValidatorImpl.Properties`

  - ### Field Summary

    - ### Fields inherited from class org.ajax4jsf.component.behavior.AjaxBehavior

      `BEHAVIOR_ID`

    - ### Fields inherited from interface org.richfaces.component.behavior.ClientValidatorBehavior

      `BEHAVIOR_TYPE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientValidatorImpl()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `broadcast(javax.faces.event.BehaviorEvent event)`
    `protected boolean` | `findMessages(javax.faces.component.UIComponent parent, javax.faces.component.UIComponent component, Set<javax.faces.component.UIComponent> messages, boolean found, Object id)` Recursive search messages for the parent component.
    `protected void` | `findRichMessages(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String id, Set<javax.faces.component.UIComponent> messages)` Find all instances of the `UIRichMessages` and update list of the rendered messages.
    `String` | `getAjaxScript(javax.faces.component.behavior.ClientBehaviorContext context)` Get JavaScript code for AJAX request.
    `org.richfaces.validator.ConverterDescriptor` | `getConverter(javax.faces.component.behavior.ClientBehaviorContext context)` Look up for converter associated with target UIInput
    `Collection<String>` | `getExecute()`
    `Class<?>[]` | `getGroups()` Returns array of classes that represents JSR-303 validation groups.
    `Set<javax.faces.component.UIComponent>` | `getMessages(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)`
    `String` | `getOninvalid()`
    `String` | `getOnvalid()`
    `Collection<String>` | `getRender()`
    `protected javax.faces.render.ClientBehaviorRenderer` | `getRenderer(javax.faces.context.FacesContext context, String rendererType)` Look up for `ClientBehaviorRenderer` instence
    `String` | `getRendererType()`
    `String` | `getScript(javax.faces.component.behavior.ClientBehaviorContext behaviorContext)`
    `Collection<org.richfaces.validator.ValidatorDescriptor>` | `getValidators(javax.faces.component.behavior.ClientBehaviorContext context)`
    `boolean` | `isBypassUpdates()`
    `boolean` | `isImmediateSet()`
    `boolean` | `isLimitRender()`
    `void` | `restoreState(javax.faces.context.FacesContext context, Object state)`
    `Object` | `saveState(javax.faces.context.FacesContext context)`
    `void` | `setGroups(Class<?>... groups)`
    `void` | `setLiteralAttribute(String name, Object value)`
    `void` | `setOninvalid(String value)`
    `void` | `setOnvalid(String value)`

    - ### Methods inherited from class org.ajax4jsf.component.behavior.AjaxBehavior

      `addAjaxBehaviorListener, getData, getHints, getOnbeforedomupdate, getOnbeforesubmit, getOnbegin, getOncomplete, getOnerror, getQueueId, getStatus, isDisabled, isImmediate, removeAjaxBehaviorListener, setBypassUpdates, setData, setDisabled, setExecute, setImmediate, setLimitRender, setOnbeforedomupdate, setOnbeforesubmit, setOnbegin, setOncomplete, setOnerror, setQueueId, setRender, setStatus`

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

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

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

      `decode, getRenderer`

    - ### 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 org.richfaces.component.behavior.ClientValidatorBehavior

      `isDisabled, isImmediate`

    - ### Methods inherited from interface javax.faces.component.behavior.ClientBehavior

      `decode, getHints`

- - ### Constructor Detail

    - #### ClientValidatorImpl

          public ClientValidatorImpl()

  - ### Method Detail

    - #### getScript

          public String getScript(javax.faces.component.behavior.ClientBehaviorContext behaviorContext)

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

    - #### getRendererType

          public String getRendererType()

      Overrides:
        `getRendererType` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### 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 `org.ajax4jsf.component.behavior.AjaxBehavior`
      Throws:
        `javax.faces.event.AbortProcessingException`

    - #### setLiteralAttribute

          public void setLiteralAttribute(String name,
                                 Object value)

      Overrides:
        `setLiteralAttribute` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### getMessages

          public Set<javax.faces.component.UIComponent> getMessages(javax.faces.context.FacesContext context,
                                                           javax.faces.component.UIComponent component)

    - #### findRichMessages

          protected void findRichMessages(javax.faces.context.FacesContext context,
                              javax.faces.component.UIComponent component,
                              String id,
                              Set<javax.faces.component.UIComponent> messages)

      Find all instances of the `UIRichMessages` and update list of the rendered messages.
      Parameters:
        `context` -
        `component` -
        `messages` -

    - #### findMessages

          protected boolean findMessages(javax.faces.component.UIComponent parent,
                             javax.faces.component.UIComponent component,
                             Set<javax.faces.component.UIComponent> messages,
                             boolean found,
                             Object id)

      Recursive search messages for the parent component.
      Parameters:
        `parent` -
        `component` -
        `messages` -
        `id` -

    - #### getRenderer

          protected javax.faces.render.ClientBehaviorRenderer getRenderer(javax.faces.context.FacesContext context,
                                                              String rendererType)

      Look up for `ClientBehaviorRenderer` instence

      Parameters:
        `context` - current JSF context
        `rendererType` - desired renderer type
      Returns:
        renderer instance
      Throws:
        `{@link` - FacesException} if renderer can not be found

    - #### getConverter

          public org.richfaces.validator.ConverterDescriptor getConverter(javax.faces.component.behavior.ClientBehaviorContext context)
                                                                   throws ConverterNotFoundException

      Description copied from interface: `ClientValidatorBehavior`

      Look up for converter associated with target UIInput

      Specified by:
        `getConverter` in interface `ClientValidatorBehavior`
      Returns:
        `Converter` instance or null if conversion not required.
      Throws:
        `ConverterNotFoundException`

    - #### getValidators

          public Collection<org.richfaces.validator.ValidatorDescriptor> getValidators(javax.faces.component.behavior.ClientBehaviorContext context)

      Description copied from interface: `ClientValidatorBehavior`

      Specified by:
        `getValidators` in interface `ClientValidatorBehavior`

    - #### getGroups

          public Class<?>[] getGroups()

      Description copied from interface: `ClientValidatorBehavior`

      Returns array of classes that represents JSR-303 validation groups.

      Specified by:
        `getGroups` in interface `ClientValidatorBehavior`

    - #### setGroups

          public void setGroups(Class<?>... groups)

      Specified by:
        `setGroups` in interface `ClientValidatorBehavior`

    - #### getAjaxScript

          public String getAjaxScript(javax.faces.component.behavior.ClientBehaviorContext context)

      Description copied from interface: `ClientValidatorBehavior`

      Get JavaScript code for AJAX request.

      Specified by:
        `getAjaxScript` in interface `ClientValidatorBehavior`

    - #### saveState

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

      Specified by:
        `saveState` in interface `javax.faces.component.StateHolder`
      Overrides:
        `saveState` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### restoreState

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

      Specified by:
        `restoreState` in interface `javax.faces.component.StateHolder`
      Overrides:
        `restoreState` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### isImmediateSet

          public boolean isImmediateSet()

      Specified by:
        `isImmediateSet` in interface `ClientValidatorBehavior`

    - #### isLimitRender

          public boolean isLimitRender()

      Specified by:
        `isLimitRender` in interface `org.richfaces.ui.ajax.ajax.AjaxClientBehavior`
      Overrides:
        `isLimitRender` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### isBypassUpdates

          public boolean isBypassUpdates()

      Overrides:
        `isBypassUpdates` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### getExecute

          public Collection<String> getExecute()

      Specified by:
        `getExecute` in interface `org.richfaces.ui.ajax.ajax.AjaxClientBehavior`
      Overrides:
        `getExecute` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### getRender

          public Collection<String> getRender()

      Specified by:
        `getRender` in interface `org.richfaces.ui.ajax.ajax.AjaxClientBehavior`
      Overrides:
        `getRender` in class `org.ajax4jsf.component.behavior.AjaxBehavior`

    - #### getOnvalid

          public String getOnvalid()

      Specified by:
        `getOnvalid` in interface `ClientValidatorBehavior`

    - #### setOnvalid

          public void setOnvalid(String value)

    - #### getOninvalid

          public String getOninvalid()

      Specified by:
        `getOninvalid` in interface `ClientValidatorBehavior`

    - #### setOninvalid

          public void setOninvalid(String value)

Copyright © 2014 JBoss by Red Hat. All rights reserved.