I write the following
public BeanItemContainer<MyBean> getLista() {
List<MyBean> lista = null;
try {
lista = this.getControl().getServiceBean().getListMyBean();
} catch (ExcepcionDao e) {
e.printStackTrace();
}
BeanItemContainer<MyBean> cr = new BeanItemContainer<MyBean>(lista);
return cr;
}
getListMyBean() is a list obtained from the database, MyBean is
@SuppressWarnings("serial")
public class MyBean implements Serializable {
private String name;
private int id;
.............................get and set...................
and try to get the bean by clicking on the table,I write the following
@Override
public void valueChange(ValueChangeEvent event) {
Property property = event.getProperty();
if (property == myTable) {
Item item = myTable.getItem(myTable.getValue());
MyBean myBean=(MyBean)item;
System.out.print(myBeng.getid.toString())
}
}
}
and get the following error
com.vaadin.data.util.BeanItem cannot be cast to MyBean
how to get the bean??
thanks in advance