KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > common > CountStatisticPanel


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin.common;
5
6 import org.jfree.data.time.Second;
7
8 import com.tc.admin.ConnectionContext;
9 import com.tc.stats.statistics.CountStatistic;
10 import com.tc.stats.statistics.Statistic;
11
12 import java.util.Date JavaDoc;
13
14 public class CountStatisticPanel extends StatisticPanel {
15   private Date JavaDoc date = new Date JavaDoc();
16
17   public CountStatisticPanel(ConnectionContext cc) {
18     super(cc);
19   }
20
21   public void setStatistic(Statistic stat) {
22     super.setStatistic(stat);
23
24     CountStatistic countStat = (CountStatistic)stat;
25     long ts = countStat.getLastSampleTime();
26     long count = countStat.getCount();
27
28     date.setTime(ts);
29
30     getTimeSeries().addOrUpdate(new Second(date), count);
31   }
32
33   public void tearDown() {
34     super.tearDown();
35     date = null;
36   }
37 }
38
Popular Tags