1 19 20 29 30 package org.netbeans.modules.web.monitor.client; 31 32 import javax.swing.table.*; 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 [] 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 [] 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 public void setData(DataRecord md) { 139 140 if(debug) System.out.println("in ClientDisplay.setData()"); 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); clientTable.setValueAt(cd.getAttributeValue("remoteAddress"),1,1); clientTable.setValueAt(cd.getAttributeValue("software"), 2,1); clientTable.setValueAt(cd.getAttributeValue("locale"), 3,1); clientTable.setValueAt(cd.getAttributeValue("encodingsAccepted"), 4,1); clientTable.setValueAt(cd.getAttributeValue("formatsAccepted"), 5,1); clientTable.setValueAt(cd.getAttributeValue("charsetsAccepted"), 6,1); 156 EngineData ed = md.getEngineData(); 157 if(ed != null) { 158 engineTable.setValueAt(ed.getAttributeValue("jre"), 0, 1); engineTable.setValueAt(ed.getAttributeValue("platform"), 1, 1); engineTable.setValueAt(ed.getAttributeValue("serverName"), 2, 1); engineTable.setValueAt(ed.getAttributeValue("serverPort"), 3, 1); } 163 else { 166 ServletData sd = md.getServletData(); 167 engineTable.setValueAt(sd.getAttributeValue("jre"), 0, 1); engineTable.setValueAt(sd.getAttributeValue("platform"), 1, 1); engineTable.setValueAt(sd.getAttributeValue("serverName"), 2, 1); engineTable.setValueAt(sd.getAttributeValue("serverPort"), 3, 1); } 172 } 173 174 } | Popular Tags |