1 5 package org.exoplatform.portal.faces.renderer.html.page; 6 7 import java.io.IOException ; 8 import java.util.Iterator ; 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 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 { 33 } 34 35 public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException { 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 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 { 62 } 63 } 64 | Popular Tags |