Package org.apache.tapestry

Examples of org.apache.tapestry.PropertyConduit


        assertEquals(firstName.getDataType(), "text");
        assertEquals(firstName.getWidth(), 0);

        assertEquals(model.get("lastName").getLabel(), "Last Name");

        PropertyConduit conduit = model.get("lastName").getConduit();

        SimpleBean instance = new SimpleBean();

        instance.setLastName("Lewis Ship");

        assertEquals(conduit.get(instance), "Lewis Ship");

        conduit.set(instance, "TapestryDude");

        assertEquals(instance.getLastName(), "TapestryDude");

        // Now, one with some type coercion.
View Full Code Here


    @Test
    public void add_before()
    {
        ComponentResources resources = mockComponentResources();
        Messages messages = mockMessages();
        PropertyConduit conduit = mockPropertyConduit();

        Class propertyType = String.class;

        train_getMessages(resources, messages);
        stub_contains(messages, false);

        expect(conduit.getPropertyType()).andReturn(propertyType).atLeastOnce();
        expect(conduit.getAnnotation(EasyMock.isA(Class.class))).andStubReturn(null);

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources);
View Full Code Here

    @Test
    public void add_after()
    {
        ComponentResources resources = mockComponentResources();
        Messages messages = mockMessages();
        PropertyConduit conduit = mockPropertyConduit();

        Class propertyType = String.class;

        train_getMessages(resources, messages);
        stub_contains(messages, false);

        expect(conduit.getPropertyType()).andReturn(propertyType).atLeastOnce();

        expect(conduit.getAnnotation(EasyMock.isA(Class.class))).andStubReturn(null);

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources);
View Full Code Here

        String[] value = {"foo", "bar"};

        StringArrayBean bean = new StringArrayBean();

        PropertyConduit conduit = propertyModel.getConduit();

        conduit.set(bean, value);

        assertSame(bean.getArray(), value);

        assertSame(conduit.get(bean), value);

        verify();
    }
View Full Code Here

        return false;
    }

    private Object readPropertyForObject()
    {
        PropertyConduit conduit = _model.getConduit();

        return conduit == null ? null : conduit.get(_object);
    }
View Full Code Here

        return _beanType;
    }

    public PropertyModel add(String propertyName)
    {
        PropertyConduit conduit = createConduit(propertyName);

        return add(propertyName, conduit);
    }
View Full Code Here

    }

    public PropertyModel add(RelativePosition position, String existingPropertyName,
                             String propertyName)
    {
        PropertyConduit conduit = createConduit(propertyName);

        return add(position, existingPropertyName, propertyName, conduit);
    }
View Full Code Here

public class ValidateAnnotationConstraintGeneratorTest extends InternalBaseTestCase
{
    @Test
    public void no_annotation()
    {
        PropertyConduit conduit = mockPropertyConduit();

        train_getAnnotation(conduit, Validate.class, null);

        replay();
View Full Code Here

    }

    @Test
    public void single_constraint()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Validate validate = newValidate("required");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

    }

    @Test
    public void multiple_constraints()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Validate validate = newValidate("required,minlength=3");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.PropertyConduit

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.