Package org.apache.tapestry.beaneditor

Examples of org.apache.tapestry.beaneditor.BeanModel


        train_contains(messages, "simpleage-label", true);
        train_get(messages, "simpleage-label", "Years of Age");

        replay();

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

        // No editor for CompositeBean, so this will be empty.

        assertEquals(model.getPropertyNames(), Collections.emptyList());

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

        PropertyModel firstName = model.add("simple.firstName");

        assertEquals(firstName.getLabel(), "First Name");

        PropertyModel age = model.add("simple.age");
        assertEquals(age.getLabel(), "Years of Age");

        CompositeBean bean = new CompositeBean();

        firstName.getConduit().set(bean, "Fred");
View Full Code Here


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

        replay();

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

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

        verify();
    }
View Full Code Here

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

        replay();

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

        PropertyModel property = model.add("placeholder", null);

        assertFalse(property.isSortable());
        assertSame(property.getPropertyType(), Object.class);
        assertEquals(property.getLabel(), "Placeholder");
        assertEquals(property.getOrder(), 0);
View Full Code Here

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

        replay();

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

        assertSame(model.remove("age"), model);

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

        verify();
    }
View Full Code Here

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

        replay();

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

        assertSame(model.remove("frobozz"), model);

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

        verify();
    }
View Full Code Here

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

        replay();

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

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

        verify();
    }
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"));

        assertEquals(
                model.toString(),
                "BeanModel[org.apache.tapestry.internal.services.SimpleBean properties: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

    }

    @Test
    public void remove()
    {
        BeanModel model = mockBeanModel();

        expect(model.remove("fred", "barney")).andReturn(model);

        replay();

        BeanModelUtils.remove(model, "fred,barney");
    }
View Full Code Here

    }

    @Test
    public void reorder()
    {
        BeanModel model = mockBeanModel();

        expect(model.reorder("fred", "barney")).andReturn(model);

        replay();

        BeanModelUtils.reorder(model, "fred,barney");
    }
View Full Code Here

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

        replay();

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

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

        // Note the use of case insensitivity here.

        PropertyModel property = model.add(
                RelativePosition.BEFORE,
                "lastname",
                "middleInitial",
                conduit);

        assertEquals(model.getPropertyNames(), Arrays.asList(
                "firstName",
                "middleInitial",
                "lastName",
                "age"));
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.