diff options
author | Heikki Ohinmaa <heikki@vaadin.com> | 2014-09-04 15:26:00 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2014-09-12 16:49:14 +0300 |
commit | 2de5284bd3280a5103b75ad7a59d8c4002c2cd3c (patch) | |
tree | 55baaff83eb63775982191f573460fb66a2b4f99 /uitest | |
parent | 8c59ee01de36464ed0abac523d76db118a85d610 (diff) | |
download | vaadin-framework-2de5284bd3280a5103b75ad7a59d8c4002c2cd3c.tar.gz vaadin-framework-2de5284bd3280a5103b75ad7a59d8c4002c2cd3c.zip |
Fix Valo DateField rendering in read-only FieldGroups (#14603)
Change-Id: Icb05cffe68b948777036e282a2055e3343de9252
Diffstat (limited to 'uitest')
3 files changed, 23 insertions, 15 deletions
diff --git a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java index 7738b2d6db..5dca5ab9af 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/DateFields.java +++ b/uitest/src/com/vaadin/tests/themes/valo/DateFields.java @@ -18,6 +18,9 @@ package com.vaadin.tests.themes.valo; import java.util.Date; import java.util.Locale; +import com.vaadin.data.fieldgroup.FieldGroup; +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.data.util.PropertysetItem; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.server.UserError; @@ -27,6 +30,7 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CssLayout; import com.vaadin.ui.DateField; +import com.vaadin.ui.FormLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.InlineDateField; import com.vaadin.ui.Label; @@ -193,13 +197,29 @@ public class DateFields extends VerticalLayout implements View { date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); + + PropertysetItem item = new PropertysetItem(); + item.addItemProperty("date", new ObjectProperty<Date>(getDefaultDate())); + + FormLayout form = new FormLayout(); + + FieldGroup binder = new FieldGroup(item); + form.addComponent(binder.buildAndBind( + "Picker in read-only field group", "date")); + binder.setReadOnly(true); + + row.addComponent(form); } private void setDate(DateField date) { + date.setValue(getDefaultDate()); + } + + private Date getDefaultDate() { if (ValoThemeUI.isTestMode()) { - date.setValue(new Date(2014 - 1900, 5, 7)); + return new Date(2014 - 1900, 5, 7); } else { - date.setValue(new Date()); + return new Date(); } } @@ -208,5 +228,4 @@ public class DateFields extends VerticalLayout implements View { // TODO Auto-generated method stub } - } diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java index f30cec76cc..988b3487bd 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java @@ -101,12 +101,6 @@ public class ValoThemeUI extends UI { && getPage().getWebBrowser().getBrowserMajorVersion() == 9) { menu.setWidth("320px"); } - // Show .v-app-loading valo-menu-badge - // try { - // Thread.sleep(2000); - // } catch (InterruptedException e) { - // e.printStackTrace(); - // } if (!testMode) { Responsive.makeResponsive(this); @@ -434,7 +428,6 @@ public class ValoThemeUI extends UI { sg.nextString(true) + " " + sg.nextString(false)); child.getItemProperty(ICON_PROPERTY).setValue( testIcon.get()); - // ((Hierarchical) container).setChildrenAllowed(id, false); ((Hierarchical) container).setParent(id, i); for (int k = 1; k < 6; k++) { @@ -445,8 +438,6 @@ public class ValoThemeUI extends UI { + sg.nextString(false)); child.getItemProperty(ICON_PROPERTY).setValue( testIcon.get()); - // ((Hierarchical) container) - // .setChildrenAllowed(id, false); ((Hierarchical) container).setParent(id2, id); for (int l = 1; l < 5; l++) { @@ -457,8 +448,6 @@ public class ValoThemeUI extends UI { + sg.nextString(false)); child.getItemProperty(ICON_PROPERTY).setValue( testIcon.get()); - // ((Hierarchical) container) - // .setChildrenAllowed(id, false); ((Hierarchical) container).setParent(id3, id2); } } diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java index 71f770ab8f..20c74bff5e 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java @@ -64,7 +64,7 @@ public class ValoThemeUITest extends MultiBrowserTest { // Note that this can look broken in IE9 because of some browser // rendering issue... The problem seems to be in the customized // horizontal layout in the test app - compareScreen("datefields"); + compareScreen("datefields-with-disabled"); } @Test |