Table with HashMap

Hey all,

I made a Table and filled the Row header and the first cell in every Row with a String. Now i need all other cells filled with Verticallayouts, but it doesn’t work well for me.
Here i fill my header:

Collection<Object> header = new ArrayList<Object>();

for(int i =0;i<confirmation.length-1;i++){
Object[] columnheader = new Object[header.size()]

Here i fill the first the Collection with the Strings for the fist cell in every Row: Collection<Object> dates = new ArrayList<Object>(); dates.add("12.12.2014"); dates.add("13.12.2014"); dates.add("14.12.2014"); dates.add("15.12.2014"); String[] datescoll = new String[dates.size()] ; dates.toArray(datescoll); Here are my two hashmaps:

HashMap<String,Collection<Object>> hashmap = new HashMap<String,Collection<Object>>(); HashMap<String,VerticalLayout> alllayoutscollection = new HashMap<String,VerticalLayout>(); for(int i =1;i<columnheader.length;i++){ table.addContainerProperty(columnheader[i] , VerticalLayout.class, null); //Fill in the Row Header for(int j=0;j<datescoll.length;j++){ alllayoutscollection.put(datescoll[j] , new VerticalLayout()); //Get number of the other Cells for my Layoutsfilled alllayoutscollection.get(datescoll[j] ).setStyleName("layout_grey"); } } for(int i = 0;i<datescoll.length;i++){ hashmap.put(datescoll[i] , new ArrayList<Object>()); hashmap.get(datescoll[i] ).add(datescoll[i] ); for(int j = 1; j<header.size();j++){ alllayoutscollection.get(datescoll[j] ).setStyleName("layout_grey"); hashmap.get(datescoll[i] ).add(alllayoutscollection.get(datescoll[j] )); } table.addItem(hashmap.get(datescoll[i] ).toArray(), i); } I hope you can help me and understand my question/problem.

I must admit this left me a bit confused, but have you tried using columnGenerators for creating those VerticalLayouts()? Giving components within the itemId itself probably doesn’t do what you want it to do, I assume you’d want them in itemProperties if you want to do it this way… along the lines of: Item item = table.addItem(itemId); item.getItemProperty(columnheader[i] ).setValue(new VerticalLayout()); Also keep in mind that Table doesn’t support rows of differing heights, so if your VerticalLayouts aren’t all same size you might run into weird problems.