KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > management > browser > ui > statistics > TimeStatisticCustomizer


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.management.browser.ui.statistics;
8
9 import javax.management.j2ee.statistics.Statistic JavaDoc;
10 import javax.management.j2ee.statistics.TimeStatistic JavaDoc;
11 import javax.swing.JLabel JavaDoc;
12
13 /**
14  * @author letiemble
15  * @version $Revision: 1.3 $
16  */

17 public class TimeStatisticCustomizer extends StatisticCustomizer
18 {
19    /** Description of the Field */
20    protected JLabel JavaDoc lblCount = null;
21    /** Description of the Field */
22    protected JLabel JavaDoc lblMaxTime = null;
23    /** Description of the Field */
24    protected JLabel JavaDoc lblMinTime = null;
25    /** Description of the Field */
26    protected JLabel JavaDoc lblTotalTime = null;
27
28
29    /**
30     * Constructor for CountStatisticCustomizer.
31     *
32     * @param statistic Description of the Parameter
33     */

34    public TimeStatisticCustomizer(Statistic JavaDoc statistic)
35    {
36       super(statistic);
37
38       this.lblCount = new JLabel JavaDoc("");
39       this.addGraphItem(
40          resources.getString("customizer.tab.statistics.text.count"),
41          resources.getString("customizer.tab.statistics.tooltip.count"),
42          "Count",
43          this.lblCount);
44       this.lblMinTime = new JLabel JavaDoc("");
45       this.addGraphItem(
46          resources.getString("customizer.tab.statistics.text.min.time"),
47          resources.getString("customizer.tab.statistics.tooltip.min.time"),
48          "MinTime",
49          this.lblMinTime);
50       this.lblMaxTime = new JLabel JavaDoc("");
51       this.addGraphItem(
52          resources.getString("customizer.tab.statistics.text.max.time"),
53          resources.getString("customizer.tab.statistics.tooltip.max.time"),
54          "MaxTime",
55          this.lblMaxTime);
56       this.lblTotalTime = new JLabel JavaDoc("");
57       this.addGraphItem(
58          resources.getString("customizer.tab.statistics.text.total.time"),
59          resources.getString("customizer.tab.statistics.tooltip.total.time"),
60          "TotalTime",
61          this.lblTotalTime);
62    }
63
64
65    /** Description of the Method */
66    public void refresh()
67    {
68       if (this.statistic != null)
69       {
70          long value;
71          TimeStatistic JavaDoc ts = (TimeStatistic JavaDoc) this.statistic;
72
73          value = ts.getCount();
74          this.lblCount.setText("" + value);
75          value = ts.getMaxTime();
76          this.lblMaxTime.setText("" + value);
77          value = ts.getMinTime();
78          this.lblMinTime.setText("" + value);
79          value = ts.getTotalTime();
80          this.lblTotalTime.setText("" + value);
81
82          super.refresh();
83       }
84    }
85 }
86
Popular Tags