KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > html > page > PageRenderer


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.ResourceBundle JavaDoc;
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 /**
16  * Date: Aug 11, 2003
17  * @author : Mestrallet Benjamin
18  * @email: benjmestrallet@users.sourceforge.net
19  * @author: Tuan Nguyen
20  * @email: tuan08@users.sourceforge.net
21  * @version: $Id: PageRenderer.java,v 1.6 2004/08/28 18:59:18 tuan08 Exp $
22  */

23 abstract public class PageRenderer extends BaseRenderer {
24
25   public void encodeChildren(FacesContext context, UIComponent uiComponent) throws IOException JavaDoc {
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 JavaDoc {
35     ResourceBundle JavaDoc 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 JavaDoc ;
58 }
Popular Tags