]> source.dussan.org Git - vaadin-framework.git/commitdiff
3 args method buildAndBind should be overriden, not 2 args (#12453).
authorDenis Anisimov <denis@vaadin.com>
Mon, 15 Sep 2014 18:53:39 +0000 (21:53 +0300)
committerVaadin Code Review <review@vaadin.com>
Thu, 18 Dec 2014 21:35:43 +0000 (21:35 +0000)
Change-Id: I7afabec7e0d9334b799019b581fca858895b2cc1

server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java
server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java

index 23a72ee1e5985938efdc753c2cceeea9e1e66347..0a92c00cadaa67e008bc5efc493a610a4eaa6e3d 100644 (file)
@@ -155,10 +155,10 @@ public class BeanFieldGroup<T> extends FieldGroup {
     }
 
     @Override
-    public Field<?> buildAndBind(String caption, Object propertyId)
-            throws BindException {
+    public <T extends Field> T buildAndBind(String caption, Object propertyId,
+            Class<T> fieldType) throws BindException {
         ensureNestedPropertyAdded(propertyId);
-        return super.buildAndBind(caption, propertyId);
+        return super.buildAndBind(caption, propertyId, fieldType);
     }
 
     @Override
index 9c37b91ef54168a4760f2196f4d4f7a7acca4234..90c079b35c01cd988492a33605df8627ab1e3c4d 100644 (file)
@@ -11,6 +11,7 @@ import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
 import com.vaadin.data.fieldgroup.PropertyId;
 import com.vaadin.data.util.BeanItem;
 import com.vaadin.ui.Field;
+import com.vaadin.ui.RichTextArea;
 import com.vaadin.ui.TextField;
 
 public class BeanFieldGroupTest {
@@ -135,6 +136,19 @@ public class BeanFieldGroupTest {
         assertEquals(bean.nestedBean.hello, helloField.getValue().toString());
     }
 
+    @Test
+    public void buildAndBindNestedRichTextAreaProperty() {
+
+        MyBean bean = new MyBean();
+
+        BeanFieldGroup<MyBean> bfg = new BeanFieldGroup<MyBean>(MyBean.class);
+        bfg.setItemDataSource(bean);
+
+        RichTextArea helloField = bfg.buildAndBind("Hello string",
+                "nestedBean.hello", RichTextArea.class);
+        assertEquals(bean.nestedBean.hello, helloField.getValue().toString());
+    }
+
     @Test
     public void setDataSource_nullBean_nullBeanIsSetInDataSource() {
         BeanFieldGroup<MyBean> group = new BeanFieldGroup<MyBean>(MyBean.class);
index f66d822495f055d84c567c27673497d390bb2d25..6caa8f3e26a4459e794f6e2c57a7e969fc592d95 100644 (file)
@@ -31,8 +31,8 @@ public class FormWithNestedProperties extends AbstractBeanFieldGroupTest {
         super.setup();
 
         setFieldBinder(new BeanFieldGroup<Person>(Person.class));
-        country = getFieldBinder().buildAndBind("country", "address.country",
-                NativeSelect.class);
+        country = (NativeSelect) getFieldBinder().buildAndBind("country",
+                "address.country", NativeSelect.class);
         getFieldBinder().bindMemberFields(this);
         addComponent(firstName);
         addComponent(lastName);