[jboss-user] [JBoss Seam] - Re: c:forEach and h:column

limousyf do-not-reply at jboss.com
Tue Jul 24 12:05:24 EDT 2007


Ok, after using a Datamodel for the lines and a List for the columns, I finally managed to get this (half-)working.

To get the correct Cell, containing my object, I :

- iterate over lines using isRowAvailable() and getRowData()

- iterate over the columns using an int going from 0 to myList.size()

in a method named getCellValue() in my backing bean.

This works pretty well If I fetch only one time the cell content (the column counter is incremented one time per cell).
But If need to fetch multiple times the cell (it's an object containing the value, a boolean for rendering, etc ...) then it doesn't work.
My column counter is incremented bean-side, so it doesn't care if I'm still on the same cell jsf-side ...

When I was using DataModel for both lines and columns (JSP/Myfaces project, before Seam), isRowAvailable() and getRowData() used to handle increment neatly.

Am I missing something here ?

BTW, a portion of code from my backing bean


  | 	public CELLOBJECT getCellValue(){
  | 		DataModel lineDataModel = getLineDataModel();
  | 		if (lineDataModel.isRowAvailable()) {
  | 			Line line = (Line) lineDataModel.getRowData();
  | 			
  | 			if(compteurColonnes >= this.getColumnList().size()){
  | 				compteurColonnes = 0;
  | 			}
  | 			
  | 			for (Iterator<Cell<CELLOBJECT>> it = line.getCellList().iterator(); it.hasNext();) {
  | 				Cell<CELLOBJECT> cell = it.next();
  | 				if (cell.getColumnId() == compteurColonnes) {
  | 					System.out.println("[ " + cell.getLineId() + " , " + cell.getColumnId() + " ] = " + cell.getCellValue().toString());
  | 					compteurColonnes++;
  | 					return cell.getCellValue();
  | 				}
  | 			}
  | 			
  | 		}
  | 		return cellValue;
  | 	}
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067093#4067093

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4067093



More information about the jboss-user mailing list