Package org.apache.tapestry.beaneditor

Examples of org.apache.tapestry.beaneditor.BeanModel


    public void object_created_as_needed()
    {
        ComponentResources resources = mockComponentResources();
        ComponentResources containerResources = mockComponentResources();
        BeanModelSource source = mockBeanModelSource();
        BeanModel model = mockBeanModel();
        Environment environment = mockEnvironment();

        expect(resources.triggerEvent(Form.PREPARE, null, null)).andReturn(false);

        train_push(environment, PropertyEditContext.class);
View Full Code Here


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

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources);

        assertSame(model.getBeanType(), SimpleBean.class);

        // Based on order of the getter methods (no longer alphabetical)

        assertEquals(model.getPropertyNames(), Arrays.asList("firstName", "lastName", "age"));

        PropertyModel age = model.get("age");

        assertEquals(age.getLabel(), "Age");
        assertSame(age.getPropertyType(), int.class);
        assertEquals(age.getDataType(), "text");

        PropertyModel firstName = model.get("firstName");

        assertEquals(firstName.getLabel(), "First Name");
        assertEquals(firstName.getPropertyType(), String.class);
        assertEquals(firstName.getDataType(), "text");

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

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

        SimpleBean instance = new SimpleBean();

        instance.setLastName("Lewis Ship");
View Full Code Here

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

        replay();

        BeanModel model = _source.create(ReadOnlyBean.class, true, resources);

        assertEquals(model.getPropertyNames(), Arrays.asList("value"));

        model = _source.create(ReadOnlyBean.class, false, resources);

        assertEquals(model.getPropertyNames(), Arrays.asList("value", "readOnly"));

        verify();
    }
View Full Code Here

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

        replay();

        BeanModel model = _source.create(EnumBean.class, true, resources);

        assertEquals(model.getPropertyNames(), Arrays.asList("token"));

        assertEquals(model.get("token").getDataType(), "enum");

        verify();
    }
View Full Code Here

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

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources);

        try
        {
            model.add("age");
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals(
View Full Code Here

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

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources);

        try
        {
            model.get("frobozz");
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals(
View Full Code Here

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

        replay();

        BeanModel model = _source.create(StoogeBean.class, true, resources);

        assertEquals(model.getPropertyNames(), Arrays.asList("larry", "moe", "shemp", "curly"));

        verify();
    }
View Full Code Here

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

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources).get("age").label(
                "Decrepitude").model();

        assertEquals(model.get("age").getLabel(), "Decrepitude");

        verify();
    }
View Full Code Here

        train_contains(messages, "age-label", true);
        train_get(messages, "age-label", "Decrepitude");

        replay();

        BeanModel model = _source.create(SimpleBean.class, true, resources);

        assertEquals(model.get("age").getLabel(), "Decrepitude");

        verify();
    }
View Full Code Here

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

        replay();

        BeanModel model = _source.create(StringArrayBean.class, true, resources);

        // There's not editor for string arrays yet, so it won't show up normally.

        PropertyModel propertyModel = model.add("array");

        assertSame(propertyModel.getPropertyType(), String[].class);

        String[] value =
        { "foo", "bar" };
View Full Code Here

TOP

Related Classes of org.apache.tapestry.beaneditor.BeanModel

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.