KickJava   Java API By Example, From Geeks To Geeks.

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


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