1 5 package org.exoplatform.portlets.jmx.renderer.html; 6 7 import java.io.IOException ; 8 import java.util.List ; 9 import java.util.ResourceBundle ; 10 11 import javax.faces.component.UIComponent; 12 import javax.faces.context.FacesContext; 13 import javax.faces.context.ResponseWriter; 14 15 import org.exoplatform.faces.core.component.UIExoComponent; 16 import org.exoplatform.faces.core.renderer.html.HtmlBasicRenderer; 17 import org.exoplatform.portlets.jmx.component.UIJMXPortlet; 18 import org.exoplatform.portlets.jmx.component.UINavigator; 19 25 public class JMXPortletRenderer extends HtmlBasicRenderer { 26 public void encodeChildren( FacesContext context, UIComponent component ) throws IOException { 27 UIJMXPortlet uiPortlet = (UIJMXPortlet) component ; 28 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 29 List children = uiPortlet.getChildren() ; 30 ResponseWriter w = context.getResponseWriter() ; 31 String colspan = Integer.toString(children.size()) ; 32 w.write("<table class='"); w.write(uiPortlet.getClazz()); w.write("'>") ; 33 w. write("<tr>"); 34 w. write("<td class='header' colspan='"); w.write(colspan); w.write("'>") ; 35 w. write(res.getString("UIJMXPortlet.header.title")); 36 w. write("</td>"); 37 w. write("</tr>"); 38 w. write("<tr>"); 39 for(int i = 0 ; i < children.size(); i++) { 40 UIExoComponent uiChild = (UIExoComponent) children.get(i) ; 41 if(((UIComponent)uiChild).isRendered()){ 42 if(uiChild instanceof UINavigator) { 43 w. write("<td valign='top' class='"); w.write(uiChild.getClazz()); w.write("'>") ; 44 } else { 45 w. write("<td valign='top'> "); 46 } 47 uiChild.encodeBegin(context) ; 48 uiChild.encodeChildren(context) ; 49 uiChild.encodeEnd(context) ; 50 w. write("</td>"); 51 } 52 } 53 w. write("</tr>"); 54 w. write("<tr>"); 55 w. write("<td class='footer' colspan='"); w.write(colspan); w.write("'>") ; 56 w. write("</td>"); 57 w. write("</tr>"); 58 w.write("</table>") ; 59 } 60 } 61 | Popular Tags |