1 5 package org.exoplatform.portal.faces.renderer.html.portlet; 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.faces.core.component.model.Parameter; 13 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer; 14 import org.exoplatform.portal.faces.component.UIPortletInfo; 15 import org.exoplatform.services.portletregistery.Portlet; 16 21 public class PortletInfoRenderer extends HtmlBasicRenderer{ 22 private static Parameter[] selectPortletParams = { new Parameter(ACTION , UIPortletInfo.SELECT_PORTLET) }; 23 24 public void encodeChildren( FacesContext context, UIComponent component ) throws IOException { 25 UIPortletInfo uiPortletInfo = (UIPortletInfo) component ; 26 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 27 ResponseWriter w = context.getResponseWriter() ; 28 Portlet portlet = uiPortletInfo.getPortletData() ; 29 w.write("<table class='UIPortletInfo'>") ; 30 w. write("<tr>") ; 31 w. write("<th colspan='2'>"); w.write(res.getString("UIPortletInfo.header.portlet-properties")) ; w.write("</th>") ; 32 w. write("</tr>") ; 33 w. write("<tr>") ; 34 w. write("<td class='label'>"); w.write(res.getString("UIPortletInfo.label.portlet-display-name")) ; w.write("</td>") ; 35 w. write("<td>"); w.write(portlet.getDisplayName()) ; w.write("</td>") ; 36 w. write("</tr>") ; 37 w. write("<tr>") ; 38 w. write("<td class='label'>"); w.write(res.getString("UIPortletInfo.label.portlet-creation-date")) ; w.write("</td>") ; 39 w. write("<td>"); w.write(ft_.format(portlet.getCreatedDate())) ; w.write("</td>") ; 40 w. write("</tr>") ; 41 w. write("<tr>") ; 42 w. write("<td class='label'>"); w.write(res.getString("UIPortletInfo.label.portlet-modification-date")) ; w.write("</td>") ; 43 w. write("<td>"); w.write(ft_.format(portlet.getModifiedDate())) ; w.write("</td>") ; 44 w. write("</tr>") ; 45 w. write("<tr>") ; 46 w. write("<td class='label'>"); w.write(res.getString("UIPortletInfo.label.portlet-application-name")) ; w.write("</td>") ; 47 w. write("<td>"); w.write(portlet.getPortletApplicationName()) ; w.write("</td>") ; 48 w. write("</tr>") ; 49 w. write("<tr>") ; 50 w. write("<td class='label'>"); w.write(res.getString("UIPortletInfo.label.portlet-name")) ; w.write("</td>") ; 51 w. write("<td>"); w.write(portlet.getPortletName()) ; w.write("</td>") ; 52 w. write("</tr>") ; 53 w. write("<tr>") ; 54 w. write("<td class='label'>"); w.write(res.getString("UIPortletInfo.label.portlet-description")) ; w.write("</td>") ; 55 w. write("<td>"); w.write(ft_.format(portlet.getDescription())); w.write("</td>") ; 56 w. write("</tr>") ; 57 w.write("</table>") ; 58 renderFooter(uiPortletInfo, w , res) ; 59 } 60 61 protected void renderFooter(UIPortletInfo uiPortletInfo, 62 ResponseWriter w, ResourceBundle res) throws IOException { 63 w.write("<div align='center'>") ; 64 linkRenderer_.render(w, uiPortletInfo, res.getString("UIPortletInfo.button.select"), selectPortletParams) ; 65 w.write("</div>") ; 66 } 67 } | Popular Tags |