table and bean

Hi.

I have a form linked to a bean (using form.setItemDataSource), and I need to have a table in the form and was wondering what datastructure I can use to on the bean to get the
table data. I have tried using Collection<Object> in my bean without success.

In the example below, the name is set correctly from the TextArea, but the presentRawMaterials is returned null.

public class MyBean{
   String name;
   Collection<Object[]> presentRawMaterials;
}

    private class MyFieldFactory extends DefaultFieldFactory {

        public MyFieldFactory() {
        }

        @Override
        public Field createField(Item item, Object propertyId, Component uiContext) {
            Field field = null;

            if ("name".equals(propertyId)) {
                TextArea generic = new TextArea("Comment");
                generic.setRows(5);
                generic.setWidth("100%");
                field = generic;
            }else if ("presentRawMaterials".equals(propertyId)) {
                TextField material = null;
                TextField quantity = null;
                TextField source = null;

                presentRawMaterials = new Table("Give a list of the present main raw materials utilised in the process");
                presentRawMaterials.setPageLength(10);
                presentRawMaterials.setSizeFull();
                presentRawMaterials.addStyleName(Runo.TABLE_SMALL);

                presentRawMaterials.addContainerProperty("Type of Material", TextField.class, null);
                presentRawMaterials.addContainerProperty("Quantity (p.w./p.m.)", TextField.class, null);
                presentRawMaterials.addContainerProperty("Source (local/national/international)", TextField.class, null);
//                generic.setColumnWidth("Quantity (p.w./p.m.)", 150);

                for (int i = 0; i < 10; i++) {
                    material = new TextField();
                    material.setWidth("100%");
                    quantity = new TextField();
                    quantity.setWidth("100%");
                    source = new TextField();
                    source.setWidth("100%");
                    presentRawMaterials.addItem(new Object[]{"PresentMaterial" + i, material, quantity, source}, new Integer(i + 1));
                }

                field = presentRawMaterials;
            }
           return field;
      }
}

An example would be appreciated.

Regards

As I mentioned in another thread, you should just use your normal bean classes: Collection. And instead of creating the Table properties yourself, just use a BeanItemContainer instead.