From 304cd3f48a0e7729053491d6f2afc51b3947a240 Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Mon, 15 Sep 2014 21:53:39 +0300 Subject: [PATCH] 3 args method buildAndBind should be overriden, not 2 args (#12453). Change-Id: I7afabec7e0d9334b799019b581fca858895b2cc1 --- .../com/vaadin/data/fieldgroup/BeanFieldGroup.java | 6 +++--- .../component/fieldgroup/BeanFieldGroupTest.java | 14 ++++++++++++++ .../tests/fieldgroup/FormWithNestedProperties.java | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java b/server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java index 23a72ee1e5..0a92c00cad 100644 --- a/server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java +++ b/server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java @@ -155,10 +155,10 @@ public class BeanFieldGroup extends FieldGroup { } @Override - public Field buildAndBind(String caption, Object propertyId) - throws BindException { + public T buildAndBind(String caption, Object propertyId, + Class fieldType) throws BindException { ensureNestedPropertyAdded(propertyId); - return super.buildAndBind(caption, propertyId); + return super.buildAndBind(caption, propertyId, fieldType); } @Override diff --git a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java index 9c37b91ef5..90c079b35c 100644 --- a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java @@ -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 bfg = new BeanFieldGroup(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 group = new BeanFieldGroup(MyBean.class); diff --git a/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java b/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java index f66d822495..6caa8f3e26 100644 --- a/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java +++ b/uitest/src/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java @@ -31,8 +31,8 @@ public class FormWithNestedProperties extends AbstractBeanFieldGroupTest { super.setup(); setFieldBinder(new BeanFieldGroup(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); -- 2.39.5