KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > html > 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.html.page;
6
7 import java.io.IOException JavaDoc;
8 import java.util.Iterator JavaDoc;
9 import javax.faces.component.UIComponent;
10 import javax.faces.context.FacesContext;
11 import javax.faces.context.ResponseWriter;
12 import org.exoplatform.container.SessionContainer;
13 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer;
14 import org.exoplatform.portal.faces.component.UIPortlet;
15 import org.exoplatform.portal.faces.component.UISinglePage;
16 import org.exoplatform.portal.session.RequestInfo;
17
18 /**
19  * Date: Aug 11, 2003
20  * @author: Tuan Nguyen
21  * @email: tuan08@users.sourceforge.net
22  * @version: $Id: SinglePageRenderer.java,v 1.4 2004/09/23 12:44:42 tuan08 Exp $
23  */

24 public class SinglePageRenderer extends HtmlBasicRenderer {
25
26   public SinglePageRenderer() {
27   }
28
29   public void decode(FacesContext facesContext, UIComponent uiComponent) {
30   }
31
32   public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException JavaDoc {
33   }
34
35   public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException JavaDoc {
36     RequestInfo rinfo = (RequestInfo)SessionContainer.getComponent(RequestInfo.class);
37     ResponseWriter w = facesContext.getResponseWriter();
38     UISinglePage uiSinglePage = (UISinglePage) uiComponent ;
39     w.write("<html>\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("<a HREF='");
54           w.write(rinfo.getContextPath()) ;
55           w.write("/bookmark.jsp'>Bookmarks</a>") ;
56     w. write("</div>") ;
57     w. write("</body>") ;
58     w.write("</html>") ;
59   }
60
61   public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException JavaDoc {
62   }
63 }
64
Popular Tags