]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix Valo DateField rendering in read-only FieldGroups (#14603)
authorHeikki Ohinmaa <heikki@vaadin.com>
Thu, 4 Sep 2014 12:26:00 +0000 (15:26 +0300)
committerSauli Tähkäpää <sauli@vaadin.com>
Fri, 12 Sep 2014 13:49:14 +0000 (16:49 +0300)
Change-Id: Icb05cffe68b948777036e282a2055e3343de9252

WebContent/VAADIN/themes/valo/components/_datefield.scss
uitest/src/com/vaadin/tests/themes/valo/DateFields.java
uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java

index b1d5dcce5b4b0272a953aebe6211915b289665fd..48977d4d20d496d753b75f56d1544b28ed0d4599 100644 (file)
     @include valo-textfield-prompt-style($background-color);
   }
 
-  [class$="button"] {
+  [class*="button"] {
     @include valo-datefield-button-style($unit-size: $unit-size, $bevel: $bevel, $background-color: $background-color, $border-radius: $border-radius, $border: $border);
   }
 
   &.v-disabled {
     @include opacity($v-disabled-opacity);
 
-    [class$="button"] {
+    [class*="button"] {
       cursor: default;
       pointer-events: none;
       &:active:after {
       @include valo-textfield-readonly-style;
     }
 
-    [class$="button"] {
+    [class*="button"] {
       cursor: default;
       pointer-events: none;
       &:active:after {
index 7738b2d6dbdabd00870d983b71cb075ea7cccaf8..5dca5ab9af7693e024b8c3c70609b02a4c4914b2 100644 (file)
@@ -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
 
     }
-
 }
index f30cec76cccb2269302a96c3990c715866a44b15..988b3487bd5b50dfeb4dbdcf1d7251b5a628ab29 100644 (file)
@@ -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);
                         }
                     }
index 71f770ab8f70e688a5308faa1870f5eca44410d2..20c74bff5eb38c9b9946c3da3239461379617f48 100644 (file)
@@ -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