Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-9507

ClientValidatorRendererunit tests and implementation.

    Details

    • Estimated Difficulty:
      Medium

      Description

      ClientValidator renderer getScript method:

      • performs arguments check ( not null, behavior is instance of ClientValidatorBehavior.
      • get Converter instance from behavior by getConverter method, then use ClientScriptLookupService to find client-side JavaScript. Both ConverterNotFoundException and ScriptNotFoundException enforce AJAX callback rendering unless input component has no validators.
      • If Converter script found, get Collection of validators from behavior. If collection is empty, return null instead of script. Otherwise, loop through all validators to construct client-side validator function, using ClientScriptLookupService. Record number of validators that cannot be performed on client.
      • If there is no Converter script or at least one validator has no client-side version, add AJAX callback to client-side validator.
      • Find or Create UIValidatorScript in UIView.viewResources associated with "form" target. Create ScriptObject that will be used to build validator call. If UIValidatorScript already contains ScriptObject with same signature use its function name for page size optimization. Problem: JSF 2.0 doesn't like components tree changes, and specification does not allow dynamic including of script libraries. At least, it seems not possible to change controls with client-side validation by AJAX. Solution: use the same way as queue component ( create UIValidatorScript in ViewHandler )
      • Return JavaScript code that calls function build by ScriptObject.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  alexsmirnov Alexander Smirnov
                  Reporter:
                  alexsmirnov Alexander Smirnov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: