Package org.apache.tapestry

Examples of org.apache.tapestry.Field


    @Test
    public void long_value() throws Exception
    {
        String label = "My Field";
        Field field = newFieldWithLabel(label);
        MessageFormatter formatter = newMessageFormatter();
        String value = "Now the student has become the master.";
        String message = "{message}";
        Integer constraint = value.length() - 1;
View Full Code Here


    @Test
    public void record_error_for_field()
    {
        ValidationTracker tracker = newValidationTracker();
        String message = "A recorded message.";
        Field field = newField();

        tracker.recordError(field, message);

        replay();
View Full Code Here

{
    @SuppressWarnings("unchecked")
    @Test
    public void null_value_skipped() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();

        train_invokeIfBlank(validator, false);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void blank_value_skipped() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();

        train_invokeIfBlank(validator, false);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void nonmatching_value_type_skipped() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();
        Integer value = 15;

        train_invokeIfBlank(validator, true);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void value_type_check_skipped_for_null_values() throws Exception
    {
        Field field = newField();
        MessageFormatter formatter = newMessageFormatter();
        Validator validator = newValidator();

        train_invokeIfBlank(validator, true);
View Full Code Here

        FieldValidatorSource source = newFieldValidatorSource();
        Class propertyType = Integer.class;
        AnnotationProvider provider = newAnnotationProvider();
        String overrideId = "overrideId";
        Messages overrideMessages = newMessages();
        Field field = newField();
        Locale locale = Locale.ENGLISH;
        String value = "*VALUE*";

        train_buildConstraints(gen, propertyType, provider, "cons1", "cons2");

View Full Code Here

        FieldValidatorSource source = newFieldValidatorSource();
        Class propertyType = Integer.class;
        AnnotationProvider provider = newAnnotationProvider();
        String overrideId = "overrideId";
        Messages overrideMessages = newMessages();
        Field field = newField();
        Locale locale = Locale.ENGLISH;

        train_buildConstraints(gen, propertyType, provider, "foo=bar");

        train_createValidator(source, field, "foo", "bar", overrideId, overrideMessages, locale, fv);
View Full Code Here

        FieldValidatorSource source = newFieldValidatorSource();
        Class propertyType = Integer.class;
        AnnotationProvider provider = newAnnotationProvider();
        String overrideId = "overrideId";
        Messages overrideMessages = newMessages();
        Field field = newField();
        Locale locale = Locale.ENGLISH;
        String value = "*VALUE*";

        train_buildConstraints(gen, propertyType, provider);

View Full Code Here

    private ComponentResources _resources;

    @BeginRender
    void begin(MarkupWriter writer)
    {
        final Field field = _field;

        final Element element = writer.element("label");

        _resources.renderInformalParameters(writer);

        // Uh oh! Referencing a private field (that happens to get instrumented up the wazoo) from
        // 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);
            }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.Field

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.