001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /**
043: * ClientDisplay.java
044: *
045: *
046: * Created: Wed Jan 31 18:04:22 2001
047: *
048: * @author Ana von Klopp
049: * @version
050: */package org.netbeans.modules.web.monitor.client;
051:
052: import javax.swing.table.*; // widgets
053: import org.netbeans.modules.web.monitor.data.*;
054: import org.netbeans.modules.schema2beans.BaseBean;
055: import org.openide.util.NbBundle;
056: import java.util.*;
057:
058: public class ClientDisplay extends DataDisplay {
059:
060: private final static boolean debug = false;
061: private DisplayTable clientTable = null;
062: private DisplayTable engineTable = null;
063:
064: private String[] categories = {
065: NbBundle.getBundle(ClientDisplay.class).getString(
066: "MON_Protocol"),
067: NbBundle.getBundle(ClientDisplay.class).getString(
068: "MON_Remote_Address"),
069: NbBundle.getBundle(ClientDisplay.class).getString(
070: "MON_Software"),
071: NbBundle.getBundle(ClientDisplay.class).getString(
072: "MON_Locale"),
073: NbBundle.getBundle(ClientDisplay.class).getString(
074: "MON_Encodings"),
075: NbBundle.getBundle(ClientDisplay.class).getString(
076: "MON_Fileformats"),
077: NbBundle.getBundle(ClientDisplay.class).getString(
078: "MON_Charsets") };
079:
080: private static final String[] props = {
081: NbBundle.getBundle(ClientDisplay.class).getString(
082: "MON_Java_version"),
083: NbBundle.getBundle(ClientDisplay.class).getString(
084: "MON_Platform"),
085: NbBundle.getBundle(ClientDisplay.class).getString(
086: "MON_Server_name"),
087: NbBundle.getBundle(ClientDisplay.class).getString(
088: "MON_Server_port"),
089:
090: };
091:
092: public ClientDisplay() {
093: super ();
094: }
095:
096: private void createPanelWidgets() {
097:
098: int gridy = -1;
099:
100: addGridBagComponent(this , createTopSpacer(), 0, ++gridy,
101: fullGridWidth, 1, 0, 0,
102: java.awt.GridBagConstraints.WEST,
103: java.awt.GridBagConstraints.NONE, topSpacerInsets, 0, 0);
104:
105: clientTable = new DisplayTable(categories);
106: clientTable.getAccessibleContext().setAccessibleName(
107: NbBundle.getBundle(ClientDisplay.class).getString(
108: "ACS_MON_ClientTable_3A11yName"));
109: clientTable.setToolTipText(NbBundle.getBundle(
110: ClientDisplay.class).getString(
111: "ACS_MON_ClientTable_3A11yDesc"));
112: addGridBagComponent(this , createHeaderLabel(NbBundle.getBundle(
113: ClientDisplay.class).getString("MON_Client_3"),
114: NbBundle.getBundle(ClientDisplay.class).getString(
115: "MON_Client_3_Mnemonic").charAt(0), NbBundle
116: .getBundle(ClientDisplay.class).getString(
117: "ACS_MON_Client_3A11yDesc"),
118: clientTable), 0, ++gridy, fullGridWidth, 1, 0, 0,
119: java.awt.GridBagConstraints.WEST,
120: java.awt.GridBagConstraints.NONE, labelInsets, 0, 0);
121:
122: addGridBagComponent(this , clientTable, 0, ++gridy,
123: fullGridWidth, 1, tableWeightX, tableWeightY,
124: java.awt.GridBagConstraints.WEST,
125: java.awt.GridBagConstraints.BOTH, tableInsets, 0, 0);
126:
127: engineTable = new DisplayTable(props);
128: engineTable.getAccessibleContext().setAccessibleName(
129: NbBundle.getBundle(ClientDisplay.class).getString(
130: "ACS_MON_Servlet_engineTableA11yName"));
131: engineTable.setToolTipText(NbBundle.getBundle(
132: ClientDisplay.class).getString(
133: "ACS_MON_Servlet_engineTableA11yDesc"));
134: addGridBagComponent(
135: this ,
136: createHeaderLabel(
137: NbBundle.getBundle(ClientDisplay.class)
138: .getString("MON_Servlet_engine"),
139: NbBundle.getBundle(ClientDisplay.class)
140: .getString(
141: "MON_Servlet_engine_Mnemonic")
142: .charAt(0),
143: NbBundle
144: .getBundle(ClientDisplay.class)
145: .getString(
146: "ACS_MON_Servlet_engineA11yDesc"),
147: engineTable), 0, ++gridy, fullGridWidth, 1, 0,
148: 0, java.awt.GridBagConstraints.WEST,
149: java.awt.GridBagConstraints.NONE, labelInsets, 0, 0);
150:
151: addGridBagComponent(this , engineTable, 0, ++gridy,
152: fullGridWidth, 1, tableWeightX, tableWeightY,
153: java.awt.GridBagConstraints.WEST,
154: java.awt.GridBagConstraints.BOTH, tableInsets, 0, 0);
155:
156: addGridBagComponent(this , createGlue(), 0, ++gridy, 1, 1, 1.0,
157: 1.0, java.awt.GridBagConstraints.WEST,
158: java.awt.GridBagConstraints.BOTH, zeroInsets, 0, 0);
159:
160: }
161:
162: // We're treating these as if they are all strings at the
163: // moment. In reality they can be of different types, though maybe
164: // that does not matter...
165: public void setData(DataRecord md) {
166:
167: if (debug)
168: System.out.println("in ClientDisplay.setData()"); //NOI18N
169: this .removeAll();
170: if (md == null)
171: return;
172:
173: createPanelWidgets();
174:
175: ClientData cd = md.getClientData();
176: clientTable.setValueAt(cd.getAttributeValue("protocol"), 0, 1); // NOI18N
177: clientTable.setValueAt(cd.getAttributeValue("remoteAddress"),
178: 1, 1); // NOI18N
179: clientTable.setValueAt(cd.getAttributeValue("software"), 2, 1); // NOI18N
180: clientTable.setValueAt(cd.getAttributeValue("locale"), 3, 1); // NOI18N
181: clientTable.setValueAt(cd
182: .getAttributeValue("encodingsAccepted"), 4, 1); // NOI18N
183: clientTable.setValueAt(cd.getAttributeValue("formatsAccepted"),
184: 5, 1); // NOI18N
185: clientTable.setValueAt(
186: cd.getAttributeValue("charsetsAccepted"), 6, 1); // NOI18N
187:
188: EngineData ed = md.getEngineData();
189: if (ed != null) {
190: engineTable.setValueAt(ed.getAttributeValue("jre"), 0, 1); //NOI18N
191: engineTable.setValueAt(ed.getAttributeValue("platform"), 1,
192: 1); //NOI18N
193: engineTable.setValueAt(ed.getAttributeValue("serverName"),
194: 2, 1); //NOI18N
195: engineTable.setValueAt(ed.getAttributeValue("serverPort"),
196: 3, 1); //NOI18N
197: }
198: // This is only for backwards compatibility with data
199: // collected under FFJ 3.0
200: else {
201: ServletData sd = md.getServletData();
202: engineTable.setValueAt(sd.getAttributeValue("jre"), 0, 1); //NOI18N
203: engineTable.setValueAt(sd.getAttributeValue("platform"), 1,
204: 1); //NOI18N
205: engineTable.setValueAt(sd.getAttributeValue("serverName"),
206: 2, 1); //NOI18N
207: engineTable.setValueAt(sd.getAttributeValue("serverPort"),
208: 3, 1); //NOI18N
209: }
210: }
211:
212: } // ClientDisplay
|