Examples of Required


Examples of org.apache.myfaces.extensions.validator.baseval.annotation.Required

    public void testParameterStyleThree() throws Exception
    {
        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();

        TestPerson person = new TestPerson();
        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);

        assertNotNull(extractor.extract(required).containsKey(TestPriority.class));
        assertNotNull(extractor.extract(required, TestPriority.class).iterator().next());
        assertEquals(new Integer(1), extractor.extract(required, TestPriority.class, Integer.class).iterator().next());
        assertEquals(2, extractor.extract(required, TestPriority.class, String.class).size());
View Full Code Here

Examples of org.apache.myfaces.extensions.validator.baseval.annotation.Required

    public void testParameterStyleFour() throws Exception
    {
        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();

        TestPerson person = new TestPerson();
        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);

        assertNotNull(extractor.extract(required).containsKey(PropertyValidationInterceptor.class));
        assertNotNull(extractor.extract(required, PropertyValidationInterceptor.class).iterator().next());
        assertEquals(1, extractor.extract(required, PropertyValidationInterceptor.class).size());
        assertEquals(TestValidationInterceptor.class.getName(), extractor.extract(required, PropertyValidationInterceptor.class, PropertyValidationInterceptor.class).iterator().next().getClass().getName());
View Full Code Here

Examples of org.apache.myfaces.extensions.validator.baseval.annotation.Required

    public void testParameterStyleFive() throws Exception
    {
        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();

        TestPerson person = new TestPerson();
        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);

        assertNotNull(extractor.extract(required).containsKey(DisableClientSideValidation.class));
        assertNotNull(extractor.extract(required, DisableClientSideValidation.class).iterator().next());
        assertEquals(1, extractor.extract(required, DisableClientSideValidation.class).size());
        assertEquals(1, extractor.extract(required, DisableClientSideValidation.class, Class.class).size());
View Full Code Here

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

     */
    public void overrideContributions(Validator validator, FormComponentContributorContext context,
            IMarkupWriter writer, IRequestCycle cycle)
    {
        // we know this has to be a Required validator
        Required required = (Required)validator;
       
        JSONObject profile = context.getProfile();
       
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        required.accumulateProperty(cons, getClientId(),
                new JSONLiteral("[tapestry.form.validation.isPalleteSelected]"));
       
        required.accumulateProfileProperty(this, profile,
                ValidationConstants.CONSTRAINTS, required.buildMessage(context, this));
    }
View Full Code Here

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

        IRequestCycle cycle = newCycle();
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
        IMarkupWriter writer = newWriter();
       
        JSONObject profile = new JSONObject();
        Required required = new Required("message=Field {0} is required.");
       
        Palette component = newInstance(Palette.class,
                new Object[] {
            "validatableFieldSupport", vfs,
            "clientId", "pal", "displayName", "Pally"});
       
        expect(context.getProfile()).andReturn(profile);
       
        expect(context.formatValidationMessage(eq(required.getMessage()), eq(ValidationStrings.REQUIRED_FIELD),
                aryEq(new Object[] { "Pally" }) )).andReturn("Pally is required.");
       
        replay();
       
        assert component.overrideValidator(required, cycle);
View Full Code Here

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

     */
    public void overrideContributions(Validator validator, FormComponentContributorContext context,
            IMarkupWriter writer, IRequestCycle cycle)
    {
        // we know this has to be a Required validator
        Required required = (Required)validator;
       
        JSONObject profile = context.getProfile();
       
        if (!profile.has(ValidationConstants.CONSTRAINTS)) {
            profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
        }
        JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
       
        required.accumulateProperty(cons, getClientId(),
                new JSONLiteral("[tapestry.form.validation.isPalleteSelected]"));
       
        required.accumulateProfileProperty(this, profile,
                ValidationConstants.CONSTRAINTS, required.buildMessage(context, this));
    }
View Full Code Here

Examples of org.apache.tapestry.validator.Required

     * </ul>
     */
    public static void contributeFieldValidatorSource(
            MappedConfiguration<String, Validator> configuration)
    {
        configuration.add("required", new Required());
        configuration.add("minlength", new MinLength());
        configuration.add("maxlength", new MaxLength());
        configuration.add("min", new Min());
        configuration.add("max", new Max());
    }
View Full Code Here

Examples of org.apache.tapestry.validator.Required

     * </ul>
     */
    public static void contributeFieldValidatorSource(
            MappedConfiguration<String, Validator> configuration)
    {
        configuration.add("required", new Required());
        configuration.add("minlength", new MinLength());
        configuration.add("maxlength", new MaxLength());
        configuration.add("min", new Min());
        configuration.add("max", new Max());
    }
View Full Code Here

Examples of org.apache.tapestry.validator.Required

     * </ul>
     */
    public static void contributeFieldValidatorSource(
            MappedConfiguration<String, Validator> configuration)
    {
        configuration.add("required", new Required());
        configuration.add("minlength", new MinLength());
        configuration.add("maxlength", new MaxLength());
        configuration.add("min", new Min());
        configuration.add("max", new Max());
    }
View Full Code Here

Examples of org.apache.tapestry.validator.Required

     * </ul>
     */
    public static void contributeFieldValidatorSource(
            MappedConfiguration<String, Validator> configuration)
    {
        configuration.add("required", new Required());
        configuration.add("minlength", new MinLength());
        configuration.add("maxlength", new MaxLength());
        configuration.add("min", new Min());
        configuration.add("max", new Max());
        configuration.add("regexp", new Regexp());
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.