KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > jmx > renderer > html > JMXPortletRenderer


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.jmx.renderer.html;
6
7 import java.io.IOException JavaDoc;
8 import java.util.List JavaDoc;
9 import java.util.ResourceBundle JavaDoc;
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 /**
20  * Jul 29, 2004
21  * @author: Tuan Nguyen
22  * @email: tuan08@users.sourceforge.net
23  * @version: $Id: JMXPortletRenderer.java,v 1.2 2004/08/02 17:36:45 benjmestrallet Exp $
24  */

25 public class JMXPortletRenderer extends HtmlBasicRenderer {
26     public void encodeChildren( FacesContext context, UIComponent component ) throws IOException JavaDoc {
27         UIJMXPortlet uiPortlet = (UIJMXPortlet) component ;
28     ResourceBundle JavaDoc res = getApplicationResourceBundle(context.getExternalContext()) ;
29     List JavaDoc children = uiPortlet.getChildren() ;
30     ResponseWriter w = context.getResponseWriter() ;
31     String JavaDoc 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