KickJava   Java API By Example, From Geeks To Geeks.

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


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  * JVMLoad 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 ControllerLoadViewer extends InfoViewer
36 {
37   static final int COLUMNS = 6;
38
39   /**
40    * Create a BackendViewer
41    *
42    * @param data Stats to display in the table
43    */

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

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

90   public void setLabels()
91   {
92     frameTitle = Translate.get("console.infoviewer.load.frame.title");
93     infoViewerMenuBarString = Translate.get("console.infoviewer.load.menubar");
94     actionToolTipText = Translate
95         .get("console.infoviewer.load.action.tooltiptext");
96     actionErrorMessage = Translate
97         .get("console.infoviewer.load.action.error.message");
98     actionSuccessMessage = Translate
99         .get("console.infoviewer.load.action.success.message");
100     tableHeaderToolTipText = Translate
101         .get("console.infoviewer.table.tooltip.text");
102   }
103
104   /**
105    * @see org.objectweb.cjdbc.console.views.InfoViewer#getTraceableColumns()
106    */

107   public int[] getTraceableColumns()
108   {
109     return new int[] {2,3,4,5};
110   }
111 }
112
Popular Tags