KickJava   Java API By Example, From Geeks To Geeks.

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


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): Nicolas Modrzyk
22  * Contributor(s):
23  */

24
25 package org.objectweb.cjdbc.console.views;
26
27 import org.objectweb.cjdbc.common.i18n.Translate;
28
29 /**
30  * Backend data statistics viewer. Quick and dirty implementation.
31  *
32  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk</a>
33  * @version 1.0
34  */

35 public class BackendViewer extends InfoViewer
36 {
37
38   /**
39    * Create a BackendViewer
40    *
41    * @param data Stats to display in the table
42    */

43   public BackendViewer(Object JavaDoc[][] data)
44   {
45     super(data);
46   }
47
48   protected Object JavaDoc[][] getDataTypes(Object JavaDoc[][] stats)
49   {
50     int iSize = stats.length;
51     Object JavaDoc[][] ret = new Object JavaDoc[iSize][];
52     for (int i = 0; i < iSize; i++)
53     {
54       String JavaDoc[] aStat = (String JavaDoc[]) stats[i];
55       int jSize = aStat.length;
56       ret[i] = new Object JavaDoc[jSize];
57       ret[i][0] = aStat[0];
58       for (int j = 0; j < jSize; j++)
59       {
60         if (j == 0 || j == 1 || j == 2 || j == 7 || j==13)
61           ret[i][j] = new String JavaDoc(aStat[j]);
62         else if (j == 3 || j == 4 || j == 9 || j == 10 || j == 11 || j == 12)
63           ret[i][j] = new Integer JavaDoc(aStat[j]);
64         else if (j == 5 || j == 6 || j == 8)
65           ret[i][j] = new Boolean 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[14];
77     columnNames[0] = Translate.get("console.infoviewer.backend.column.0");
78     columnNames[1] = Translate.get("console.infoviewer.backend.column.1");
79     columnNames[2] = Translate.get("console.infoviewer.backend.column.2");
80     columnNames[3] = Translate.get("console.infoviewer.backend.column.3");
81     columnNames[4] = Translate.get("console.infoviewer.backend.column.4");
82     columnNames[5] = Translate.get("console.infoviewer.backend.column.5");
83     columnNames[6] = Translate.get("console.infoviewer.backend.column.6");
84     columnNames[7] = Translate.get("console.infoviewer.backend.column.7");
85     columnNames[8] = Translate.get("console.infoviewer.backend.column.8");
86     columnNames[9] = Translate.get("console.infoviewer.backend.column.9");
87     columnNames[10] = Translate.get("console.infoviewer.backend.column.10");
88     columnNames[11] = Translate.get("console.infoviewer.backend.column.11");
89     columnNames[12] = Translate.get("console.infoviewer.backend.column.12");
90     columnNames[13] = Translate.get("console.infoviewer.backend.column.13");
91     return columnNames;
92   }
93
94   /**
95    * @see org.objectweb.cjdbc.console.views.InfoViewer#getTraceableColumns()
96    */

97   public int[] getTraceableColumns()
98   {
99     return new int[]{3, 4, 10, 11, 12};
100   }
101
102   /**
103    * @see InfoViewer#setLabels()
104    */

105   public void setLabels()
106   {
107     frameTitle = Translate.get("console.infoviewer.backend.frame.title");
108     infoViewerMenuBarString = Translate
109         .get("console.infoviewer.backend.menubar");
110     actionToolTipText = Translate
111         .get("console.infoviewer.backend.action.tooltiptext");
112     actionErrorMessage = Translate
113         .get("console.infoviewer.backend.action.error.message");
114     actionSuccessMessage = Translate
115         .get("console.infoviewer.backend.action.success.message");
116     tableHeaderToolTipText = Translate
117         .get("console.infoviewer.table.tooltip.text");
118   }
119   
120   
121
122 }
123
Popular Tags