Package org.apache.tapestry

Examples of org.apache.tapestry.ValidationDecorator


    @Inject
    private Environment _environment;

    void beginRender(MarkupWriter writer)
    {
        ValidationDecorator existing = _environment.peekRequired(ValidationDecorator.class);

        _environment.push(ValidationDecorator.class, new ChattyValidationDecorator(writer, existing));
    }
View Full Code Here


        // a inner class causes a java.lang.Verify error (Unable to pop operand off an empty stack).
        // Perhaps this is a Javassist error? Shouldn't the inner class be going through a synthetic
        // accessor method of some kind? Resolved by assigning to a local variable and referencing
        // that. Layers on layers, oh my!

        final ValidationDecorator decorator = _decorator;

        // Since we don't know if the field has rendered yet, we need to defer writing the for
        // attribute until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

                element.forceAttributes("for", fieldId);

                decorator.insideLabel(field, element);
            }
        };

        _heartbeat.defer(command);
    }
View Full Code Here

        environment.pop(ValidationDecorator.class);
    }

    public void setup(Environment environment)
    {
        ValidationDecorator decorator = new DefaultValidationDecorator(environment);

        environment.push(ValidationDecorator.class, decorator);
    }
View Full Code Here

    {
        Environment env = newEnvironment();

        replay();

        ValidationDecorator decorator = new DefaultValidationDecorator(env);

        decorator.insideLabel(null, null);

        verify();
    }
View Full Code Here

        replay();

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

        ValidationDecorator decorator = new DefaultValidationDecorator(env);

        decorator.insideLabel(field, e);

        assertEquals(writer.toString(), "<label accesskey=\"f\" class=\"t-error\"/>");

        verify();
    }
View Full Code Here

        replay();

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

        ValidationDecorator decorator = new DefaultValidationDecorator(env);

        decorator.insideLabel(field, e);

        assertEquals(writer.toString(), "<label accesskey=\"f\" class=\"foo t-error\"/>");

        verify();
    }
View Full Code Here

                "value",
                "freddy",
                "size",
                "30");

        ValidationDecorator decorator = new DefaultValidationDecorator(env);

        decorator.insideField(field);

        assertEquals(
                writer.toString(),
                "<input class=\"foo t-error\" name=\"ex\" size=\"30\" type=\"text\" value=\"freddy\"/>");
View Full Code Here

        train_peekRequired(env, ValidationTracker.class, tracker);
        train_inError(tracker, field, false);

        replay();

        ValidationDecorator decorator = new DefaultValidationDecorator(env);

        decorator.insideField(field);

        verify();
    }
View Full Code Here

        train_peekRequired(env, ValidationTracker.class, tracker);
        train_inError(tracker, field, false);

        replay();

        ValidationDecorator decorator = new DefaultValidationDecorator(env);

        decorator.insideLabel(field, null);

        verify();
    }
View Full Code Here

        // a inner class causes a java.lang.Verify error (Unable to pop operand off an empty stack).
        // Perhaps this is a Javassist error? Shouldn't the inner class be going through a synthetic
        // accessor method of some kind? Resolved by assigning to a local variable and referencing
        // that. Layers on layers, oh my!

        final ValidationDecorator decorator = _decorator;

        // Since we don't know if the field has rendered yet, we need to defer writing the for
        // attribute until we know the field has rendered (and set its clientId property). That's
        // exactly what Heartbeat is for.

        Runnable command = new Runnable()
        {
            public void run()
            {
                String fieldId = field.getClientId();

                element.forceAttributes("for", fieldId, "id", fieldId + ":label");

                decorator.insideLabel(field, element);
            }
        };

        _heartbeat.defer(command);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.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.