1 5 package org.exoplatform.faces.core.renderer.html; 6 7 import java.util.List ; 8 import java.util.ResourceBundle ; 9 import java.io.IOException ; 10 import javax.faces.component.UIComponent; 11 import javax.faces.context.FacesContext; 12 import javax.faces.context.ResponseWriter; 13 import org.exoplatform.faces.core.component.UIGrid; 14 import org.exoplatform.faces.core.component.model.HtmlFragment; 15 16 public class GridRenderer extends HtmlBasicRenderer { 17 18 public void encodeBegin( FacesContext context, UIComponent component ) throws IOException { 19 } 20 21 public void encodeChildren( FacesContext context, UIComponent component ) throws IOException { 22 ResponseWriter w = context.getResponseWriter() ; 23 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()); 24 UIGrid uiGrid = (UIGrid) component ; 25 String clazz = uiGrid.getClazz() ; 26 w.write("<table") ; 27 w.write(" class='UIGrid"); 28 if(clazz != null) { 29 w.write(' ') ; w.write(clazz) ; 30 } 31 w.write("'>") ; 32 List rows = uiGrid.getRows() ; 33 for (int i = 0 ; i < rows.size() ; i++) { 34 HtmlFragment row = (HtmlFragment) rows.get(i) ; 35 row.render(w, res, uiGrid) ; 36 } 37 w.write("</table>") ; 38 } 39 40 public void encodeEnd( FacesContext context, UIComponent component ) throws IOException { 41 42 } 43 } | Popular Tags |