ObjectProperty and Label

All;
I am trying to put 3 labels on the screen which are bound to the same ObjectProperty but I want to display 3 different values.

For example:

Class MyVO {
public String firstName;
public String lastName;
pubilc String id;
}

In the UI Class

MyVO vo = new MyVO;
vo.setFirstName(“xxx”);
vo.setLastName(“yyy”);
ObjectProperty myObjectProperty = new ObjectProperty(vo);

/// Here I want to have 3 labels that display the firstName, lastName and id from the datasource.

Label firstName= new Label();
label.setPropertyDataSource(myObjectProperty);
// HOW do i tell it to use firstName as the value. right now all I see is an object memory ref value.

I may be approaching this wrong, but if my explanation is clear, could I get some guidance on this please?

I should note I am coming from a flex background where I would simply bind the label text value like this

<s:Label text=“{myObject.firstName”}/>
<s:Label text=“{myObject.lastName”}/>

I am trying to find the equivalent pattern type for Vaadin.

Hi,

i think you have to read this: https://vaadin.com/book/-/page/datamodel.items.html and you should wrapp your bean or pojo (valueobjects in java) in an beanitem.

Hi; I read that but label doesn’t support binding to a bean item, only an objectproperty.

Bind your label to the Property provided by the BeanItem via beanItem.getProperty(“firstName”) etc

Thank you!!! I’ll try this out.