KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > dso > GCStatsTableModel


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.dso;
5
6 import com.tc.objectserver.api.GCStats;
7
8 import com.tc.admin.AdminClient;
9 import com.tc.admin.common.XObjectTableModel;
10
11 public class GCStatsTableModel extends XObjectTableModel {
12   private static final String JavaDoc[] FIELDS = {
13     "Iteration",
14     "StartDate",
15     "ElapsedTime",
16     "BeginObjectCount",
17     "CandidateGarbageCount",
18     "ActualGarbageCount"
19   };
20
21   private static final String JavaDoc[] HEADERS =
22     AdminClient.getContext().getMessages(
23       new String JavaDoc[] {
24         "dso.gcstats.iteration",
25         "dso.gcstats.startTime",
26         "dso.gcstats.elapsedTime",
27         "dso.gcstats.beginObjectCount",
28         "dso.gcstats.candidateGarbageCount",
29         "dso.gcstats.actualGarbageCount"
30       });
31
32   public GCStatsTableModel() {
33     super(GCStatsWrapper.class, FIELDS, HEADERS);
34   }
35
36   public void setGCStats(GCStats[] gcStats) {
37     int count = gcStats != null ? gcStats.length : 0;
38     GCStatsWrapper[] wrappers = new GCStatsWrapper[count];
39
40     for(int i = 0; i < count; i++) {
41       wrappers[i] = new GCStatsWrapper(gcStats[i]);
42     }
43
44     set(wrappers);
45   }
46
47   public void addGCStats(GCStats gcStats) {
48     add(0, new GCStatsWrapper(gcStats));
49     fireTableRowsInserted(0, 0);
50   }
51 }
52
Popular Tags