Package org.apache.tapestry.form

Examples of org.apache.tapestry.form.FormComponentContributorContext


        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();

        MockControl contextc = newControl(FormComponentContributorContext.class);
        FormComponentContributorContext context = (FormComponentContributorContext) contextc
                .getMock();

        context.includeClasspathScript("/org/apache/tapestry/form/validator/RegExValidator.js");

        IFormComponent field = newField("Fred");

        trainFormatMessage(
                contextc,
                context,
                "custom",
                ValidationStrings.REGEX_MISMATCH,
                new Object[]
                { "Fred" },
                "custom\\message");

        context.getFieldDOM();
        contextc.setReturnValue("document.fred.barney");

        context
                .addSubmitListener("function(event) { validate_regexp(event, document.fred.barney, '"
                        + pattern + "', 'custom\\\\message'); }");

        replayControls();
View Full Code Here


    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IFormComponent field = newField("My Field");
        MockControl contextc = newControl(FormComponentContributorContext.class);
        FormComponentContributorContext context = (FormComponentContributorContext) contextc
                .getMock();

        context.includeClasspathScript("/org/apache/tapestry/form/validator/StringValidator.js");

        context.getFieldDOM();
        contextc.setReturnValue("document.myform.myfield");

        trainFormatMessage(contextc, context, null, ValidationStrings.VALUE_TOO_SHORT, new Object[]
        { new Integer(20), "My Field" }, "default message");

        context
                .addSubmitListener("function(event) { validate_min_length(event, document.myform.myfield, 20, 'default message'); }");

        replayControls();

        new MinLength("minLength=20").renderContribution(writer, cycle, context, field);
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        IFormComponent field = newField("My Field");
        MockControl contextc = newControl(FormComponentContributorContext.class);
        FormComponentContributorContext context = (FormComponentContributorContext) contextc
                .getMock();

        context.includeClasspathScript("/org/apache/tapestry/form/validator/StringValidator.js");

        context.getFieldDOM();
        contextc.setReturnValue("document.myform.myfield");

        trainFormatMessage(
                contextc,
                context,
                "custom",
                ValidationStrings.VALUE_TOO_SHORT,
                new Object[]
                { new Integer(25), "My Field" },
                "custom\\message");

        context
                .addSubmitListener("function(event) { validate_min_length(event, document.myform.myfield, 25, 'custom\\\\message'); }");

        replayControls();

        new MinLength("minLength=25,message=custom").renderContribution(
View Full Code Here

        JSONObject json = new JSONObject();
       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        expect(context.getProfile()).andReturn(json);
       
        trainGetLocale(context, Locale.ENGLISH);
       
        trainBuildMessage(context, null, ValidationStrings.INVALID_NUMBER,
                new Object[] { "Number Field", "#" }, "invalid number message");
View Full Code Here

        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        JSONObject json = new JSONObject();
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);

        expect(context.getProfile()).andReturn(json);
       
        trainGetLocale(context, Locale.ENGLISH);
       
        trainBuildMessage(
                context,
View Full Code Here

        JSONObject json = new JSONObject();
       
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        expect(context.getProfile()).andReturn(json);
       
        trainGetLocale(context, Locale.ENGLISH);
       
        trainBuildMessage(context, null, ValidationStrings.INVALID_NUMBER, new Object[]
        { "Number Field", "#" }, "invalid number message");
       
        expect(context.getProfile()).andReturn(json);
       
        replay();

        translator.setTrim(true);
       
View Full Code Here

        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
       
        IFormComponent field = newField("My Field", "myfield");
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        Locale locale = Locale.FRANCE;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
       
        expect(context.getLocale()).andReturn(locale);
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(context, null, ValidationStrings.VALUE_TOO_SMALL, new Object[]
        { "My Field", new Double(20) }, "default message");
       
        replay();
View Full Code Here

       
        JSONObject json = new JSONObject();
       
        IFormComponent field = newField("My Field", "myfield");
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        Locale locale = Locale.FRANCE;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
       
        expect(context.getLocale()).andReturn(locale);
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(
                context,
                "custom",
                ValidationStrings.VALUE_TOO_SMALL,
View Full Code Here

        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
       
        IFormComponent field = newField("My Field", "myfield");
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        Locale locale = Locale.GERMAN;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
       
        expect(context.getLocale()).andReturn(locale);
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(context, null, ValidationStrings.VALUE_TOO_LARGE, new Object[]
        { "My Field", new Double(20) }, "default message");
       
        replay();
View Full Code Here

       
        JSONObject json = new JSONObject();
       
        IFormComponent field = newField("My Field", "myfield");
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        Locale locale = Locale.JAPAN;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
       
        expect(context.getLocale()).andReturn(locale);
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(
                context,
                "custom",
                ValidationStrings.VALUE_TOO_LARGE,
View Full Code Here

TOP

Related Classes of org.apache.tapestry.form.FormComponentContributorContext

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.