Examples of FieldValidator


Examples of org.apache.tapestry5.FieldValidator

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(globalMessages, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidators(field, "required,minLength=15");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.FieldValidator

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(globalMessages, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidator(field, "minLength", "5");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.FieldValidator

        replay();

        FieldValidatorSource source = new FieldValidatorSourceImpl(globalMessages, coercer, fs, map, macro);

        FieldValidator fieldValidator = source.createValidator(field, "foo-bar-baz", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.FieldValidator

      final String overrideId, final Messages overrideMessages,
      final Locale locale, final Class propertyType,
      final AnnotationProvider propertyAnnotations)
  {
   
    FieldValidator validator = fieldValidatorDefaultSource.createDefaultValidator(
        field, overrideId, overrideMessages, locale, propertyType, propertyAnnotations);

   
    FieldValidator beanValidator
      = new BeanFieldValidator(field, validatorFactory, beanValidationGroupSource,
          clientValidatorSource, formSupport, environment);
   
    return new CompositeFieldValidator(Arrays.asList(validator, beanValidator));
  }
View Full Code Here

Examples of org.apache.tapestry5.FieldValidator

                "value", visible ? validationTracker.getInput(this) : "");

        resources.renderInformalParameters(writer);

        FieldValidator fieldValidator = fieldValidatorSource.createValidator(this, "required", null);

        fieldValidator.render(writer);

        writer.end();

        return false;
    }
View Full Code Here

Examples of org.crank.validation.FieldValidator

     * @throws Exception
     */
    private void findAndExecuteValidationRule(PrintWriter writer, String validatorName,
            String value, String type) throws Exception {
        /* Look up the validator in the object registry. */
        FieldValidator validator = lookupValidatorInRegistry(validatorName);
        log.info("Found validator " + validator);

        /* Convert the object if the type is specified. */
        Object oValue = null;
        if (type == null || "".equals(type.trim())) {
            oValue = value;
        } else {
            oValue = convertIfNeeded(value, type);
        }

        /* Actually validated the field. */
        ValidatorMessage message = (ValidatorMessage) validator.validate(oValue, "none");
        if (!message.hasError()) {
            log.info("VALID");
            writer.print("valid");
        } else {
            log.info("NOT VALID");
View Full Code Here

Examples of org.crank.validation.FieldValidator

     * @return
     */
    private FieldValidator lookupValidatorInRegistry(String validator) {
        ObjectRegistry applicationContext = CrankContext.getObjectRegistry();

        FieldValidator fvalidator = (FieldValidator) applicationContext.getObject(
                CrankConstants.FRAMEWORK_PREFIX + CrankConstants.FRAMEWORK_DELIM
                        + "validator" + CrankConstants.FRAMEWORK_DELIM + validator,
                FieldValidator.class);
        return fvalidator;
    }
View Full Code Here

Examples of org.exolab.castor.xml.FieldValidator

        } else {
            _nodeType = nodeType;
        }

        if (isRequired()) {
            _validator = new FieldValidator();
            _validator.setMinOccurs(1);
            _validator.setDescriptor(this);
        }
    }
View Full Code Here

Examples of org.exolab.castor.xml.FieldValidator

                            throw new ValidationException(err);
                        }
                        found = true;
                        fieldDesc = desc;

                        FieldValidator fieldValidator = desc.getValidator();
                        if (fieldValidator != null) {
                            fieldValidator.validate(object, context);
                        }
                    }
                }

                // if all elements are mandatory, print the grammar that the choice
                // must match.
                if ((!found) && (hasLocalDescs))  {
                    StringBuffer buffer = new StringBuffer(40);
                    boolean existsOptionalElement = false;
                    buffer.append('(');
                    String sep = " | ";
                    for (int i = 0; i < localElements.length; i++) {
                        XMLFieldDescriptor  desc = localElements[i];
                        if (desc == null) {
                            continue;
                        }

                        FieldValidator fieldValidator = desc.getValidator();
                        if (fieldValidator.getMinOccurs() == 0) {
                            existsOptionalElement = true;
                            break;
                        }
                        buffer.append(sep);
                        buffer.append(desc.getXMLName());
View Full Code Here

Examples of org.exolab.castor.xml.FieldValidator

     *          field to validate.
     * @throws ValidationException If validation did report a problem.
     */
    private void validateField(final Object object, final ValidationContext context,
            final XMLFieldDescriptor fieldDescriptor) throws ValidationException {
        FieldValidator fieldValidator = fieldDescriptor.getValidator();
        if (fieldValidator != null) {
            try {
                fieldValidator.validate(object, context);
            } catch (ValidationException e) {
                if (fieldDescriptor.getNodeType() == NodeType.Attribute
                        || fieldDescriptor.getNodeType() == NodeType.Element) {
                    addLocationInformation(fieldDescriptor, e);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.