Package org.apache.tapestry.form

Examples of org.apache.tapestry.form.FormComponentContributorContext


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

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

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

        context
                .addSubmitHandler("function(event) { Tapestry.validate_min_number(event, 'myfield', 20.0, 'default message'); }");

        replayControls();

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


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

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

        trainFormatMessage(
                contextc,
                context,
                "custom",
                ValidationStrings.VALUE_TOO_SMALL,
                new Object[]
                { "My Field", new Double(20) },
                "custom\\message");

        context
                .addSubmitHandler("function(event) { Tapestry.validate_min_number(event, 'myfield', 20.0, 'custom\\\\message'); }");

        replayControls();

        new Min("min=20,message=custom").renderContribution(writer, cycle, context, field);
View Full Code Here

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

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

        IFormComponent field = newFieldWithClientId("myfield");

        trainTrim(context, "myfield");
View Full Code Here

    public void testRenderComponentNoOp()
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        FormComponentContributorContext context = newContext();
        IFormComponent field = newField();

        replayControls();

        new MaxDate().renderContribution(writer, cycle, context, field);
View Full Code Here

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

        IFormComponent field = newFieldWithClientId("foo");

        FormComponentContributorContext context = (FormComponentContributorContext) newMock(FormComponentContributorContext.class);

        trainTrim(context, "foo");

        replayControls();
View Full Code Here

    public void testRenderComponentNoOp()
    {
        IMarkupWriter writer = newWriter();
        IRequestCycle cycle = newCycle();
        FormComponentContributorContext context = newContext();
        IFormComponent field = newField();

        replayControls();

        new MinDate().renderContribution(writer, cycle, context, field);
View Full Code Here

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

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

        IFormComponent field = newField("Fred", "fred");

        context.registerForFocus(ValidationConstants.REQUIRED_FIELD);

        trainFormatMessage(
                contextc,
                context,
                null,
                ValidationStrings.REQUIRED_FIELD,
                new Object[]
                { "Fred" },
                "Default\\Message for Fred.");

        context
                .addSubmitHandler("function(event) { Tapestry.require_field(event, 'fred', 'Default\\\\Message for Fred.'); }");

        replayControls();

        new Required().renderContribution(writer, cycle, context, field);
View Full Code Here

        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", "myfield");

        trainFormatMessage(contextc, context, null, ValidationStrings.INVALID_EMAIL, new Object[]
        { "Fred" }, "default\\message");

        context.addSubmitHandler("function(event) { Tapestry.validate_regex(event, 'myfield', '"
                + pattern + "', 'default\\\\message'); }");

        replayControls();

        new Email().renderContribution(writer, cycle, context, field);
View Full Code Here

        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", "barney");

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

        context.addSubmitHandler("function(event) { Tapestry.validate_regex(event, 'barney', '"
                + pattern + "', 'custom message'); }");

        replayControls();

        new Email("message=custom").renderContribution(writer, cycle, context, field);
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

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.