Package org.apache.tapestry.form.validator

Examples of org.apache.tapestry.form.validator.Validator


       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(field);
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getForm();
        fieldControl.setReturnValue(form);

        form.isClientValidationEnabled();
        formControl.setReturnValue(true);

        field.getForm();
        fieldControl.setReturnValue(form);

        form.getName();
        formControl.setReturnValue("myform");

        field.getName();
        fieldControl.setReturnValue("myfield");

        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());
       
        FormComponentContributorContext context = new FormComponentContributorContextImpl(field);
       
        validator.renderContribution(writer, cycle, context, field);
        validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
        { new EqualsMatcher(), new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));       
       
        replayControls();
View Full Code Here


       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        Object object = new Object();

        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        ValidationMessages messages = new ValidationMessagesImpl(field, Locale.ENGLISH);
       
        try
        {
            validator.validate(field, messages, object);
            validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
            { new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));
           
            replayControls();
   
View Full Code Here

       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        Object object = new Object();

        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        ValidationMessages messages = new ValidationMessagesImpl(field, Locale.ENGLISH);
       
        ValidatorException expected = new ValidatorException("test");
       
        try
        {
            validator.validate(field, messages, object);
            validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
            { new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));
            validatorControl.setThrowable(expected);
           
            replayControls();
View Full Code Here

       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        validator.getAcceptsNull();
        validatorControl.setReturnValue(true);

        ValidationMessages messages = new ValidationMessagesImpl(field, Locale.ENGLISH);
       
        try
        {
            validator.validate(field, messages, null);
            validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
            { new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));
           
            replayControls();
   
View Full Code Here

       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        validator.getAcceptsNull();
        validatorControl.setReturnValue(false);
       
        try
        {
            replayControls();
View Full Code Here

    }

    private Validator newValidator(boolean isRequired)
    {
        MockControl control = newControl(Validator.class);
        Validator validator = (Validator) control.getMock();

        validator.isRequired();
        control.setReturnValue(isRequired);

        return validator;
    }
View Full Code Here

            Iterator validators = getValidatorsIterator(component);

            while (validators.hasNext())
            {
                Validator validator = (Validator) validators.next();

                validator.renderContribution(writer, cycle, context, component);
            }
        }
    }
View Full Code Here

            ValidationMessages messages = new ValidationMessagesImpl(_threadLocale.getLocale());

            while (validators.hasNext())
            {
                Validator validator = (Validator) validators.next();

                if (isNonNull || validator.getAcceptsNull())
                    validator.validate(component, messages, object);
            }

            // Only get here if it translated OK and then validated OK.

            // NOTE: May need to have the Translator implement a provideNullValue() method, i.e.,
View Full Code Here

       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle(field);
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        field.getForm();
        fieldControl.setReturnValue(form);

        form.isClientValidationEnabled();
        formControl.setReturnValue(true);

        field.getForm();
        fieldControl.setReturnValue(form);

        form.getName();
        formControl.setReturnValue("myform");

        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());
       
        FormComponentContributorContext context = new FormComponentContributorContextImpl(field);
       
        validator.renderContribution(writer, cycle, context, field);
        validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
        { new EqualsMatcher(), new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));       
       
        replayControls();
View Full Code Here

       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        MockControl validatorControl = newControl(Validator.class);
        Validator validator = (Validator) validatorControl.getMock();
       
        Object object = new Object();

        field.getValidators();
        fieldControl.setReturnValue(validator);
       
        converter.coerceValue(validator, Iterator.class);
        converterControl.setReturnValue(Collections.singleton(validator).iterator());

        ValidationMessages messages = new ValidationMessagesImpl(field, Locale.ENGLISH);
       
        try
        {
            validator.validate(field, messages, object);
            validatorControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
            { new EqualsMatcher(), new TypeMatcher(), new EqualsMatcher() }));
           
            replayControls();
   
View Full Code Here

TOP

Related Classes of org.apache.tapestry.form.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.