List of enums and nested bean display using table and item bean container.

Hi all,
i wish to display my bean structure into the table. The row of the table should be displayed as following:

|commonName |componentName |mode1|mode2|…|modeN|

I have the following (bean) structure, consists of an common bean, that has the other bean and a list of enums. I try to use the item bean container but it don’t work currently.
The (bean) structure:

public enum Mode {
	ALL, ONCE
}
public class Component {
private Integer id;
private String name;
// setters and getters
}
public class CommonBean {
private Integer commonIid;
private String commonName;
private Component component;
List< Mode> modes;

// setters and getters
}

Thank you for some ideas

====
Edit:
i solve the problem using reflection with CGLIB lib.
The Coding:

package com.example.testvaadin;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import net.sf.cglib.beans.BeanGenerator;
import net.sf.cglib.beans.BulkBean;
import org.apache.commons.lang3.StringUtils;
import com.vaadin.Application;
import com.vaadin.data.Container;
import com.vaadin.data.Container.ItemSetChangeEvent;
import com.vaadin.data.Container.ItemSetChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.BeanItem;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class TestTableUsingCGLIBReflection extends Application {


	public static class OneNestedBean {
		private String name;

		private UUID id;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public UUID getId() {
			return id;
		}

		public void setId(UUID id) {
			this.id = id;
		}

	}

	public static class TableRow {

		private OneNestedBean nestedBean;

		private String name;

		private UUID id;

		private List<Mode> modes;


		public TableRow() {
			modes = new ArrayList<Mode>();

		}

		public OneNestedBean getOneNestedBean() {
			return nestedBean;
		}

		public void setOneNestedBean(OneNestedBean component) {
			this.nestedBean = component;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public UUID getId() {
			return id;
		}

		public void setId(UUID id) {
			this.id = id;
		}

		public List<Mode> getModes() {
			return modes;
		}

		public void setModes(List<Mode> modes) {
			this.modes = modes;
		}



	}

	public enum Mode {
		ONE, TWO
	}

	public class Bean {

		List<Mode> modes;

		public Bean() {
			modes = new ArrayList<Mode>();
		}

	}


	private final class TableFieldFactory extends DefaultFieldFactory {
		public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {
			Field result = super.createField(container, itemId, propertyId, uiContext);
			if (((String) propertyId).startsWith("mode")) {
				ComboBox combobox = new ComboBox("", EnumSet.allOf(Mode.class));
				combobox.setNullSelectionAllowed(false);
				combobox.setNewItemsAllowed(false);
				combobox.setReadOnly(false);
				combobox.setInvalidAllowed(false);
				combobox.setImmediate(true);
				result = combobox;
			}
			return result;
		}
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 4427575339792458476L;

	private Window mainWindow;

	private Table table;

	@Override
	public void init() {
		mainWindow = new Window();
		setMainWindow(mainWindow);
		VerticalLayout layout = new VerticalLayout();
		table = new Table("test");
		layout.addComponent(table);
			mainWindow.addComponent(layout);
		mainWindow.getContent().setSizeUndefined();

		// http://cglib.sourceforge.net/xref-test/net/sf/cglib/beans/TestBeanGenerator.html
		// http://cglib.sourceforge.net/apidocs/net/sf/cglib/beans/BeanGenerator.html
		// http://stackoverflow.com/questions/6973580/java-code-generation
		// test reflection & bean

		OneNestedBean testmodule = new OneNestedBean();
		testmodule.setName("compName");
		testmodule.setId(UUID.randomUUID());

		TableRow tableRow = new TableRow();
		tableRow.setName("cell content-c-1");
		tableRow.setId(UUID.randomUUID());
		tableRow.setOneNestedBean(testmodule);

		tableRow.getModes().add(Mode.ONE);
		tableRow.getModes().add(Mode.TWO);

		//prepare row

		int FIX_COUNT = 2;
		String[] getters1 = new String[tableRow.modes.size() + FIX_COUNT]
;
		String[] setters1 = new String[tableRow.modes.size() + FIX_COUNT]
;
		Class[] types1 = new Class[tableRow.modes.size() + FIX_COUNT]
;
		Object[] values1 = new Object[tableRow.modes.size() + FIX_COUNT]
;
		List<String> fieldNames = new ArrayList<String>();
		BeanGenerator beanGenerator = new BeanGenerator();

		getters1[0]
 = "getRowName";
		getters1[1]
 = "getModuleName";

		setters1[0]
 = "setRowName";
		setters1[1]
 = "setModuleName";

		types1[0]
 = String.class;
		types1[1]
 = String.class;

		values1[0]
 = tableRow.getName();
		values1[1]
 = tableRow.getOneNestedBean().getName();

		fieldNames.add("rowName");
		fieldNames.add("moduleName");
		for (String fieldName : fieldNames) {
			beanGenerator.addProperty(fieldName, String.class);
		}

		for (int i = 0; i < tableRow.modes.size(); i++) {

			String fieldName = "mode" + i;
			fieldNames.add(fieldName);
			beanGenerator.addProperty(fieldName, Mode.class);
			getters1[i + FIX_COUNT]
 = "get" + StringUtils.capitalize(fieldName);
			setters1[i + FIX_COUNT]
 = "set" + StringUtils.capitalize(fieldName);
			types1[i + FIX_COUNT]
 = Mode.class;
			values1[i + FIX_COUNT]
 = tableRow.modes.get(i);
		}



		Object fullBean = beanGenerator.create();

		BeanItemContainer testBulkBeanCont = new BeanItemContainer(fullBean.getClass());
		BulkBean bulkBeanCls = BulkBean.create(fullBean.getClass(), getters1, setters1, types1);
		for (int idx = 0; idx < 10; idx++) {
			fullBean = beanGenerator.create();

			bulkBeanCls.setPropertyValues(fullBean, values1);
			testBulkBeanCont.addBean(fullBean);
		}


		TableFieldFactory fieldFactory = new TableFieldFactory();
		table.setTableFieldFactory(fieldFactory);
		table.setEditable(true);
		table.setImmediate(true);
		table.setWriteThrough(true);

		table.setContainerDataSource(testBulkBeanCont);
		table.setData(bulkBeanCls);

		table.setVisibleColumns(fieldNames.toArray());

	}


}

The following jars are used:
ant-1.5.3-1.jar
asm-1.3.4.jar
asm-util-1.3.4.jar
aspectwerkz-core-0.8.1.jar
cglib-nodep-2.2.3.jar
commons-lang3-3.1.jar
junit-3.7.jar
vaadin-6.8.0.jar