Package com.vaadin.tests.data.bean

Examples of com.vaadin.tests.data.bean.Person


    private static BeanItemContainer<Person> createContainer(int nr) {
        BeanItemContainer<Person> bic = new BeanItemContainer<Person>(
                Person.class);
        for (int i = 1; i <= nr; i++) {
            Person p = new Person();
            p.setFirstName("First " + i);
            p.setLastName("Last " + i);
            p.setAge(i);
            p.setDeceased((i % 5 - 2) == 0);
            p.setEmail("person" + i + "@mail.com");
            p.setRent(new BigDecimal(i * 1250.25));
            p.setSalary(3000 + i);
            p.setSex((i % 4) == 0 ? Sex.MALE : Sex.FEMALE);
            p.setBirthDate(new Date(2011 - 1900 - p.getAge(), 11 - 1, 24));
            if (i % 42 == 0) {
                p.setSex(Sex.UNKNOWN);
            }
            String city = "City " + (i / 10);
            Country country = Country.FINLAND;
            Address address = new Address("Street " + i, 12345 + i * 2, city,
                    country);
            p.setAddress(address);
            bic.addBean(p);
        }

        return bic;
    }
View Full Code Here


        addComponent(firstName);
        addComponent(lastName);
        addComponent(streetAddress);

        fieldGroup.setItemDataSource(new BeanItem<Person>(new Person("Who",
                "me?", "email", 1, Sex.MALE, new Address("street name", 202020,
                        "City", Country.FINLAND))));
    }
View Full Code Here

            @Override
            protected String getFalseString() {
                return "NAAAAAH";
            }
        });
        Person p = new Person("John", "Doe", "john@doe.com", 64, Sex.MALE,
                new Address("John street", 11223, "John's town", Country.USA));
        fieldGroup.setItemDataSource(new BeanItem<Person>(p));
    }
View Full Code Here

import com.vaadin.ui.Label;

public class LabelConverters extends TestCase {

    public void testLabelSetDataSourceLaterOn() {
        Person p = Person.createTestPerson1();
        Label l = new Label("My label");
        assertEquals("My label", l.getValue());
        assertNull(l.getConverter());
        l.setPropertyDataSource(new MethodProperty<String>(p, "firstName"));
        assertEquals(p.getFirstName(), l.getValue());
        p.setFirstName("123");
        assertEquals("123", l.getValue());
    }
View Full Code Here

        addComponent(getCommitButton());
        addComponent(getDiscardButton());
        addComponent(getShowBeanButton());

        getFieldBinder().setItemDataSource(
                new Person("First", "Last", "Email", 52, Sex.FEMALE,
                        new Address("street address", 01234, "City",
                                Country.FINLAND)));

    }
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        final Form form = new Form();
        form.setId("tooltipForm");
        form.setDescription("Some description");
        form.setItemDataSource(new BeanItem<Person>(new Person("foo", "bar",
                "baz", 12, Sex.MALE, null)), Arrays.asList(new String[] {
                "firstName", "lastName", "age" }));
        ((TextField) form.getField("firstName"))
                .setDescription("Fields own tooltip");
View Full Code Here

public class DoubleInTextField extends AbstractComponentDataBindingTest {

    @Override
    protected void createFields() {
        Person person = new Person("John", "Doe", "john@doe.com", 78, Sex.MALE,
                new Address("Dovestreet 12", 12233, "Johnston",
                        Country.SOUTH_AFRICA));

        TextField salary = new TextField("Vaadin 7 - TextField with Double");
        addComponent(salary);
View Full Code Here

TOP

Related Classes of com.vaadin.tests.data.bean.Person

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.