KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > monitor > client > ClientDisplay


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /**
21  * ClientDisplay.java
22  *
23  *
24  * Created: Wed Jan 31 18:04:22 2001
25  *
26  * @author Ana von Klopp
27  * @version
28  */

29
30 package org.netbeans.modules.web.monitor.client;
31
32 import javax.swing.table.*; // widgets
33
import org.netbeans.modules.web.monitor.data.*;
34 import org.netbeans.modules.schema2beans.BaseBean;
35 import org.openide.util.NbBundle;
36 import java.util.*;
37
38 public class ClientDisplay extends DataDisplay {
39
40     private final static boolean debug = false;
41     private DisplayTable clientTable = null;
42     private DisplayTable engineTable = null;
43
44     private String JavaDoc[] categories = {
45         NbBundle.getBundle(ClientDisplay.class).getString("MON_Protocol"),
46         NbBundle.getBundle(ClientDisplay.class).getString("MON_Remote_Address"),
47         NbBundle.getBundle(ClientDisplay.class).getString("MON_Software"),
48         NbBundle.getBundle(ClientDisplay.class).getString("MON_Locale"),
49         NbBundle.getBundle(ClientDisplay.class).getString("MON_Encodings"),
50         NbBundle.getBundle(ClientDisplay.class).getString("MON_Fileformats"),
51         NbBundle.getBundle(ClientDisplay.class).getString("MON_Charsets")
52     };
53
54     private static final String JavaDoc[] props = {
55     NbBundle.getBundle(ClientDisplay.class).getString("MON_Java_version"),
56     NbBundle.getBundle(ClientDisplay.class).getString("MON_Platform"),
57     NbBundle.getBundle(ClientDisplay.class).getString("MON_Server_name"),
58     NbBundle.getBundle(ClientDisplay.class).getString("MON_Server_port"),
59
60     };
61
62     public ClientDisplay() {
63     super();
64     }
65
66     private void createPanelWidgets() {
67
68     int gridy = -1;
69
70     addGridBagComponent(this, createTopSpacer(), 0, ++gridy,
71                 fullGridWidth, 1, 0, 0,
72                 java.awt.GridBagConstraints.WEST,
73                 java.awt.GridBagConstraints.NONE,
74                 topSpacerInsets,
75                 0, 0);
76
77     clientTable = new DisplayTable(categories);
78         clientTable.getAccessibleContext().setAccessibleName(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_ClientTable_3A11yName"));
79         clientTable.setToolTipText(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_ClientTable_3A11yDesc"));
80     addGridBagComponent(this,
81                 createHeaderLabel
82                 (NbBundle.getBundle(ClientDisplay.class).getString("MON_Client_3"),
83                  NbBundle.getBundle(ClientDisplay.class).getString("MON_Client_3_Mnemonic").charAt(0),
84                  NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Client_3A11yDesc"),
85                  clientTable),
86                             0, ++gridy,
87                 fullGridWidth, 1, 0, 0,
88                 java.awt.GridBagConstraints.WEST,
89                 java.awt.GridBagConstraints.NONE,
90                 labelInsets,
91                 0, 0);
92
93     addGridBagComponent(this, clientTable, 0, ++gridy,
94                 fullGridWidth, 1, tableWeightX, tableWeightY,
95                 java.awt.GridBagConstraints.WEST,
96                 java.awt.GridBagConstraints.BOTH,
97                 tableInsets,
98                 0, 0);
99
100     engineTable = new DisplayTable(props);
101         engineTable.getAccessibleContext().setAccessibleName(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_engineTableA11yName"));
102         engineTable.setToolTipText(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_engineTableA11yDesc"));
103     addGridBagComponent(this,
104                 createHeaderLabel
105                 (NbBundle.getBundle(ClientDisplay.class).getString("MON_Servlet_engine"),
106                  NbBundle.getBundle(ClientDisplay.class).getString("MON_Servlet_engine_Mnemonic").charAt(0),
107                  NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_engineA11yDesc"),
108                  engineTable),
109                             0, ++gridy,
110                 fullGridWidth, 1, 0, 0,
111                 java.awt.GridBagConstraints.WEST,
112                 java.awt.GridBagConstraints.NONE,
113                 labelInsets,
114                 0, 0);
115
116
117     addGridBagComponent(this, engineTable, 0, ++gridy,
118                 fullGridWidth, 1, tableWeightX, tableWeightY,
119                 java.awt.GridBagConstraints.WEST,
120                 java.awt.GridBagConstraints.BOTH,
121                 tableInsets,
122                 0, 0);
123
124     addGridBagComponent(this, createGlue(), 0, ++gridy,
125                 1, 1, 1.0, 1.0,
126                 java.awt.GridBagConstraints.WEST,
127                 java.awt.GridBagConstraints.BOTH,
128                 zeroInsets,
129                 0, 0);
130
131
132
133     }
134
135     // We're treating these as if they are all strings at the
136
// moment. In reality they can be of different types, though maybe
137
// that does not matter...
138
public void setData(DataRecord md) {
139
140     if(debug) System.out.println("in ClientDisplay.setData()"); //NOI18N
141
this.removeAll();
142     if (md == null)
143         return;
144
145     createPanelWidgets();
146
147     ClientData cd = md.getClientData();
148     clientTable.setValueAt(cd.getAttributeValue("protocol"), 0,1); // NOI18N
149
clientTable.setValueAt(cd.getAttributeValue("remoteAddress"),1,1); // NOI18N
150
clientTable.setValueAt(cd.getAttributeValue("software"), 2,1); // NOI18N
151
clientTable.setValueAt(cd.getAttributeValue("locale"), 3,1); // NOI18N
152
clientTable.setValueAt(cd.getAttributeValue("encodingsAccepted"), 4,1); // NOI18N
153
clientTable.setValueAt(cd.getAttributeValue("formatsAccepted"), 5,1); // NOI18N
154
clientTable.setValueAt(cd.getAttributeValue("charsetsAccepted"), 6,1); // NOI18N
155

156     EngineData ed = md.getEngineData();
157     if(ed != null) {
158         engineTable.setValueAt(ed.getAttributeValue("jre"), 0, 1); //NOI18N
159
engineTable.setValueAt(ed.getAttributeValue("platform"), 1, 1); //NOI18N
160
engineTable.setValueAt(ed.getAttributeValue("serverName"), 2, 1); //NOI18N
161
engineTable.setValueAt(ed.getAttributeValue("serverPort"), 3, 1); //NOI18N
162
}
163     // This is only for backwards compatibility with data
164
// collected under FFJ 3.0
165
else {
166         ServletData sd = md.getServletData();
167         engineTable.setValueAt(sd.getAttributeValue("jre"), 0, 1); //NOI18N
168
engineTable.setValueAt(sd.getAttributeValue("platform"), 1, 1); //NOI18N
169
engineTable.setValueAt(sd.getAttributeValue("serverName"), 2, 1); //NOI18N
170
engineTable.setValueAt(sd.getAttributeValue("serverPort"), 3, 1); //NOI18N
171
}
172     }
173
174 } // ClientDisplay
175
Popular Tags