Package javax.faces.validator

Examples of javax.faces.validator.Validator


    // make sure that this UIComponent has just been created:
    if (tag.getCreated())
    {
      // Create and register an instance with the appropriate component
      Validator validator = createValidator();
      if (validator != null)
      {
        EditableValueHolder evh = (EditableValueHolder) tag.getComponentInstance();
        evh.addValidator(validator);
      }
View Full Code Here


    final ValueBinding binding;
    // 1. if there is a binding, then use that to get a Validator instance.
    if (_binding != null)
    {
      binding = context.getApplication().createValueBinding(_binding);
      Validator validator = (Validator) binding.getValue(context);
      if (validator != null)
        return validator;
    }
    else
      binding = null;

    // 2. if there was no binding, or the binding returned null, then use
    // the validatorId to get at an instance.
    if (_validatorId != null)
    {
      Validator validator =
        context.getApplication().createValidator(_validatorId);
      // 3. if there was a binding, then set the Validator instance on the binding.
      if (binding != null)
        binding.setValue(context, validator);
      return validator;
View Full Code Here

            // tag is enabled --> create the validator and attach it
           
            // cast to a ValueHolder
            EditableValueHolder evh = (EditableValueHolder) parent;
            ValueExpression ve = null;
            Validator v = null;
            if (_delegate.getBinding() != null)
            {
                ve = _delegate.getBinding().getValueExpression(faceletContext, Validator.class);
                v = (Validator) ve.getValue(faceletContext);
            }
View Full Code Here

    }

    private void addDefaultValidator(FaceletContext ctx, FaceletCompositionContext mctx, FacesContext context,
            EditableValueHolder component, String validatorId, String validatorClassName)
    {
        Validator enclosingValidator = null;
       
        if (validatorClassName == null)
        {
            // we have no class name for validators of enclosing <f:validateBean> tags
            // --> we have to create it to get the class name
            // note that normally we can use this instance later anyway!
            enclosingValidator = context.getApplication().createValidator(validatorId);
            validatorClassName = enclosingValidator.getClass().getName();
        }
       
        // check if the validator is already registered for the given component
        // this happens if <f:validateBean /> is nested inside the component on the view
        Validator validator = null;
        for (Validator v : component.getValidators())
        {
            if (v.getClass().getName().equals(validatorClassName))
            {
                // found
View Full Code Here

            {
                attachedObjectHandler.applyAttachedObject(context, (UIComponent) component);
            }
            else
            {
                Validator validator = null;
                // create it
                validator = context.getApplication().createValidator(validatorId);

                // special things to configure for a BeanValidator
                if (validator instanceof BeanValidator)
View Full Code Here

                nestedObjects = true;
                stream.println('>');
                mustClose = false;
                for (int i = 0; i < validators.length; i++)
                {
                    Validator validator = validators[i];
                    printIndent(stream, indent + 1);
                    stream.print('<');
                    stream.print(validator.getClass().getName());
                    stream.println("/>");
                }
            }
        }
View Full Code Here

            String attributeExpressionString,
            ValueExpression attributeNameValueExpression,
            boolean ccAttrMeRedirection)
    {
        //First try to remove any prevous target if any
        Validator o = (Validator) mctx.removeMethodExpressionTargeted(innerComponent, targetAttributeName);
        if (o != null)
        {
            ((EditableValueHolder) innerComponent).removeValidator(o);
        }

        // target is EditableValueHolder
        Validator validator = null;
        // If it is a redirection, a wrapper is used to locate the right instance and call it properly.
        if (ccAttrMeRedirection)
        {
            validator = new RedirectMethodExpressionValueExpressionValidator(attributeNameValueExpression);
        }
View Full Code Here

            throw new FacesException(message);
        }

        try
        {
            Validator validator = (Validator) validatorClass.newInstance();
           
            _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), validator);
           
            return validator;
        }
View Full Code Here

            throw new FacesException(message);
        }

        try
        {
            Validator validator = (Validator) validatorClass.newInstance();
           
            _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), validator);
           
            return validator;
        }
View Full Code Here

            disabledIds.add(owner.getValidatorId(ctx));
            return;
        }

        ValueExpression ve = null;
        Validator v = null;
        if (owner.getBinding() != null) {
            ve = owner.getBinding().getValueExpression(ctx, Validator.class);
            v = (Validator) ve.getValue(ctx);
        }
        if (v == null) {
View Full Code Here

TOP

Related Classes of javax.faces.validator.Validator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.