buildAndBind a method from a object that returns a list of other objects


I’ve created a custom made FieldGroup which extends from BeanFieldGroup:

EditProductFieldGroup fieldGroup = new EditProductFieldGroup(PimProduct.class);

I want to buildandbind variables from the PimProduct object. For the most simple variables it works like a charm, see:

This is for a String variable from the PimProduct object:
myLayout.addComponent(fieldGroup.buildAndBind(“Product Type”, “productTypeName”));
This is for a another object (the ProductTypeExt object which is used by the PimProduct object) from the PimProduct object:
myLayout.addComponent(fieldGroup.buildAndBind(“Condition File”, “productTypeExt.conditionsFile”));

But when I want to buildandbind a method from the PimProduct object that returns a List of other objects, I can’t get it to work. What is the most elegant way to buildandbind these things?

The PimProduct object has a getRichtTextAttr() method which returns a list of CustomAttribute objects.


The recommendation is that you don’t use buildAndBind for complex objects, since there are no Vaadin components that can handle them. You have two choices; create a AbstractSelect component, set it to multiselect, and populate the choices yourself, and lose the List type (these work with Sets). Or, create a CustomField that handles Lists. In either case you need to bind it yourself or use a custom fieldFactory.