KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > html > page > PageColumnRenderer


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.page;
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 : Mestrallet Benjamin
16  * @email: benjmestrallet@users.sourceforge.net
17  * @author: Tuan Nguyen
18  * @email: tuan08@users.sourceforge.net
19  * @version: $Id: PageColumnRenderer.java,v 1.3 2004/08/19 20:30:23 tuan08 Exp $
20  */

21 public class PageColumnRenderer extends PageRenderer {
22
23   protected void renderViewMode(FacesContext context, UIPage uiPage) throws IOException JavaDoc {
24     ResponseWriter w = context.getResponseWriter();
25     UIPortlet maximizedPortlet = uiPage.getMaximizedPortlet() ;
26     w.write("<table class='"); w.write(uiPage.getDecorator()); w.write("-container'");
27     w.write(" id='") ; w.write(uiPage.getId());w.write("'>") ;
28     if (maximizedPortlet != null) {
29       w.write("<tr>") ;
30       w. write("<td style='height: 100%;'>");
31       maximizedPortlet.encodeBegin(context);
32       maximizedPortlet.encodeChildren(context);
33       maximizedPortlet.encodeEnd(context);
34       w. write("</td>");
35       w.write("</tr>") ;
36     } else {
37       List children = uiPage.getChildren();
38       int childrenSize = children.size() ;
39       w.write("<tr>") ;
40       for(int i=0 ; i < childrenSize; i++) {
41         UIBasicComponent uiChild = (UIBasicComponent) children.get(i) ;
42         String JavaDoc width = uiChild.getComponentModel().getWidth() ;
43         w.write("<td");
44         if (width != null && width.length() > 0) {
45           w.write(" style='width: "); w.write(width); w.write("'") ;
46         }
47         w. write(">");
48         uiChild.setFloat(UIBasicComponent.FLOAT_RIGHT) ;
49         uiChild.encodeBegin(context);
50         uiChild.encodeChildren(context);
51         uiChild.encodeEnd(context);
52         w.write("</td>");
53       }
54       w.write("</tr>") ;
55     }
56     w.write("</table>") ;
57   }
58 }
Popular Tags