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.openide.util.NbBundle; 35 import java.util.*; 36 37 38 public class ContextDisplay extends DataDisplay { 39 40 private final static boolean debug = false; 41 42 DisplayTable contextTable; 43 44 public ContextDisplay() { 45 super(); 46 } 47 48 public void setData(DataRecord md) { 52 53 boolean servlet = true; 55 boolean failed = false; 56 57 if(debug) System.out.println("in ContextDisplay.setData()"); this.removeAll(); 59 if (md == null) 60 return; 61 62 ContextData cd = md.getContextData(); 63 if(cd != null) displayContextData(cd); 64 else { 65 ServletData sd = md.getServletData(); 66 displayServletData(sd); 67 68 } 69 } 70 71 private void displayContextData(ContextData cd) 72 { 73 if(debug) System.out.println(cd.dumpBeanNode()); 74 75 String [] props = { 76 NbBundle.getBundle(ClientDisplay.class).getString("MON_Context_name"), 77 NbBundle.getBundle(ClientDisplay.class).getString("MON_Absolute_path"), 78 }; 79 80 contextTable = new DisplayTable(props); 81 82 int gridy = -1; 83 84 addGridBagComponent(this, createTopSpacer(), 0, ++gridy, 85 fullGridWidth, 1, 0, 0, 86 java.awt.GridBagConstraints.WEST, 87 java.awt.GridBagConstraints.NONE, 88 topSpacerInsets, 89 0, 0); 90 91 addGridBagComponent(this, 93 createHeaderLabel 94 (NbBundle.getBundle(ClientDisplay.class).getString("MON_Servlet_context"), NbBundle.getBundle(ClientDisplay.class).getString("MON_Servlet_context_Mnemonic").charAt(0), NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_contextA11yDesc"), contextTable), 95 0, ++gridy, 96 fullGridWidth, 1, 0, 0, 97 java.awt.GridBagConstraints.WEST, 98 java.awt.GridBagConstraints.NONE, 99 labelInsets, 100 0, 0); 101 102 103 contextTable.setValueAt(cd.getAttributeValue("contextName"), 0, 1); contextTable.setValueAt(cd.getAttributeValue("absPath"), 1, 1); contextTable.getAccessibleContext().setAccessibleName(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_contextTableA11yName")); 106 contextTable.setToolTipText(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_contextTableA11yDesc")); 107 addGridBagComponent(this, contextTable, 0, ++gridy, 108 fullGridWidth, 1, tableWeightX, tableWeightY, 109 java.awt.GridBagConstraints.WEST, 110 java.awt.GridBagConstraints.BOTH, 111 tableInsets, 112 0, 0); 113 114 115 Param[] ctxtparam = null; 116 try { 117 ctxtparam = cd.getContextAttributes().getParam(); 118 } 119 catch(Exception ex) { 120 } 121 122 if(ctxtparam != null && ctxtparam.length > 0) { 123 124 DisplayTable dt = new DisplayTable(ctxtparam); 125 addGridBagComponent(this, 126 createHeaderLabel 127 (NbBundle.getBundle(ClientDisplay.class).getString("MON_Context_att"), 128 NbBundle.getBundle(ClientDisplay.class).getString("MON_Context_att_Mnemonic").charAt(0), 129 NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Context_att_A11yDesc"), 130 dt), 131 0, ++gridy, 132 fullGridWidth, 1, 0, 0, 133 java.awt.GridBagConstraints.WEST, 134 java.awt.GridBagConstraints.NONE, 135 labelInsets, 136 0, 0); 137 dt.getAccessibleContext().setAccessibleName(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Context_att_TableA11yName")); 138 dt.setToolTipText(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Context_att_TableA11yDesc")); 139 addGridBagComponent(this, dt, 0, ++gridy, 140 fullGridWidth, 1, tableWeightX, tableWeightY, 141 java.awt.GridBagConstraints.WEST, 142 java.awt.GridBagConstraints.BOTH, 143 tableInsets, 144 0, 0); 145 } 146 147 Param[] param = cd.getParam(); 149 if(param == null || param.length == 0) 150 addGridBagComponent(this, 151 createDataLabel 152 (NbBundle.getBundle(ClientDisplay.class).getString("MON_No_init")), 153 0, 154 ++gridy, 155 fullGridWidth, 156 1, 0, 0, 157 java.awt.GridBagConstraints.WEST, 158 java.awt.GridBagConstraints.NONE, 159 labelInsets, 160 0, 0); 161 else { 162 163 DisplayTable paramTable = new DisplayTable(param); 164 paramTable.getAccessibleContext().setAccessibleName(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Init_parametersTableA11yName")); 165 paramTable.setToolTipText(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Init_parametersTableA11yDesc")); 166 addGridBagComponent(this, 167 createHeaderLabel 168 (NbBundle.getBundle(ClientDisplay.class).getString("MON_Init_parameters"), 169 NbBundle.getBundle(ClientDisplay.class).getString("MON_Init_parameters_Mnemonic").charAt(0), 170 NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Init_parametersA11yDesc"), 171 paramTable), 172 0, ++gridy, 173 fullGridWidth, 1, 0, 0, 174 java.awt.GridBagConstraints.WEST, 175 java.awt.GridBagConstraints.NONE, 176 labelInsets, 177 0, 0); 178 addGridBagComponent(this, paramTable, 0, ++gridy, 179 fullGridWidth, 1, tableWeightX, 180 tableWeightY, 181 java.awt.GridBagConstraints.WEST, 182 java.awt.GridBagConstraints.BOTH, 183 tableInsets, 184 0, 0); 185 } 186 187 addGridBagComponent(this, createGlue(), 0, ++gridy, 188 1, 1, 1.0, 1.0, 189 java.awt.GridBagConstraints.WEST, 190 java.awt.GridBagConstraints.BOTH, 191 zeroInsets, 192 0, 0); 193 } 194 195 private void displayServletData(ServletData sd) 198 { 199 if(debug) System.out.println(sd.dumpBeanNode()); 200 201 String [] props = { 202 NbBundle.getBundle(ClientDisplay.class).getString("MON_Context_name"), 203 NbBundle.getBundle(ClientDisplay.class).getString("MON_Absolute_path"), 204 }; 205 206 contextTable = new DisplayTable(props); 207 208 int gridy = -1; 209 210 addGridBagComponent(this, createTopSpacer(), 0, ++gridy, 211 fullGridWidth, 1, 0, 0, 212 java.awt.GridBagConstraints.WEST, 213 java.awt.GridBagConstraints.NONE, 214 topSpacerInsets, 215 0, 0); 216 217 addGridBagComponent(this, 219 createHeaderLabel 220 (NbBundle.getBundle(ClientDisplay.class).getString("MON_Servlet_context"), NbBundle.getBundle(ClientDisplay.class).getString("MON_Servlet_context_Mnemonic").charAt(0), NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_contextA11yDesc"), contextTable), 221 0, ++gridy, 222 fullGridWidth, 1, 0, 0, 223 java.awt.GridBagConstraints.WEST, 224 java.awt.GridBagConstraints.NONE, 225 labelInsets, 226 0, 0); 227 228 229 contextTable.setValueAt(sd.getAttributeValue("contextName"), 0, 1); contextTable.setValueAt(sd.getAttributeValue("absPath"), 1, 1); contextTable.getAccessibleContext().setAccessibleName(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_contextTableA11yName")); 232 contextTable.setToolTipText(NbBundle.getBundle(ClientDisplay.class).getString("ACS_MON_Servlet_contextTableA11yDesc")); 233 addGridBagComponent(this, contextTable, 0, ++gridy, 234 fullGridWidth, 1, tableWeightX, tableWeightY, 235 java.awt.GridBagConstraints.WEST, 236 java.awt.GridBagConstraints.BOTH, 237 tableInsets, 238 0, 0); 239 240 addGridBagComponent(this, createGlue(), 0, ++gridy, 241 1, 1, 1.0, 1.0, 242 java.awt.GridBagConstraints.WEST, 243 java.awt.GridBagConstraints.BOTH, 244 zeroInsets, 245 0, 0); 246 } 247 } | Popular Tags |