Package javax.faces.validator

Examples of javax.faces.validator.Validator


                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


        Validator[] validators = number1.getValidators();
        if (validators != null)
        {
            for (int i = 0; i < validators.length; i++)
            {
                Validator validator = validators[i];
                number1.removeValidator(validator);
            }
        }

        UIInput number2 = (UIInput)facesContext.getViewRoot().findComponent("form1:number2");
        validators = number2.getValidators();
        if (validators != null)
        {
            for (int i = 0; i < validators.length; i++)
            {
                Validator validator = validators[i];
                number2.removeValidator(validator);
            }
        }

        UIInput text = (UIInput)facesContext.getViewRoot().findComponent("form2:text");
        validators = text.getValidators();
        if (validators != null)
        {
            for (int i = 0; i < validators.length; i++)
            {
                Validator validator = validators[i];
                text.removeValidator(validator);
            }
        }

        return "ok";
View Full Code Here

        throw new JspException(
          "UIComponent parent of validator must be a EditableValueHolder.");

      EditableValueHolder valueHolder = (EditableValueHolder) comp;

      Validator validator = createValidator();

      valueHolder.addValidator(validator);
    }

    return SKIP_BODY;
View Full Code Here

      if (! (comp instanceof EditableValueHolder))
        throw new JspException("UIComponent parent of validator must be a EditableValueHolder.");

      EditableValueHolder valueHolder = (EditableValueHolder) comp;

      Validator validator = createValidator();

      valueHolder.addValidator(validator);
    }
   
    return SKIP_BODY;
View Full Code Here

  protected Validator createValidator()
    throws JspException
  {
    try {
      FacesContext context = FacesContext.getCurrentInstance();
      Validator validator;

      if (_binding != null) {
        validator = (Validator) _binding.getValue(context.getELContext());

        if (validator != null)
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

            // 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

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.