Package org.apache.tapestry5

Examples of org.apache.tapestry5.FieldValidator


    @SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
    @Test
    public void event_trigger_throws_validation_exception() throws Exception
    {
        ComponentResources resources = mockComponentResources();
        FieldValidator fv = mockFieldValidator();

        Object value = new Object();

        ValidationException ve = new ValidationException("Bah!");
        RuntimeException re = new RuntimeException(ve);

        ComponentEventCallback handler = null;

        fv.validate(value);

        expect(resources.triggerEvent(eq(EventConstants.VALIDATE),
                                      EasyMock.aryEq(new Object[] {value}), eq(handler))).andThrow(re);

View Full Code Here


            public FieldValidator createDefaultValidator(Field field, String overrideId, Messages overrideMessages,
                    Locale locale, Class propertyType, AnnotationProvider propertyAnnotations)
            {
                environment.push(EnvironmentMessages.class, new EnvironmentMessages(overrideMessages, overrideId));
                FieldValidator fieldValidator = defaultSource.createDefaultValidator(field, overrideId,
                        overrideMessages, locale, propertyType, propertyAnnotations);
                environment.pop(EnvironmentMessages.class);
                return fieldValidator;
            }

            public FieldValidator createDefaultValidator(ComponentResources resources, String parameterName)
            {

                EnvironmentMessages em = new EnvironmentMessages(resources.getContainerMessages(), resources.getId());
                environment.push(EnvironmentMessages.class, em);
                FieldValidator fieldValidator = defaultSource.createDefaultValidator(resources, parameterName);
                environment.pop(EnvironmentMessages.class);
                return fieldValidator;
            }
        };
    }
View Full Code Here

      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

        replay();

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

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

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

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

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

        FieldValidator fieldValidator = source.createValidator(field, "required", null);

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

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

        FieldValidator fieldValidator = source.createValidators(field, "minlength");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

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

        FieldValidator fieldValidator = source.createValidators(field, "minlength");

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

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

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

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

        replay();

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

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

        fieldValidator.validate(inputValue);

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.FieldValidator

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.