diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/data/fieldgroup/BeanFieldGroup.java | 6 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java | 14 |
2 files changed, 17 insertions, 3 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<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 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 { @@ -136,6 +137,19 @@ public class BeanFieldGroupTest { } @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); |