diff options
author | Olli Tietäväinen <ollit@vaadin.com> | 2017-08-10 15:57:27 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-08-10 15:57:27 +0300 |
commit | 66e68f1ef25804dabfb4b0e4cdd7d59c66522927 (patch) | |
tree | 47190488a16fc39a87305878516a58cf00d1dcc7 /uitest/src/main | |
parent | 24473c8deac75d9ac229252a81b534ba0e62b31c (diff) | |
download | vaadin-framework-66e68f1ef25804dabfb4b0e4cdd7d59c66522927.tar.gz vaadin-framework-66e68f1ef25804dabfb4b0e4cdd7d59c66522927.zip |
Enable setting non-selected default value for DateField (#9745)
Requested feature: allow setting DateField to a certain starting point without selecting a value.
Diffstat (limited to 'uitest/src/main')
-rwxr-xr-x | uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValue.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValue.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValue.java new file mode 100755 index 0000000000..e422fc991e --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWithDefaultValue.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.components.datefield; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.DateField; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class DateFieldWithDefaultValue extends AbstractTestUI { + + static final String DATEFIELD_HAS_DEFAULT = "hasdefault"; + + static final String DATEFIELD_REGULAR = "regular"; + + @Override + protected void setup(VaadinRequest request) { + DateField dfWithDefault = new DateField( + "Date field with default value 2010-10-01"); + dfWithDefault.setId(DATEFIELD_HAS_DEFAULT); + LocalDate defaultValue = LocalDate.parse("2010-10-01", + DateTimeFormatter.ISO_DATE); + dfWithDefault.setDefaultValue(defaultValue); + addComponent(dfWithDefault); + + DateField regularDF = new DateField("Regular datefield"); + regularDF.setId(DATEFIELD_REGULAR); + addComponent(regularDF); + + } + +} |