KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > console > views > CacheViewer


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): Mathieu Peltier.
23  */

24
25 package org.objectweb.cjdbc.console.views;
26
27 import org.objectweb.cjdbc.common.i18n.Translate;
28
29 /**
30  * Graphical SQL statistics viewer. Quick and dirty implementation.
31  *
32  * @author <a HREF="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier</a>
33  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
34  * @version 1.0
35  */

36 public class CacheViewer extends InfoViewer
37 {
38   static final int COLUMNS = 5;
39
40   /**
41    * Create a SQLStatsViewer
42    *
43    * @param data Stats to display in the table
44    */

45   public CacheViewer(Object JavaDoc[][] data)
46   {
47     super(data);
48   }
49
50   protected Object JavaDoc[][] getDataTypes(Object JavaDoc[][] stats)
51   {
52     int iSize = stats.length;
53     Object JavaDoc[][] ret = new Object JavaDoc[iSize][];
54     for (int i = 0; i < iSize; i++)
55     {
56       String JavaDoc[] aStat = (String JavaDoc[]) stats[i];
57       int jSize = aStat.length;
58       ret[i] = new Object JavaDoc[jSize];
59       ret[i][0] = aStat[0];
60       for (int j = 1; j < jSize; j++)
61       {
62         if (j <= 3)
63           ret[i][j] = new String JavaDoc(aStat[j]);
64         else
65           ret[i][j] = new Integer JavaDoc(aStat[j]);
66       }
67     }
68     return ret;
69   }
70
71   /**
72    * @see InfoViewer#getColumnNames()
73    */

74   public String JavaDoc[] getColumnNames()
75   {
76     String JavaDoc[] columnNames = new String JavaDoc[COLUMNS];
77     columnNames[0] = Translate.get("console.infoviewer.cache.column.0");
78     columnNames[1] = Translate.get("console.infoviewer.cache.column.1");
79     columnNames[2] = Translate.get("console.infoviewer.cache.column.2");
80     columnNames[3] = Translate.get("console.infoviewer.cache.column.3");
81     columnNames[4] = Translate.get("console.infoviewer.cache.column.4");
82     return columnNames;
83   }
84
85   /**
86    * @see InfoViewer#setLabels()
87    */

88   public void setLabels()
89   {
90     frameTitle = Translate.get("console.infoviewer.cache.frame.title");
91     infoViewerMenuBarString = Translate.get("console.infoviewer.cache.menubar");
92     actionToolTipText = Translate
93         .get("console.infoviewer.cache.action.tooltiptext");
94     actionErrorMessage = Translate
95         .get("console.infoviewer.cache.action.error.message");
96     actionSuccessMessage = Translate
97         .get("console.infoviewer.cache.action.success.message");
98     tableHeaderToolTipText = Translate
99         .get("console.infoviewer.table.tooltip.text");
100   }
101
102 }
103
Popular Tags