Package javax.faces.validator

Examples of javax.faces.validator.LengthValidator


    }
 
 
  private LengthValidator validadorLongitud()
  {
    LengthValidator lv = new LengthValidator();
  lv.setMinimum(1);
  lv.setMaximum(2);
  return lv;
  }
View Full Code Here


   
    inputText.setValueExpression("value", bindingValue)
   
   
    // VALIDADOR
    final LengthValidator validator = (LengthValidator) application.createValidator(LengthValidator.VALIDATOR_ID);

    validator.setMinimum(minimum);
      validator.setMaximum(maximum);
   
    // camp obligatori
    if (obligatori)
    {
      inputText.setRequired(obligatori);
View Full Code Here

        }

        this.setRequired((required != null) ? required : Boolean.FALSE);

        if ((maxLength != null) && (maxLength > 0)) {
            addValidator(new LengthValidator(maxLength));
        }

        encodeHiddenField(writer, hiddenFieldClientId, value);
        initializeEditorScriptIfRequired(writer, requestMap, context);
        encodeHtmlEditor(context, writer, hiddenFieldClientId, htmlEditorClientId, width, height, showButtons);
View Full Code Here

        this.input = input;
    }

    public Validator getValidator() {
        if (validator == null) {
            validator = new LengthValidator(5, 1);   
        }
        return validator;
    }
View Full Code Here

// Methods from ValidatorTag
//

    protected Validator createValidator() throws JspException {

        LengthValidator result = (LengthValidator)
            super.createValidator();
        assert (null != result);

        evaluateExpressions();
        if (maximumSet) {
            result.setMaximum(maximum);
        }

        if (minimumSet) {
            result.setMinimum(minimum);
        }

        return result;
    }
View Full Code Here

        writer.writeAttribute(HtmlAttributes.TITLE, title, true);
      }
      int maxLength = 0;
      for (Validator validator : input.getValidators()) {
        if (validator instanceof LengthValidator) {
          LengthValidator lengthValidator = (LengthValidator) validator;
          maxLength = lengthValidator.getMaximum();
        }
      }
      if (maxLength > 0) {
        writer.writeAttribute(HtmlAttributes.MAXLENGTH, maxLength);
      }
View Full Code Here

// Methods from ValidatorTag
//

    protected Validator createValidator() throws JspException {

        LengthValidator result = (LengthValidator)
            super.createValidator();
        assert (null != result);

        evaluateExpressions();
        if (maximumSet) {
            result.setMaximum(maximum);
        }

        if (minimumSet) {
            result.setMinimum(minimum);
        }

        return result;
    }
View Full Code Here

            } else {
                messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;// What to use for that case ( no min/max set,
                                                                         // validator always pass ).
            }
        } else if (component instanceof LengthValidator) {
            LengthValidator validator = (LengthValidator) component;
            if (validator.getMaximum() > 0) {
                if (validator.getMinimum() > 0) {
                    messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
                } else {
                    messageId = LengthValidator.MAXIMUM_MESSAGE_ID;
                }
            } else if (validator.getMinimum() > 0) {
                messageId = LengthValidator.MINIMUM_MESSAGE_ID;
            } else {
                messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;// What to use for that case ( no min/max set,
                                                                         // validator always pass ).
            }
        } else if (component instanceof LongRangeValidator) {
            LongRangeValidator validator = (LongRangeValidator) component;
            if (validator.getMaximum() != LONG_RANGE_VALIDATOR_DEFAULTS.getMaximum()) {
                if (validator.getMinimum() != LONG_RANGE_VALIDATOR_DEFAULTS.getMinimum()) {
                    messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;
                } else {
                    messageId = LongRangeValidator.MAXIMUM_MESSAGE_ID;
                }
            } else if (validator.getMinimum() != LONG_RANGE_VALIDATOR_DEFAULTS.getMinimum()) {
                messageId = LongRangeValidator.MINIMUM_MESSAGE_ID;
            } else {
                messageId = DoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID;// What to use for that case ( no min/max set,
                                                                         // validator always pass ).
            }
View Full Code Here

            }
            if (validator.getMinimum() > Double.MIN_VALUE) {
                descriptor.addParameter(MINIMUM, validator.getMinimum());
            }
        } else if (component instanceof LengthValidator) {
            LengthValidator validator = (LengthValidator) component;
            if (validator.getMaximum() > 0) {
                descriptor.addParameter(MAXIMUM, validator.getMaximum());
            }
            if (validator.getMinimum() > 0) {
                descriptor.addParameter(MINIMUM, validator.getMinimum());
            }
        } else if (component instanceof LongRangeValidator) {
            LongRangeValidator validator = (LongRangeValidator) component;
            if (validator.getMaximum() != 0) {
                descriptor.addParameter(MAXIMUM, validator.getMaximum());
            }
            if (validator.getMinimum() != 0) {
                descriptor.addParameter(MINIMUM, validator.getMinimum());
            }
        } else if (component instanceof RegexValidator) {
            RegexValidator validator = (RegexValidator) component;
            descriptor.addParameter(PATTERN, validator.getPattern());
        } else if (component instanceof RequiredValidator) {
            // do nothing.
        } else {
            super.fillParameters(descriptor, component);
        }
View Full Code Here

// Methods from ValidatorTag
//

    protected Validator createValidator() throws JspException {

        LengthValidator result = (LengthValidator)
            super.createValidator();
        assert (null != result);

        evaluateExpressions();
        if (maximumSet) {
            result.setMaximum(maximum);
        }

        if (minimumSet) {
            result.setMinimum(minimum);
        }

        return result;
    }
View Full Code Here

TOP

Related Classes of javax.faces.validator.LengthValidator

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.