1 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.UIMobilePage; 12 import org.exoplatform.portal.faces.component.UIPortlet; 13 import java.io.IOException ; 14 import java.util.Iterator ; 15 16 22 public class MobilePageRenderer extends HtmlBasicRenderer { 23 24 public MobilePageRenderer() { 25 } 26 27 public void decode(FacesContext facesContext, UIComponent uiComponent) { 28 } 29 30 public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException { 31 } 32 33 public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException { 34 ResponseWriter w = facesContext.getResponseWriter(); 35 UIMobilePage uiMobilePage = (UIMobilePage) 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>\n"); 41 w. write(uiMobilePage.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 = uiMobilePage.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 { 59 } 60 } 61 | Popular Tags |