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();

        IFormComponent field = newField("Fred");

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

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

        context
                .addSubmitListener("function(event) { require(event, document.fred.barney, '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();

        IFormComponent field = newField("Fred");

        context.registerForFocus(ValidationConstants.REQUIRED_FIELD);

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

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

        context
                .addSubmitListener("function(event) { require(event, document.fred.barney, '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");

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

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

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

        replayControls();
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");

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

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

        context
                .addSubmitListener("function(event) { validate_regex(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/NumberValidator.js");

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

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

        context
                .addSubmitListener("function(event) { validate_min_number(event, document.myform.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");
        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.getFieldDOM();
        contextc.setReturnValue("document.myform.myfield");

        context
                .addSubmitListener("function(event) { validate_min_number(event, document.myform.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();
        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_LONG, new Object[]
        { new Integer(20), "My Field" }, "default\\message");

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

        replayControls();

        new MaxLength("maxLength=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/NumberValidator.js");

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

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

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

        replayControls();

        new Max("max=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/NumberValidator.js");

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

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

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

        replayControls();

        new Max("max=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();

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

        IFormComponent field = newField("Fred");

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

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

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

        replayControls();
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.