Package javax.faces.validator

Examples of javax.faces.validator.Validator


  @Override
  public void processUpdates(FacesContext context) {
    super.processUpdates(context);
    Object value = getValue();
    if (null != value) {
      Validator validator = context.getApplication().createValidator(getType());
      if (validator instanceof GraphValidator) {
        GraphValidator graphValidator = (GraphValidator) validator;
        String[] messages = graphValidator.validateGraph(context,this, value,getProfile());
        if (null != messages) {
          context.renderResponse();
View Full Code Here


        // value must be a String
        if (!(value instanceof String)) {
            Object[] args = { value };
            throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_NOT_STRING_MESSAGE_ID, args));
        }
        Validator validator = facesContext.getApplication().createValidator(getSubvalidatorId());
        if (getSeparator() == null)
            setSeparator(DEFAULT_SEPARATOR);
        String[] values = null;
        try {
            values = ((String)value).split(getSeparator());
        }
        catch (PatternSyntaxException e) {
            Object[] args = { getSeparator() };
            throw new ValidatorException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, CSV_INVALID_SEPARATOR_MESSAGE_ID, args));
        }
       
        // loop through the separated values and validate each one
        for (int i = 0; i < values.length; i++) {
            if (values[i].trim().length() == 0) {
                continue;
            }
            else try {
                validator.validate(facesContext, uiComponent, values[i]);
            }
            catch (ValidatorException e) {
                facesMsg = addMessage(facesMsg, e.getFacesMessage(), i, suffixMessageKey);
            }
        }
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

    private 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

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

    else
    {
      Iterator<Validator> validators = (Iterator<Validator>)getFacesBean().entries(VALIDATORS_KEY);
      while (validators.hasNext())
      {
        Validator validator = validators.next();
        try
        {
          validator.validate(context, this, newValue);
        }
        catch (ValidatorException ve)
        {
          // If the validator throws an exception, we're
          // invalid, and we need to add a message
View Full Code Here

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

                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

            throw new FacesException(message);
        }

        try
        {
            Validator validator = (Validator) validatorClass.newInstance();
           
            _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), validator);
           
            return validator;
        }
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.