aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java
blob: 1ba6409a6fb9e9bc32d0646f1583f0be97ba18fb (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
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.vaadin.tests.components.datefield;

import com.vaadin.data.Property;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.PopupDateField;

public class PopupDateFieldTextEnabled extends TestBase {

    private static final String ENABLED = "DateField text box enabled";
    private static final String DISABLED = "DateField text box disabled";

    @Override
    public void setup() {
        final PopupDateField field = new PopupDateField();
        final CheckBox box = new CheckBox(ENABLED, true);
        box.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                field.setTextFieldEnabled((Boolean) event.getProperty()
                        .getValue());
                if (field.isTextFieldEnabled()) {
                    box.setCaption(ENABLED);
                } else {
                    box.setCaption(DISABLED);
                }
            }
        });
        addComponent(box);
        addComponent(field);
    }

    @Override
    protected String getDescription() {
        return "tests whether or not enabling text field in the component works";
    }

    @Override
    protected Integer getTicketNumber() {
        return 6790;
    }

}