Package org.apache.tapestry.form.validator

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


        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

     */
    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

TOP

Related Classes of org.apache.tapestry.form.validator.Required

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.