Package javax.faces.validator

Examples of javax.faces.validator.Validator


    {
        // first invoke the list of validator components
        Validator[] validators = input.getValidators();
        for (int i = 0; i < validators.length; i++)
        {
            Validator validator = validators[i];
            try
            {
                validator.validate(context, input, convertedValue);
            }
            catch (ValidatorException e)
            {
                input.setValid(false);
                FacesMessage facesMessage = e.getFacesMessage();
View Full Code Here


        if (!componentTag.getCreated())
        {
            return Tag.SKIP_BODY;
        }

        Validator validator = createValidator();

        UIComponent component = componentTag.getComponentInstance();
        if (component == null)
        {
            throw new JspException("parent UIComponentTag has no UIComponent");
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

        EditableValueHolder holder = (EditableValueHolder) input;

        Validator[] validators = holder.getValidators();
        for (int i = 0; i < validators.length; i++)
        {
            Validator validator = validators[i];
            try
            {
                validator.validate(context, input, convertedValue);
            }
            catch (ValidatorException e)
            {
                holder.setValid(false);
                FacesMessage facesMessage = e.getFacesMessage();
View Full Code Here

                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, actionListener);
                                }
                                else if ("validator".equals(attributeName))
                                {
                                   //First try to remove any prevous target if any
                                    Validator o = (Validator) mctx.removeMethodExpressionTargeted(innerComponent, attributeName);
                                    if (o != null)
                                    {
                                        ((EditableValueHolder)innerComponent).removeValidator(o);
                                    }
                                   
                                    // target is EditableValueHolder
                                    methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
                                            createMethodExpression(elContext,
                                                attributeExpressionString, Void.TYPE,
                                                VALIDATOR_SIGNATURE), attributeNameValueExpression);
       
                                    Validator validator = new MethodExpressionValidator(methodExpression);
                                    ((EditableValueHolder)innerComponent).addValidator( validator );
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, validator);
                                }
                                else if ("valueChangeListener".equals(attributeName))
                                {
View Full Code Here

    * validator specified in pages.xml, and using Hibernate Validator
    * annotations specified on the model.
    */
   public void validateConvertedValue(FacesContext facesContext, Object value)
   {
      Validator validator = getValidator();
      if (validator!=null)
      {
         validator.validate( facesContext, facesContext.getViewRoot(), value );
      }
     
      if (valueExpression!=null)
      {
         //TODO: note that this code is duplicated from ModelValidator!!
View Full Code Here

        if (event instanceof PostAddToViewEvent) {
            FacesContext facesContext = FacesContext.getCurrentInstance();

            EditableValueHolder component = (EditableValueHolder) event.getComponent();

            Validator validator = facesContext.getApplication().createValidator(SelectLabelValueValidator.ID);
            component.addValidator(validator);
        }
    }
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

        if (!componentTag.getCreated())
        {
            return Tag.SKIP_BODY;
        }

        Validator validator = createValidator();

        UIComponent component = componentTag.getComponentInstance();
        if (component == null)
        {
            throw new JspException("parent UIComponentTag has no UIComponent");
View Full Code Here

    static void callValidators(FacesContext context, UIInput input, Object convertedValue)
    {
        Validator[] validators = input.getValidators();
        for (int i = 0; i < validators.length; i++)
        {
            Validator validator = validators[i];
            try
            {
                validator.validate(context, input, convertedValue);
            }
            catch (ValidatorException e)
            {
                input.setValid(false);
                FacesMessage facesMessage = e.getFacesMessage();
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.