KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > faces > renderer > html > portlet > InfoPortletRenderer


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.portlet;
6
7 import java.util.List JavaDoc;
8 import java.util.ResourceBundle JavaDoc;
9 import java.io.IOException JavaDoc;
10 import javax.faces.context.ResponseWriter;
11 import javax.portlet.WindowState ;
12 import org.exoplatform.portal.faces.component.UIPortlet;
13 import org.exoplatform.services.portal.model.Portlet;
14
15 /**
16  * Fri, May 30, 2003 @
17  * @author : Mestrallet Benjamin
18  * @email: benjmestrallet@users.sourceforge.net
19  * @author: Tuan Nguyen
20  * @email: tuan08@users.sourceforge.net
21  * @version: $Id: InfoPortletRenderer.java,v 1.3 2004/09/30 01:00:05 tuan08 Exp $
22  */

23 public class InfoPortletRenderer extends PortletRenderer {
24     
25   protected void renderPortletHeaderBar(ResponseWriter w, UIPortlet uiPortlet,
26                                         String JavaDoc portletTitle, String JavaDoc baseUrl) throws IOException JavaDoc {
27     if (uiPortlet.getPortletModel().getShowInfoBar()) {
28       w.write("<tr>");
29       w. write("<td valign='bottom' width='*' class='portlet-info-bar'>");
30       w. write(portletTitle);
31       w. write("</td>");
32       w.write("</tr>");
33     }
34   }
35
36   protected void renderPortletBody(ResponseWriter w, UIPortlet uiPortlet, String JavaDoc content) throws IOException JavaDoc {
37     w.write("<tr>");
38     w. write("<td height='100%' class='>");
39     w. write(uiPortlet.getDecorator()); w.write("-portlet>");
40     w. write(content) ;
41     w. write("</td>");
42     w.write("</tr>");
43   }
44   
45   protected void renderPortletFooterBar(ResponseWriter w, UIPortlet uiPortlet, ResourceBundle JavaDoc res,
46                                         String JavaDoc portletTitle, String JavaDoc baseUrl) throws IOException JavaDoc {
47     Portlet model = uiPortlet.getPortletModel() ;
48     w.write("<tr>");
49     w. write("<td class='portlet-footer-bar'>");
50     if (model.getShowInfoBar()) {
51       //icon actions
52
if(model.getShowPortletMode()) {
53         List JavaDoc modes = uiPortlet.getHtmlSupportModes() ;
54         if (uiPortlet.hasComponentAdminRole()) {
55           for (int i =0 ; i < modes.size() ; i++) {
56             String JavaDoc mode = (String JavaDoc) modes.get(i) ;
57             renderModeLink(w, uiPortlet,res, mode, baseUrl) ;
58           }
59         } else {
60           for (int i =0 ; i < modes.size() ; i++) {
61             String JavaDoc mode = (String JavaDoc) modes.get(i) ;
62             if("help".equals(mode)) {
63               renderModeLink(w, uiPortlet, res, mode, baseUrl) ;
64             }
65           }
66         }
67       }
68       //w.write(generateWindowStateLink(uiPortlet, WindowState.MINIMIZED, baseUrl)) ;
69
if (model.getShowWindowState()) {
70         renderWindowStateLink(w, uiPortlet, res, WindowState.MAXIMIZED, baseUrl) ;
71       }
72     }
73     w. write("</td>");
74     w.write("</tr>");
75   }
76 }
Popular Tags