Package org.apache.tapestry5

Examples of org.apache.tapestry5.ValidationDecorator


        environment.push(FormSupport.class, formSupport);
        environment.push(ValidationTracker.class, activeTracker);

        if (autofocus)
        {
            ValidationDecorator autofocusDecorator = new AutofocusValidationDecorator(
                    environment.peek(ValidationDecorator.class), activeTracker, jsSupport);
            environment.push(ValidationDecorator.class, autofocusDecorator);
        }

        // Now that the environment is setup, inform the component or other
View Full Code Here


        MarkupRendererFilter defaultValidationDecorator = new MarkupRendererFilter()
        {
            public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer)
            {
                ValidationDecorator decorator = new DefaultValidationDecorator(environment, spacerImage, writer);

                environment.push(ValidationDecorator.class, decorator);

                renderer.renderMarkup(writer);
View Full Code Here

        PartialMarkupRendererFilter defaultValidationDecorator = new PartialMarkupRendererFilter()
        {
            public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer)
            {
                ValidationDecorator decorator = new DefaultValidationDecorator(environment, spacerImage, writer);

                environment.push(ValidationDecorator.class, decorator);

                renderer.renderMarkup(writer, reply);
View Full Code Here

{
    @Test
    public void field_is_disabled()
    {
        Field field = mockField();
        ValidationDecorator delegate = mockValidationDecorator();
        ValidationTracker tracker = mockValidationTracker();
        JavaScriptSupport jsSupport = mockJavaScriptSupport();

        delegate.insideField(field);

        train_isDisabled(field, true);

        replay();

        ValidationDecorator decorator = new AutofocusValidationDecorator(delegate, tracker, jsSupport);

        decorator.insideField(field);

        verify();
    }
View Full Code Here

    @Test
    public void field_is_in_error()
    {
        Field field = mockField();
        ValidationDecorator delegate = mockValidationDecorator();
        ValidationTracker tracker = mockValidationTracker();
        JavaScriptSupport jsSupport = mockJavaScriptSupport();

        delegate.insideField(field);

        train_isDisabled(field, false);
        train_inError(tracker, field, true);

        train_getClientId(field, "foo");

        jsSupport.autofocus(FieldFocusPriority.IN_ERROR, "foo");

        replay();

        ValidationDecorator decorator = new AutofocusValidationDecorator(delegate, tracker, jsSupport);

        decorator.insideField(field);

        verify();
    }
View Full Code Here

    @Test
    public void field_is_required()
    {
        Field field = mockField();
        ValidationDecorator delegate = mockValidationDecorator();
        ValidationTracker tracker = mockValidationTracker();
        JavaScriptSupport jsSupport = mockJavaScriptSupport();

        delegate.insideField(field);

        train_isDisabled(field, false);
        train_inError(tracker, field, false);

        train_isRequired(field, true);

        train_getClientId(field, "foo");

        jsSupport.autofocus(FieldFocusPriority.REQUIRED, "foo");

        replay();

        ValidationDecorator decorator = new AutofocusValidationDecorator(delegate, tracker, jsSupport);

        decorator.insideField(field);

        verify();
    }
View Full Code Here

    @Test
    public void field_is_optional()
    {
        Field field = mockField();
        ValidationDecorator delegate = mockValidationDecorator();
        ValidationTracker tracker = mockValidationTracker();
        JavaScriptSupport jsSupport = mockJavaScriptSupport();

        delegate.insideField(field);

        train_isDisabled(field, false);
        train_inError(tracker, field, false);

        train_isRequired(field, false);

        train_getClientId(field, "foo");

        jsSupport.autofocus(FieldFocusPriority.OPTIONAL, "foo");

        replay();

        ValidationDecorator decorator = new AutofocusValidationDecorator(delegate, tracker, jsSupport);

        decorator.insideField(field);

        verify();
    }
View Full Code Here

    {
        Environment env = mockEnvironment();

        replay();

        ValidationDecorator decorator = new DefaultValidationDecorator(env, null, null);

        decorator.insideLabel(null, null);

        verify();
    }
View Full Code Here

        replay();

        Element e = writer.element("label", "accesskey", "f");

        ValidationDecorator decorator = new DefaultValidationDecorator(env, null, null);

        decorator.insideLabel(field, e);

        assertEquals(writer.toString(),
                     "<?xml version=\"1.0\"?>\n" +
                             "<label class=\"t-error\" accesskey=\"f\"/>");
View Full Code Here

        replay();

        Element e = writer.element("label", "accesskey", "f", "class", "foo");

        ValidationDecorator decorator = new DefaultValidationDecorator(env, null, null);

        decorator.insideLabel(field, e);

        assertEquals(writer.toString(), "<?xml version=\"1.0\"?>\n" +
                "<label class=\"foo t-error\" accesskey=\"f\"/>");

        verify();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ValidationDecorator

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.