1 5 package org.exoplatform.portal.faces.renderer.html.page; 6 7 import java.io.IOException ; 8 import java.util.ResourceBundle ; 9 import javax.faces.component.UIComponent; 10 import javax.faces.context.FacesContext; 11 import javax.faces.context.ResponseWriter; 12 import org.exoplatform.portal.PortalConstants; 13 import org.exoplatform.portal.faces.component.UIPage; 14 import org.exoplatform.portal.faces.renderer.BaseRenderer; 15 23 abstract public class PageRenderer extends BaseRenderer { 24 25 public void encodeChildren(FacesContext context, UIComponent uiComponent) throws IOException { 26 UIPage uiPage = (UIPage) uiComponent ; 27 if(uiPage.getComponentMode() == UIPage.COMPONENT_VIEW_MODE) { 28 renderViewMode(context, uiPage); 29 } else { 30 renderEditMode(context, uiPage); 31 } 32 } 33 34 private void renderEditMode(FacesContext context, UIPage uiPage) throws IOException { 35 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 36 ResponseWriter w = context.getResponseWriter(); 37 w.write("<table class='customizer'"); 38 w.write(" id='") ; w.write(uiPage.getId());w.write("-customizer'>") ; 39 w. write("<tr>") ; 40 w. write("<th align='left'>"); 41 w. write("Page: " + uiPage.getTitle()); 42 w. write("</th>"); 43 w. write("<th align='right'>"); 44 linkRenderer_.render(w, uiPage, res.getString("UIPage.button.add-portlet"), PortalConstants.addPortletParams); 45 linkRenderer_.render(w, uiPage, res.getString("UIPage.button.add-container"), PortalConstants.addContainerParams); 46 linkRenderer_.render(w, uiPage, res.getString("UIPage.button.edit-page"), PortalConstants.editParams); 47 w. write("</th>"); 48 w. write("</tr>") ; 49 w. write("<tr>") ; 50 w. write("<td colspan='2' style='height: 100%'>"); 51 renderViewMode(context, uiPage) ; 52 w. write("</td>"); 53 w. write("</tr>") ; 54 w.write("</table>") ; 55 } 56 57 abstract protected void renderViewMode(FacesContext context, UIPage uiPage) throws IOException ; 58 } | Popular Tags |