KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > renderer > html > GridRenderer


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.core.renderer.html;
6
7 import java.util.List JavaDoc ;
8 import java.util.ResourceBundle JavaDoc ;
9 import java.io.IOException JavaDoc;
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 JavaDoc {
19   }
20
21   public void encodeChildren( FacesContext context, UIComponent component ) throws IOException JavaDoc {
22     ResponseWriter w = context.getResponseWriter() ;
23     ResourceBundle JavaDoc res = getApplicationResourceBundle(context.getExternalContext());
24     UIGrid uiGrid = (UIGrid) component ;
25     String JavaDoc 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 JavaDoc 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 JavaDoc {
41
42   }
43 }
Popular Tags