Hello!
I am trying to use the BeanItemContainer more generally. I have a lot of different objects where each one should be displayed in a seperate table. I do not want to create for each of these objects a seperate container. But how can I do this? I already tried it with generics but it did not work.
All of these objets bases on one constructor, but if I make a container with the constructors name I am not able to display any more values then the ones which are defined in the constrcutor. Another way to create a class which will be extended by each of the objects even does not work.
This is my current container code for the table datasource:
public class XContainerSource extends BeanItemContainer<XContainerObject> {
private static final long serialVersionUID = 5480664023245457795L;
private static Logger log = Logger.getLogger(XContainerSource.class);
public XContainerSource() throws InstantiationException, IllegalAccessException {
super(XContainerObject.class);
}
/**
* This method returns a list
* @param list
* @return
*/
public static XContainerSource getList(List<?> list){
try {
XContainerSource cont = new XContainerSource();
for(int i = 0; i<list.size(); i++){
cont.addItem(list.get(i));
}
return cont;
}
catch(Exception e){
log.error(e.getMessage());
return null;
}
}
}
Can someone help me, that would be great!
Thanks,
Florian