}
@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
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 {
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);
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);