aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DoubleInTextField.java
blob: 7eb79e123a5d66112b1156d969b66c48a304c07d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.vaadin.tests.components.abstractfield;

import com.vaadin.tests.data.bean.Address;
import com.vaadin.tests.data.bean.Country;
import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.data.bean.Sex;
import com.vaadin.v7.data.util.MethodProperty;
import com.vaadin.v7.ui.TextField;

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);
        salary.setPropertyDataSource(
                new MethodProperty<Double>(person, "salaryDouble"));

        TextField salary6 = new TextField("Vaadin 6 - TextField with Double");
        addComponent(salary6);
        salary6.setPropertyDataSource(
                new MethodProperty<Double>(person, "salaryDouble"));
        salary6.setConverter(new Vaadin6ImplicitDoubleConverter());

    }

}