KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > html > container > ContainerColumnRenderer


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.portal.faces.renderer.html.container;
6
7 import java.util.* ;
8 import java.io.IOException JavaDoc;
9 import javax.faces.context.FacesContext;
10 import javax.faces.context.ResponseWriter ;
11 import org.exoplatform.portal.faces.component.*;
12
13 /*
14  * Date: Aug 11, 2003
15  * @author: Tuan Nguyen
16  * @email: tuan08@users.sourceforge.net
17  * @version: $Id: ContainerColumnRenderer.java,v 1.1 2004/07/02 17:52:05 tuan08 Exp $
18  */

19 public class ContainerColumnRenderer extends ContainerRenderer {
20
21   protected void renderViewMode(FacesContext context, UIContainer uiContainer) throws IOException JavaDoc {
22     ResponseWriter w = context.getResponseWriter();
23     List children = uiContainer.getChildren();
24     int childrenSize = children.size() ;
25     if(childrenSize == 0 ) return ;
26     w.write("<table class='"); w.write(uiContainer.getDecorator()); w.write("-container'");
27     w.write(" id='") ; w.write(uiContainer.getId());w.write("'>") ;
28     w. write("<tr>") ;
29     for(int i=0 ; i < childrenSize; i++) {
30       UIBasicComponent uiChild = (UIBasicComponent) children.get(i) ;
31       String JavaDoc width = uiChild.getComponentModel().getWidth() ;
32       if(uiChild.isRendered()) {
33         w. write("<td");
34         if (width != null && width.length() > 0) {
35           w.write(" style='width: "); w.write(width); w.write("'") ;
36         }
37         w. write(">");
38         uiChild.setFloat(UIBasicComponent.FLOAT_RIGHT) ;
39         uiChild.encodeBegin(context);
40         uiChild.encodeChildren(context);
41         uiChild.encodeEnd(context);
42         w. write("</td>");
43       }
44     }
45     w. write("</tr>") ;
46     w.write("</table>") ;
47   }
48 }
Popular Tags