KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > xhtmlmp > page > SinglePageRenderer


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.xhtmlmp.page;
6
7 import javax.faces.component.UIComponent;
8 import javax.faces.context.FacesContext;
9 import javax.faces.context.ResponseWriter;
10 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer;
11 import org.exoplatform.portal.faces.component.UIPortlet;
12 import org.exoplatform.portal.faces.component.UISinglePage;
13 import java.io.IOException JavaDoc;
14 import java.util.Iterator JavaDoc;
15
16 /**
17  * Date: Jul 02, 2004
18  * @author : Moron Fran�ois
19  * @email: francois.moron@rd.francetelecom.com
20  *
21  */

22 public class SinglePageRenderer extends HtmlBasicRenderer {
23
24   public SinglePageRenderer() {
25   }
26
27   public void decode(FacesContext facesContext, UIComponent uiComponent) {
28   }
29
30   public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException JavaDoc {
31   }
32
33   public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException JavaDoc {
34     ResponseWriter w = facesContext.getResponseWriter();
35     UISinglePage uiSinglePage = (UISinglePage) uiComponent ;
36     w.write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
37     w.write("<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\n");
38     w.write("\"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\" >\n\n");
39     w.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n") ;
40     w.write("<head id='head'>\n");
41     w. write(uiSinglePage.getUserCss());
42     w. write("<link rel='stylesheet' type='text/css' HREF='/skin/default-skin.css'/>\n");
43     w.write("</head>");
44     w.write("<body style='width: auto; height: auto'>") ;
45     Iterator JavaDoc iterator = uiSinglePage.getChildren().iterator();
46     while (iterator.hasNext()) {
47       UIPortlet uiPortlet = (UIPortlet)iterator.next() ;
48       uiPortlet.encodeBegin(facesContext);
49       uiPortlet.encodeChildren(facesContext);
50       uiPortlet.encodeEnd(facesContext);
51     }
52     w. write("<div width='100%' align='center' style='color: white; font-size: 16pt; font-weight: bold'>") ;
53     w. write("</div>") ;
54     w. write("</body>") ;
55     w.write("</html>") ;
56   }
57
58   public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException JavaDoc {
59   }
60 }
61
Popular Tags