afentis
afentis

Reputation: 139

Vaadin @PropertyId how to access inner-bean

In Vaadin 7, I am creating a simple form to edit a JavaBean following this example https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20form%20using%20an%20existing%20layout

However, using the "@PropertyId" annotation, 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 @PropertyId("status.statusName") but this does not work...

Thanks for the help!

Upvotes: 1

Views: 1357

Answers (1)

skyman
skyman

Reputation: 2335

Possibly a bit late, however, you may be best using BeanFieldGroup rather than just FieldGroup:

public MyForm() {
   FormLayout layout = new FormLayout();
   binder = new BeanFieldGroup(MyBean.class);
   layout.addComponent(binder.buildAndBind("Status Name", "status.statusName"));
   setCompositionRoot(layout);
}

Upvotes: 3

Related Questions