Package javax.faces.validator

Examples of javax.faces.validator.Validator


    }

    @Override
    public Validator createValidator(String validatorId)
    {
        Validator validator = super.createValidator(validatorId);
        _handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), validator);
        return validator;
    }
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);
View Full Code Here

    validateObject(context, value);
  }

  private void validateObject(FacesContext context, Object value) {
    if (null != value) {
      Validator validator = context.getApplication().createValidator(getType());
      if (validator instanceof GraphValidator) {
        GraphValidator graphValidator = (GraphValidator) validator;
        Collection<String> messages = graphValidator.validateGraph(context,this, value,getProfiles());
        if (null != messages) {
          context.renderResponse();
View Full Code Here

  }
 
  protected void validateValue(FacesContext context, Object newValue) {
    Validator[] validators = getValidators();
      for (int i = 0; i < validators.length; i++) {
        Validator validator = (Validator) validators[i];
        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
          setValid(false);
          FacesMessage message = ve.getFacesMessage();
          if (message != null) {
            message.setSeverity(FacesMessage.SEVERITY_ERROR);
            context.addMessage(getClientId(context), message);
          }
        }
      }

      MethodBinding validator = getValidator();
      if (validator != null) {
        try {
          validator.invoke(context,
              new Object[] { context, this, newValue});
        }
        catch (EvaluationException ee) {
          if (ee.getCause() instanceof ValidatorException) {
            ValidatorException ve =
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

     * @see javax.faces.application.Application#createValidator(String)
     */
    public Validator createValidator(String validatorId) throws FacesException {

        Util.notNull("validatorId", validatorId);
        Validator returnVal = (Validator) newThing(validatorId, validatorMap);
        if (returnVal == null) {
            Object[] params = {validatorId};
            if (LOGGER.isLoggable(Level.SEVERE)) {
                LOGGER.log(Level.SEVERE,
                        "jsf.cannot_instantiate_validator_error", params);
View Full Code Here

 
  protected void processingValidators(FacesContext context, Object newValue, boolean isEmpty) {
      if (isValid() && !isEmpty) {
    Validator[] validators = getValidators();
    for (int i = 0; i < validators.length; i++) {
      Validator validator = (Validator) validators[i];
      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
        setValid(false);
        FacesMessage message = ve.getFacesMessage();
        if (message != null) {
          message.setSeverity(FacesMessage.SEVERITY_ERROR);
          context.addMessage(getClientId(context), message);
        }
      }
    }

    MethodBinding validator = getValidator();
    if (validator != null) {
      try {
        validator.invoke(context,
            new Object[] { context, this, newValue});
      }
      catch (EvaluationException ee) {
        if (ee.getCause() instanceof ValidatorException) {
          ValidatorException ve =
View Full Code Here

            // PENDING i18n
            throw new JspException("Not nested in a tag of proper type. Error for tag with handler class:"+
                    this.getClass().getName());
        }

        Validator validator = createValidator();
       
        if (validator == null) {
            // PENDING i18n
            throw new JspException("Can't create class of type:"+
                " javax.faces.validator.Validator.  Validator is null");
View Full Code Here

            // PENDING i18n
            throw new JspException("Not nested in a tag of proper type. Error for tag with handler class:"+
                    this.getClass().getName());
        }

        Validator validator = createValidator();
       
        if (validator == null) {
            //noinspection NonConstantStringShouldBeStringBuffer
            String validateError = null;
            if (binding != null) {
View Full Code Here

     */
    protected Validator createValidator()
        throws JspException {
       
        FacesContext context = FacesContext.getCurrentInstance();
        Validator validator = null;
        ValueExpression vb = null;
       
        // If "binding" is set, use it to create a validator instance.
        if (binding != null) {
            try {
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.