How to bind an object property

In Vaadin 7, I am creating a simple form to edit a JavaBean following this example https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20master-details%20view%20for%20editing%20persons

How can I access a property of my bean which is not a primitive ? Something like

public class MyBean {
private MyStatus status;

//getters/setters
}

public class MyStatus{
private String statusName;

//getters/setters

}
I would like to be able to access the property using something like binder.bind(myComboBox, “status.statusName”);but this does not work…

Thanks for the help!

:frowning:

You can bind MyStatus by adding the @propertyId annotation


@PropertyId("status.statusName")
private TextField myStatusName = new TextField("Mystatus");

I always put these fields into an object that extends FormLayout.
Then you just bind this object:


final BeanFieldGroup<MyBean> binder = new BeanFieldGroup<MyBean>(MyBean.class);
binder.bindMemberFields(myBeanForm);