Package org.apache.tapestry.form

Examples of org.apache.tapestry.form.FormComponentContributorContext


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


        JSONObject json = new JSONObject();

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

        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);

        expect(context.getProfile()).andReturn(json);
        context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");

        trainGetLocale(context, Locale.US);

        trainBuildMessage(context, null, ValidationStrings.INVALID_NUMBER, new String[] { "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);
        context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");
       
        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);
        context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");
       
        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

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        IFormComponent field = newField("Fred", "myfield");
       
        context.addInitializationScript(field, "dojo.require(\"dojo.validate.web\");");
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(context, null, ValidationStrings.INVALID_EMAIL,
                new Object[] { "Fred" }, "default\\message");
       
        replay();
View Full Code Here

    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
       
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
       
        IFormComponent field = newField("Fred", "barney");
       
        context.addInitializationScript(field, "dojo.require(\"dojo.validate.web\");");
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(
                context,
                "custom",
                ValidationStrings.INVALID_EMAIL,
View Full Code Here

    public void test_Render_Contribution()
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
        IFormComponent field = newField("My Field", "myfield");

        context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");

        Locale locale = Locale.FRANCE;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
       
        expect(context.getLocale()).andReturn(locale).atLeastOnce();
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(context, null, ValidationStrings.VALUE_TOO_SMALL, new Object[]
        { "My Field", String.valueOf(new Double(20).doubleValue())}, "default message");
       
        replay();
View Full Code Here

    public void test_Render_Contribution_Custom_Message()
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
        IFormComponent field = newField("My Field", "myfield");

        context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");

        Locale locale = Locale.FRANCE;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
       
        expect(context.getLocale()).andReturn(locale).atLeastOnce();
        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);
       
        expect(context.getProfile()).andReturn(json);
       
        trainFormatMessage(context, null, ValidationStrings.VALUE_TOO_LONG,
                new Object[] { new Integer(20), "My Field" }, "default\\message");
       
        replay();
View Full Code Here

    public void test_Render_Contribution()
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        JSONObject json = new JSONObject();
        FormComponentContributorContext context = newMock(FormComponentContributorContext.class);
        IFormComponent field = newField("My Field", "myfield");

        context.addInitializationScript(field, "dojo.require(\"dojo.i18n.number\");");

        Locale locale = Locale.GERMAN;
        DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);

        expect(context.getLocale()).andReturn(locale).anyTimes();
        expect(context.getProfile()).andReturn(json);

        trainFormatMessage(context, null, ValidationStrings.VALUE_TOO_LARGE,
                           new Object[] {
                                   "My Field",
                                   new Double(20).toString()
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.