KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > monitor > jvm > component > UIMemoryManagerInfo


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.monitor.jvm.component;
6
7 import java.lang.management.MemoryManagerMXBean JavaDoc;
8 import java.util.List JavaDoc;
9 import org.exoplatform.container.RootContainer;
10 import org.exoplatform.container.monitor.jvm.JVMRuntimeInfo;
11 import org.exoplatform.faces.core.component.UIExoComponentBase;
12 import org.exoplatform.text.template.DataHandler;
13 import org.exoplatform.text.template.ListBeanDataHandler;
14 import org.exoplatform.text.template.ArrayFormater;
15 import org.exoplatform.text.template.xhtml.Column;
16 import org.exoplatform.text.template.xhtml.Element;
17 import org.exoplatform.text.template.xhtml.Rows;
18 import org.exoplatform.text.template.xhtml.Table;
19 /**
20  * May 31, 2004
21  * @author: Tuan Nguyen
22  * @email: tuan08@users.sourceforge.net
23  * @version: $ID$
24  **/

25 public class UIMemoryManagerInfo extends UIExoComponentBase {
26   static private Element TEMPLATE =
27     new Table().setCssClass("UIGrid").
28       add(new Rows().setShowHeader(true).
29           add(new Column("#{UIMemoryManagerInfo.label.name}", "${name}")).
30           add(new Column("#{UIMemoryManagerInfo.label.is-valid}","${isValid()}")).
31           add(new Column("#{UIMemoryManagerInfo.label.memory-pool-names}", "${memoryPoolNames}").
32               setFomater(new ArrayFormater(null, ", ")))).
33       optimize() ;
34   
35   private ListBeanDataHandler dataHandler_ ;
36   
37     public UIMemoryManagerInfo() {
38         setRendererType("TemplateRenderer") ;
39     List JavaDoc list =
40       (List JavaDoc)RootContainer.getInstance().getComponentInstance(JVMRuntimeInfo.MEMORY_MANAGER_MXBEANS) ;
41     dataHandler_ = new ListBeanDataHandler(MemoryManagerMXBean JavaDoc.class) ;
42     dataHandler_.setBeans(list) ;
43     
44     }
45   
46   public DataHandler getDataHandler(Class JavaDoc type) {
47     return dataHandler_ ;
48   }
49   
50   public Element getTemplate() { return TEMPLATE ; }
51 }
Popular Tags