KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.exoplatform.portal.faces.renderer.html.portlet;
2
3
4 import javax.faces.context.ResponseWriter;
5 import javax.portlet.WindowState;
6 import org.exoplatform.portal.faces.component.UIPortlet;
7 import org.exoplatform.services.portal.model.Portlet;
8 import java.util.List JavaDoc;
9 import java.util.ResourceBundle JavaDoc;
10 import java.io.IOException JavaDoc;
11 /**
12  * Created by the Exo Development team.
13  * Author : Mestrallet Benjamin
14  * benjamin.mestrallet@exoplatform.com
15  */

16 public class BoxPortletRenderer extends PortletRenderer {
17
18   protected void renderPortletHeaderBar(ResponseWriter w, UIPortlet uiPortlet, ResourceBundle JavaDoc res,
19                                         String JavaDoc portletTitle, String JavaDoc baseUrl) throws IOException JavaDoc {
20     Portlet model = uiPortlet.getPortletModel() ;
21     w.write("<tr>");
22     //top left corner
23
w. write("<td class='top-left-corner'>");
24     w. write("<img SRC='/skin/blank.gif'/>");
25     w. write("</td>");
26     //title part
27
w. write("<td class='left-portlet-info-bar'>");
28     if (model.getShowInfoBar()) {
29       w. write(portletTitle);
30     }
31     w. write("</td>\n");
32     //info bar with no title
33
w. write("<td align='right' class='right-portlet-info-bar'>");
34     if (model.getShowInfoBar()) {
35       //icon actions
36
if(model.getShowPortletMode()) {
37         List JavaDoc modes = uiPortlet.getHtmlSupportModes() ;
38         if (uiPortlet.hasComponentAdminRole()) {
39           for (int i =0 ; i < modes.size() ; i++) {
40             String JavaDoc mode = (String JavaDoc) modes.get(i) ;
41             renderModeLink(w, uiPortlet,res, mode, baseUrl) ;
42           }
43         } else {
44           for (int i =0 ; i < modes.size() ; i++) {
45             String JavaDoc mode = (String JavaDoc) modes.get(i) ;
46             if("help".equals(mode)) {
47               renderModeLink(w, uiPortlet, res, mode, baseUrl) ;
48             }
49           }
50         }
51       }
52       if (model.getShowWindowState()) {
53         renderWindowStateLink(w, uiPortlet, res, WindowState.MINIMIZED, baseUrl) ;
54         renderWindowStateLink(w, uiPortlet, res, WindowState.MAXIMIZED, baseUrl) ;
55       }
56     }
57     w. write("</td>");
58     //top right corner
59
w. write("<td class='top-right-corner'>");
60     w. write("<img SRC='/skin/blank.gif'/>");
61     w. write("</td>");
62     w.write("</tr>");
63   }
64
65   protected void renderPortletBody(ResponseWriter w, UIPortlet uiPortlet,
66                                    String JavaDoc content) throws IOException JavaDoc {
67     w.write("<tr>");
68     w. write("<td class='left-border'>");
69     w. write("<img SRC='/skin/blank.gif'/>");
70     w. write("</td>\n");
71     w. write("<td colspan='2' width='*' height='100%' class='");
72     w.write(uiPortlet.getDecorator()); w.write("-portlet'>");
73     w. write(content);
74     w. write("</td>\n");
75     w. write("<td class='right-border'>");
76     w. write("<img SRC='/skin/blank.gif'/>");
77     w. write("</td>");
78     w.write("</tr>\n");
79   }
80
81   protected void renderPortletFooterBar(ResponseWriter w, UIPortlet uiPortlet,
82                                         String JavaDoc portletTitle, String JavaDoc baseUrl) throws IOException JavaDoc {
83     w.write("<tr>");
84     //bottom left corner class='bottom-left-corner'
85
w. write("<td class='bottom-left-corner'>");
86     w. write("<img SRC='/skin/blank.gif'/>");
87     w. write("</td>\n");
88     //footer bar
89
w. write("<td class='portlet-footer-bar'>");
90     w. write("<img SRC='/skin/blank.gif'/>");
91     w. write("</td>\n");
92     w. write("<td class='portlet-footer-bar'>");
93     w. write("<img SRC='/skin/blank.gif'/>");
94     w. write("</td>\n");
95     //bottom right corner
96
w. write("<td class='bottom-right-corner'>");
97     w. write("<img SRC='/skin/blank.gif'/>");
98     w. write("</td>");
99     w.write("</tr>");
100   }
101 }
Popular Tags