Retrieve data from HierarchicalContainer in ValueChangeListener

I added data to Tree via HierarchicalContainer like here:

Tree t = new Tree();
t.setContainerDataSource(c);
t.setItemIconPropertyId("icon");
t.setItemCaptionPropertyId("caption");
t.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);

HierarchicalContainer c = new HierarchicalContainer();
c.addContainerProperty("icon", Resource.class, null);
c.addContainerProperty("caption", String.class, null);
c.addContainerProperty("dataA", String.class, null);
c.addContainerProperty("dataB", String.class, null);
c.addContainerProperty("dataC", String.class, null);

addListener(new Property.ValueChangeListener() {
     public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
          if(event.getProperty().getValue() != null){
               String caption= event.getProperty().getValue().toString();
          }
     }
});

Is there any way how to retrieve dataA, dataB … in ValueChangeListener?
What is the best practice way to retrieve dataA, dataB in ValueChangeListener?

has revisado el libro de vaadin ? alli hay muy buenos ejemplos que te pueden ayudar, ademas de los ejemplo en linea que hay en la pagina.

Here is the solution.


t.addValueChangeListener(new ValueChangeListener() {
	@Override
	public void valueChange(ValueChangeEvent event) {
		updateContent(t, event.getProperty().getValue());
	}
});

protected void updateContent(Tree t, Object item) {
	Object dataObj = t.getItem(item).getItemProperty("dataA").getValue();
	String data = String.valueOf(dataObj);
}