KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > user > renderer > html > GroupCommunityInfoRenderer


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.portlets.user.renderer.html;
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.faces.core.renderer.html.HtmlBasicRenderer;
13 import org.exoplatform.portlets.user.component.UIGroupCommunityInfo;
14 import org.exoplatform.services.portal.community.CommunityPortal ;
15 import org.exoplatform.services.portal.community.CommunityNavigation ;
16 /**
17  * @email: tuan08@users.sourceforge.net
18  * @version: $Id: GroupExplorerRenderer.java,v 1.12 2004/10/22 14:23:31 tuan08 Exp $
19  */

20 public class GroupCommunityInfoRenderer extends HtmlBasicRenderer {
21
22   final public void encodeBegin(FacesContext context, UIComponent component ) throws IOException JavaDoc {
23     ResourceBundle JavaDoc res = getApplicationResourceBundle(context.getExternalContext()) ;
24     ResponseWriter w = context.getResponseWriter() ;
25     UIGroupCommunityInfo uiInfo = (UIGroupCommunityInfo) component ;
26     CommunityPortal cp = uiInfo.getCommunityPortal() ;
27     CommunityNavigation cn = uiInfo.getCommunityNavigation() ;
28     w.write("<table class='UIGrid'>") ;
29     w. write("<tr>");
30     w. write("<th colspan='2'>") ;
31     w. write(res.getString("UIGroupCommunityInfo.header.portal-community")) ;
32     w. write("</th>") ;
33     w. write("</tr>");
34     if(cp == null) {
35       w.write("<tr>");
36       w. write("<td colspan='2'>") ; w.write(res.getString("UIGroupCommunityInfo.msg.no-community-portal")) ;w.write("</td>") ;
37       w.write("</tr>");
38     } else {
39       w.write("<tr>");
40       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.membership")) ; w.write("</td>") ;
41       w. write("<td>") ; w.write(cp.getMembership()) ; w.write("</td>") ;
42       w.write("</tr>");
43       w.write("<tr>");
44       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.portal")) ; w.write("</td>") ;
45       w. write("<td>") ; w.write(cp.getPortal()) ; w.write("</td>") ;
46       w.write("</tr>");
47       w.write("<tr>");
48       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.priority")) ; w.write("</td>") ;
49       w. write("<td>") ;w.write(Integer.toString(cp.getPriority())) ; w.write("</td>") ;
50       w.write("</tr>");
51       w.write("<tr>");
52       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.description")) ; w.write("</td>") ;
53       w. write("<td>") ;w.write(ft_.format(cp.getDescription())) ; w.write("</td>") ;
54       w.write("</tr>");
55     }
56     w. write("<tr>");
57     w. write("<td colspan='2' align='right'>") ;
58     linkRenderer_.render(w, uiInfo, res.getString("UIGroupCommunityInfo.button.add-edit"),
59                          UIGroupCommunityInfo.ADD_EDIT_PORTAL) ;
60     if(uiInfo.getCommunityPortal() != null) {
61       linkRenderer_.render(w, uiInfo, res.getString("UIGroupCommunityInfo.button.admin"),
62           UIGroupCommunityInfo.ADMIN_PORTAL) ;
63       linkRenderer_.render(w, uiInfo, res.getString("UIGroupCommunityInfo.button.delete"),
64                            UIGroupCommunityInfo.DELETE_PORTAL) ;
65     }
66     w. write("</td>") ;
67     w. write("</tr>");
68     
69     w. write("<tr>");
70     w. write("<th colspan='2'>") ;
71     w. write(res.getString("UIGroupCommunityInfo.header.navigation-community")) ;
72     w. write("</th>") ;
73     w. write("</tr>");
74     if(cn == null) {
75       w.write("<tr>");
76       w. write("<td colspan='2'>") ; w.write(res.getString("UIGroupCommunityInfo.msg.no-community-navigation")) ;w.write("</td>") ;
77       w.write("</tr>");
78     } else {
79       w.write("<tr>");
80       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.membership")) ; w.write("</td>") ;
81       w. write("<td>") ; w.write(cn.getMembership()) ; w.write("</td>") ;
82       w.write("</tr>");
83       w.write("<tr>");
84       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.navigation")) ; w.write("</td>") ;
85       w. write("<td>") ; w.write(cn.getNavigation()) ; w.write("</td>") ;
86       w.write("</tr>");
87       w.write("<tr>");
88       w. write("<td>"); w.write(res.getString("UIGroupCommunityInfo.label.description")) ; w.write("</td>") ;
89       w. write("<td>") ;w.write(ft_.format(cn.getDescription())) ; w.write("</td>") ;
90       w.write("</tr>");
91     }
92     w. write("<tr>");
93     w. write("<td colspan='2' align='right'>") ;
94     linkRenderer_.render(w, uiInfo, res.getString("UIGroupCommunityInfo.button.add-edit"),
95                          UIGroupCommunityInfo.ADD_EDIT_NAV) ;
96     if(uiInfo.getCommunityNavigation() != null) {
97       linkRenderer_.render(w, uiInfo, res.getString("UIGroupCommunityInfo.button.admin"),
98           UIGroupCommunityInfo.ADMIN_NAV) ;
99       linkRenderer_.render(w, uiInfo, res.getString("UIGroupCommunityInfo.button.delete"),
100                            UIGroupCommunityInfo.DELETE_NAV) ;
101     }
102     w. write("</td>") ;
103     w. write("</tr>");
104     w.write("</table>") ;
105   }
106 }
Popular Tags