1 package org.netbeans.modules.j2ee.sun.ide.avk.report.view; 2 3 import java.awt.BorderLayout ; 4 import java.awt.Dimension ; 5 import java.awt.Font ; 6 import java.awt.event.ActionEvent ; 7 import java.awt.event.ActionListener ; 8 import java.awt.event.MouseEvent ; 9 import java.io.File ; 10 import java.io.Serializable ; 11 import java.util.ArrayList ; 12 import java.util.List ; 13 import java.util.StringTokenizer ; 14 import javax.swing.JMenuItem ; 15 import javax.swing.JPanel ; 16 import javax.swing.JPopupMenu ; 17 import javax.swing.JScrollPane ; 18 import javax.swing.JTabbedPane ; 19 import javax.swing.JTable ; 20 import javax.swing.SwingConstants ; 21 import javax.swing.table.DefaultTableCellRenderer ; 22 import javax.swing.table.DefaultTableModel ; 23 import org.netbeans.jmi.javamodel.Element; 24 import org.netbeans.jmi.javamodel.JavaClass; 25 import org.netbeans.jmi.javamodel.Method; 26 import org.netbeans.jmi.javamodel.Resource; 27 import org.netbeans.jmi.javamodel.Type; 28 import org.netbeans.modules.j2ee.sun.ide.avk.actions.AdminTasks; 29 import org.netbeans.modules.j2ee.sun.ide.avk.report.model.EnterpriseBean; 30 import org.netbeans.modules.j2ee.sun.ide.avk.report.model.ReportModel; 31 import org.netbeans.modules.j2ee.sun.ide.avk.report.model.WebComponent; 32 import org.netbeans.modules.java.JavaEditor; 33 import org.netbeans.modules.javacore.api.JavaModel; 34 import org.netbeans.modules.javacore.internalapi.JavaMetamodel; 35 import org.openide.ErrorManager; 36 import org.openide.awt.StatusDisplayer; 37 import org.openide.cookies.OpenCookie; 38 import org.openide.filesystems.FileObject; 39 import org.openide.loaders.DataObject; 40 import org.openide.util.NbBundle; 41 import org.openide.windows.IOProvider; 42 import org.openide.windows.TopComponent; 43 import org.openide.windows.WindowManager; 44 import org.openide.awt.HtmlBrowser.URLDisplayer; 45 import org.openide.text.PositionBounds; 46 import org.openide.windows.InputOutput; 47 48 52 final class ReportTopComponent extends TopComponent { 53 54 private static final long serialVersionUID = 1L; 55 56 private static ReportTopComponent instance; 57 58 60 private static final String PREFERRED_ID = "ReportTopComponent"; 61 62 private ReportTopComponent() { 63 initComponents(); 64 setName(NbBundle.getMessage(ReportTopComponent.class, "CTL_ReportTopComponent")); 65 setToolTipText(NbBundle.getMessage(ReportTopComponent.class, "HINT_ReportTopComponent")); 66 } 68 69 74 private void initComponents() { 76 jTabbedPane1 = new javax.swing.JTabbedPane (); 77 jScrollPane1 = new javax.swing.JScrollPane (); 78 jPanel1 = new javax.swing.JPanel (); 79 summaryPanel = new javax.swing.JPanel (); 80 jLabel1 = new javax.swing.JLabel (); 81 jLabel2 = new javax.swing.JLabel (); 82 jLabel3 = new javax.swing.JLabel (); 83 appName = new javax.swing.JLabel (); 84 webCompPercentage = new javax.swing.JLabel (); 85 ejbCompPercentage = new javax.swing.JLabel (); 86 compsTabbedPane = new javax.swing.JTabbedPane (); 87 jScrollPane2 = new javax.swing.JScrollPane (); 88 webCompsPanel = new javax.swing.JPanel (); 89 webCompsUnSuccessfullyCalledPanel = new javax.swing.JPanel (); 90 webCompsUnSuccessfullyCalledTable = new javax.swing.JTable (); 91 webCompsNotCalledPanel = new javax.swing.JPanel (); 92 webCompsNotCalledTable = new javax.swing.JTable (); 93 webCompsSuccessfullyCalledPanel = new javax.swing.JPanel (); 94 webCompsSuccessfullyCalledTable = new javax.swing.JTable (); 95 jScrollPane3 = new javax.swing.JScrollPane (); 96 ejbCompsPanel = new javax.swing.JPanel (); 97 ejbMethodsUnSuccessfullyCalledPanel = new javax.swing.JPanel (); 98 ejbMethodsUnSuccessfullyCalledTable = new javax.swing.JTable (); 99 ejbMethodsNotCalledPanel = new javax.swing.JPanel (); 100 ejbMethodsNotCalledTable = new javax.swing.JTable (); 101 ejbMethodsSuccessfullyCalledPanel = new javax.swing.JPanel (); 102 ejbMethodsSuccessfullyCalledTable = new javax.swing.JTable (); 103 jButton1 = new javax.swing.JButton (); 104 105 jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.BOTTOM); 106 jPanel1.setBackground(new java.awt.Color (255, 255, 255)); 107 summaryPanel.setBackground(new java.awt.Color (255, 255, 255)); 108 summaryPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("Summary"), javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font ("Dialog", 1, 14))); 109 org.openide.awt.Mnemonics.setLocalizedText(jLabel1, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("AppName")); 110 111 org.openide.awt.Mnemonics.setLocalizedText(jLabel2, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompCoverage")); 112 113 org.openide.awt.Mnemonics.setLocalizedText(jLabel3, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("EjbCompCoverage")); 114 115 org.openide.awt.Mnemonics.setLocalizedText(appName, getApplicationName()); 116 117 org.openide.awt.Mnemonics.setLocalizedText(webCompPercentage, getWebCompCoverage()); 118 119 org.openide.awt.Mnemonics.setLocalizedText(ejbCompPercentage, getEJBCompCoverage()); 120 121 org.jdesktop.layout.GroupLayout summaryPanelLayout = new org.jdesktop.layout.GroupLayout(summaryPanel); 122 summaryPanel.setLayout(summaryPanelLayout); 123 summaryPanelLayout.setHorizontalGroup( 124 summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 125 .add(summaryPanelLayout.createSequentialGroup() 126 .addContainerGap() 127 .add(summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 128 .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) 129 .add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) 130 .add(jLabel3)) 131 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 132 .add(summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 133 .add(webCompPercentage, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE) 134 .add(appName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE) 135 .add(ejbCompPercentage, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE)) 136 .addContainerGap()) 137 ); 138 summaryPanelLayout.setVerticalGroup( 139 summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 140 .add(summaryPanelLayout.createSequentialGroup() 141 .addContainerGap() 142 .add(summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 143 .add(appName) 144 .add(jLabel1)) 145 .add(16, 16, 16) 146 .add(summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 147 .add(webCompPercentage) 148 .add(jLabel2)) 149 .add(15, 15, 15) 150 .add(summaryPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 151 .add(ejbCompPercentage) 152 .add(jLabel3)) 153 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 154 ); 155 156 webCompsPanel.setBackground(new java.awt.Color (255, 255, 255)); 157 webCompsUnSuccessfullyCalledPanel.setBackground(new java.awt.Color (255, 255, 255)); 158 webCompsUnSuccessfullyCalledPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompsUnsuccessfullyCalled"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font ("Dialog", 1, 11))); 159 webCompsUnSuccessfullyCalledTable.setModel(new WebCompsUnSuccessfullyCalledTable(webCompsUnSuccessfullyCalledTable)); 160 webCompsUnSuccessfullyCalledTable.getColumnModel().getColumn(0).setPreferredWidth(500); 161 webCompsUnSuccessfullyCalledTable.setShowHorizontalLines(false); 162 webCompsUnSuccessfullyCalledTable.setShowVerticalLines(false); 163 webCompsUnSuccessfullyCalledTable.setTableHeader(webCompsUnSuccessfullyCalledTable.getTableHeader()); 164 webCompsUnSuccessfullyCalledTable.addMouseListener(new java.awt.event.MouseAdapter () { 165 public void mouseClicked(java.awt.event.MouseEvent evt) { 166 webCompsUnSuccessfullyCalledTableMouseClicked(evt); 167 } 168 }); 169 170 webCompsUnSuccessfullyCalledTable.getAccessibleContext().setAccessibleParent(webCompsUnSuccessfullyCalledPanel); 171 172 org.jdesktop.layout.GroupLayout webCompsUnSuccessfullyCalledPanelLayout = new org.jdesktop.layout.GroupLayout(webCompsUnSuccessfullyCalledPanel); 173 webCompsUnSuccessfullyCalledPanel.setLayout(webCompsUnSuccessfullyCalledPanelLayout); 174 webCompsUnSuccessfullyCalledPanelLayout.setHorizontalGroup( 175 webCompsUnSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 176 .add(webCompsUnSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE) 177 ); 178 webCompsUnSuccessfullyCalledPanelLayout.setVerticalGroup( 179 webCompsUnSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 180 .add(webCompsUnSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) 181 ); 182 183 webCompsNotCalledPanel.setBackground(new java.awt.Color (255, 255, 255)); 184 webCompsNotCalledPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompsNotCalled"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font ("Dialog", 1, 11))); 185 webCompsNotCalledTable.setModel(new WebCompsNotCalledTable(webCompsNotCalledTable)); 186 webCompsNotCalledTable.getColumnModel().getColumn(0).setPreferredWidth(500); 187 webCompsNotCalledTable.setMaximumSize(new java.awt.Dimension (10000000, 10000000)); 188 webCompsNotCalledTable.setShowHorizontalLines(false); 189 webCompsNotCalledTable.setShowVerticalLines(false); 190 webCompsNotCalledTable.setTableHeader(webCompsNotCalledTable.getTableHeader()); 191 webCompsNotCalledTable.addMouseListener(new java.awt.event.MouseAdapter () { 192 public void mouseClicked(java.awt.event.MouseEvent evt) { 193 webCompsNotCalledTableMouseClicked(evt); 194 } 195 }); 196 197 webCompsNotCalledTable.getAccessibleContext().setAccessibleParent(webCompsNotCalledPanel); 198 199 org.jdesktop.layout.GroupLayout webCompsNotCalledPanelLayout = new org.jdesktop.layout.GroupLayout(webCompsNotCalledPanel); 200 webCompsNotCalledPanel.setLayout(webCompsNotCalledPanelLayout); 201 webCompsNotCalledPanelLayout.setHorizontalGroup( 202 webCompsNotCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 203 .add(org.jdesktop.layout.GroupLayout.TRAILING, webCompsNotCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE) 204 ); 205 webCompsNotCalledPanelLayout.setVerticalGroup( 206 webCompsNotCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 207 .add(webCompsNotCalledPanelLayout.createSequentialGroup() 208 .add(webCompsNotCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE) 209 .addContainerGap()) 210 ); 211 212 webCompsSuccessfullyCalledPanel.setBackground(new java.awt.Color (255, 255, 255)); 213 webCompsSuccessfullyCalledPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompsSuccessfullyCalled"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font ("Dialog", 1, 11))); 214 webCompsSuccessfullyCalledTable.setModel(new WebCompsSuccessfullyCalledTable(webCompsSuccessfullyCalledTable)); 215 webCompsSuccessfullyCalledTable.getColumnModel().getColumn(0).setPreferredWidth(500); 216 webCompsSuccessfullyCalledTable.setShowHorizontalLines(false); 217 webCompsSuccessfullyCalledTable.setShowVerticalLines(false); 218 webCompsSuccessfullyCalledTable.setTableHeader(webCompsSuccessfullyCalledTable.getTableHeader()); 219 webCompsSuccessfullyCalledTable.addMouseListener(new java.awt.event.MouseAdapter () { 220 public void mouseClicked(java.awt.event.MouseEvent evt) { 221 webCompsSuccessfullyCalledTableMouseClicked(evt); 222 } 223 }); 224 225 webCompsSuccessfullyCalledTable.getAccessibleContext().setAccessibleParent(webCompsSuccessfullyCalledPanel); 226 227 org.jdesktop.layout.GroupLayout webCompsSuccessfullyCalledPanelLayout = new org.jdesktop.layout.GroupLayout(webCompsSuccessfullyCalledPanel); 228 webCompsSuccessfullyCalledPanel.setLayout(webCompsSuccessfullyCalledPanelLayout); 229 webCompsSuccessfullyCalledPanelLayout.setHorizontalGroup( 230 webCompsSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 231 .add(webCompsSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE) 232 ); 233 webCompsSuccessfullyCalledPanelLayout.setVerticalGroup( 234 webCompsSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 235 .add(webCompsSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE) 236 ); 237 238 org.jdesktop.layout.GroupLayout webCompsPanelLayout = new org.jdesktop.layout.GroupLayout(webCompsPanel); 239 webCompsPanel.setLayout(webCompsPanelLayout); 240 webCompsPanelLayout.setHorizontalGroup( 241 webCompsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 242 .add(webCompsUnSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 243 .add(webCompsSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 244 .add(webCompsNotCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 245 ); 246 webCompsPanelLayout.setVerticalGroup( 247 webCompsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 248 .add(webCompsPanelLayout.createSequentialGroup() 249 .addContainerGap() 250 .add(webCompsUnSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 251 .add(17, 17, 17) 252 .add(webCompsNotCalledPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 253 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 254 .add(webCompsSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 255 .addContainerGap()) 256 ); 257 jScrollPane2.setViewportView(webCompsPanel); 258 259 compsTabbedPane.addTab("tab1", jScrollPane2); 260 261 ejbCompsPanel.setBackground(new java.awt.Color (255, 255, 255)); 262 ejbMethodsUnSuccessfullyCalledPanel.setBackground(new java.awt.Color (255, 255, 255)); 263 ejbMethodsUnSuccessfullyCalledPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("EjbMethodsUnsuccessfullyCalled"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font ("Dialog", 1, 11))); 264 ejbMethodsUnSuccessfullyCalledTable.setModel(new EJBCompsUnSuccessfullyCalledTable(ejbMethodsUnSuccessfullyCalledTable)); 265 ejbMethodsUnSuccessfullyCalledTable.getColumnModel().getColumn(0).setPreferredWidth(500); 266 ejbMethodsUnSuccessfullyCalledTable.setShowHorizontalLines(false); 267 ejbMethodsUnSuccessfullyCalledTable.setShowVerticalLines(false); 268 ejbMethodsUnSuccessfullyCalledTable.setTableHeader(ejbMethodsUnSuccessfullyCalledTable.getTableHeader()); 269 ejbMethodsUnSuccessfullyCalledTable.addMouseListener(new java.awt.event.MouseAdapter () { 270 public void mouseClicked(java.awt.event.MouseEvent evt) { 271 ejbMethodsUnSuccessfullyCalledTableMouseClicked(evt); 272 } 273 }); 274 275 ejbMethodsUnSuccessfullyCalledTable.getAccessibleContext().setAccessibleParent(ejbMethodsUnSuccessfullyCalledPanel); 276 277 org.jdesktop.layout.GroupLayout ejbMethodsUnSuccessfullyCalledPanelLayout = new org.jdesktop.layout.GroupLayout(ejbMethodsUnSuccessfullyCalledPanel); 278 ejbMethodsUnSuccessfullyCalledPanel.setLayout(ejbMethodsUnSuccessfullyCalledPanelLayout); 279 ejbMethodsUnSuccessfullyCalledPanelLayout.setHorizontalGroup( 280 ejbMethodsUnSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 281 .add(ejbMethodsUnSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE) 282 ); 283 ejbMethodsUnSuccessfullyCalledPanelLayout.setVerticalGroup( 284 ejbMethodsUnSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 285 .add(ejbMethodsUnSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE) 286 ); 287 288 ejbMethodsNotCalledPanel.setBackground(new java.awt.Color (255, 255, 255)); 289 ejbMethodsNotCalledPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("EjbMethodsNotCalled"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font ("Dialog", 1, 11))); 290 ejbMethodsNotCalledTable.setModel(new EJBCompsNotCalledTable(ejbMethodsNotCalledTable)); 291 ejbMethodsNotCalledTable.getColumnModel().getColumn(0).setPreferredWidth(500); 292 ejbMethodsNotCalledTable.setShowHorizontalLines(false); 293 ejbMethodsNotCalledTable.setShowVerticalLines(false); 294 ejbMethodsNotCalledTable.setTableHeader(ejbMethodsNotCalledTable.getTableHeader()); 295 ejbMethodsNotCalledTable.addMouseListener(new java.awt.event.MouseAdapter () { 296 public void mouseClicked(java.awt.event.MouseEvent evt) { 297 ejbMethodsNotCalledTableMouseClicked(evt); 298 } 299 }); 300 301 ejbMethodsNotCalledTable.getAccessibleContext().setAccessibleParent(ejbMethodsNotCalledPanel); 302 303 org.jdesktop.layout.GroupLayout ejbMethodsNotCalledPanelLayout = new org.jdesktop.layout.GroupLayout(ejbMethodsNotCalledPanel); 304 ejbMethodsNotCalledPanel.setLayout(ejbMethodsNotCalledPanelLayout); 305 ejbMethodsNotCalledPanelLayout.setHorizontalGroup( 306 ejbMethodsNotCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 307 .add(ejbMethodsNotCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE) 308 ); 309 ejbMethodsNotCalledPanelLayout.setVerticalGroup( 310 ejbMethodsNotCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 311 .add(ejbMethodsNotCalledPanelLayout.createSequentialGroup() 312 .add(ejbMethodsNotCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE) 313 .addContainerGap()) 314 ); 315 316 ejbMethodsSuccessfullyCalledPanel.setBackground(new java.awt.Color (255, 255, 255)); 317 ejbMethodsSuccessfullyCalledPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("EjbMethodsSuccessfullyCalled"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font ("Dialog", 1, 11))); 318 ejbMethodsSuccessfullyCalledTable.setModel(new EJBCompsSuccessfullyCalledTable(ejbMethodsSuccessfullyCalledTable)); 319 ejbMethodsSuccessfullyCalledTable.getColumnModel().getColumn(0).setPreferredWidth(500); 320 ejbMethodsSuccessfullyCalledTable.setShowHorizontalLines(false); 321 ejbMethodsSuccessfullyCalledTable.setShowVerticalLines(false); 322 ejbMethodsSuccessfullyCalledTable.setTableHeader(ejbMethodsSuccessfullyCalledTable.getTableHeader()); 323 ejbMethodsSuccessfullyCalledTable.addMouseListener(new java.awt.event.MouseAdapter () { 324 public void mouseClicked(java.awt.event.MouseEvent evt) { 325 ejbMethodsSuccessfullyCalledTableMouseClicked(evt); 326 } 327 }); 328 329 ejbMethodsSuccessfullyCalledTable.getAccessibleContext().setAccessibleParent(ejbMethodsSuccessfullyCalledPanel); 330 331 org.jdesktop.layout.GroupLayout ejbMethodsSuccessfullyCalledPanelLayout = new org.jdesktop.layout.GroupLayout(ejbMethodsSuccessfullyCalledPanel); 332 ejbMethodsSuccessfullyCalledPanel.setLayout(ejbMethodsSuccessfullyCalledPanelLayout); 333 ejbMethodsSuccessfullyCalledPanelLayout.setHorizontalGroup( 334 ejbMethodsSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 335 .add(ejbMethodsSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 762, Short.MAX_VALUE) 336 ); 337 ejbMethodsSuccessfullyCalledPanelLayout.setVerticalGroup( 338 ejbMethodsSuccessfullyCalledPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 339 .add(ejbMethodsSuccessfullyCalledTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE) 340 ); 341 342 org.jdesktop.layout.GroupLayout ejbCompsPanelLayout = new org.jdesktop.layout.GroupLayout(ejbCompsPanel); 343 ejbCompsPanel.setLayout(ejbCompsPanelLayout); 344 ejbCompsPanelLayout.setHorizontalGroup( 345 ejbCompsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 346 .add(ejbMethodsUnSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 347 .add(org.jdesktop.layout.GroupLayout.TRAILING, ejbMethodsNotCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 348 .add(ejbCompsPanelLayout.createSequentialGroup() 349 .add(ejbMethodsSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 350 .addContainerGap()) 351 ); 352 ejbCompsPanelLayout.setVerticalGroup( 353 ejbCompsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 354 .add(ejbCompsPanelLayout.createSequentialGroup() 355 .addContainerGap() 356 .add(ejbMethodsUnSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 357 .add(14, 14, 14) 358 .add(ejbMethodsNotCalledPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 359 .add(15, 15, 15) 360 .add(ejbMethodsSuccessfullyCalledPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 361 .addContainerGap(46, Short.MAX_VALUE)) 362 ); 363 jScrollPane3.setViewportView(ejbCompsPanel); 364 365 compsTabbedPane.addTab("tab2", jScrollPane3); 366 367 org.openide.awt.Mnemonics.setLocalizedText(jButton1, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ViewHTMLReportsButton")); 368 jButton1.addMouseListener(new java.awt.event.MouseAdapter () { 369 public void mouseClicked(java.awt.event.MouseEvent evt) { 370 jButton1MouseClicked(evt); 371 } 372 }); 373 374 org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); 375 jPanel1.setLayout(jPanel1Layout); 376 jPanel1Layout.setHorizontalGroup( 377 jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 378 .add(jPanel1Layout.createSequentialGroup() 379 .addContainerGap() 380 .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 381 .add(summaryPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 382 .add(compsTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 807, Short.MAX_VALUE) 383 .add(jButton1)) 384 .addContainerGap()) 385 ); 386 jPanel1Layout.setVerticalGroup( 387 jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 388 .add(jPanel1Layout.createSequentialGroup() 389 .addContainerGap() 390 .add(summaryPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 391 .add(14, 14, 14) 392 .add(compsTabbedPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 391, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 393 .add(29, 29, 29) 394 .add(jButton1) 395 .addContainerGap(24, Short.MAX_VALUE)) 396 ); 397 jScrollPane1.setViewportView(jPanel1); 398 399 jTabbedPane1.addTab("tab1", jScrollPane1); 400 401 jTabbedPane1.getAccessibleContext().setAccessibleName("AVK Report"); 402 jTabbedPane1.getAccessibleContext().setAccessibleDescription("AVK Report"); 403 404 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 405 this.setLayout(layout); 406 layout.setHorizontalGroup( 407 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 408 .add(layout.createSequentialGroup() 409 .addContainerGap() 410 .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 535, Short.MAX_VALUE) 411 .addContainerGap()) 412 ); 413 layout.setVerticalGroup( 414 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 415 .add(layout.createSequentialGroup() 416 .addContainerGap() 417 .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 464, Short.MAX_VALUE) 418 .addContainerGap()) 419 ); 420 } 422 private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { try { 425 File report = new File (avkReport.getResultsDir() + File.separator + "suiteSummary.html"); 426 URLDisplayer.getDefault().showURL(report.toURI().toURL()); 427 } catch(Exception ex) { 428 ex.printStackTrace(); 429 } 430 } 432 private void ejbMethodsSuccessfullyCalledTableMouseClicked(java.awt.event.MouseEvent evt) { EJBCompsSuccessfullyCalledTable tableModel = (EJBCompsSuccessfullyCalledTable)ejbMethodsSuccessfullyCalledTable.getModel(); 435 tableModel.handleMouseClicked(evt); 436 } 438 private void ejbMethodsNotCalledTableMouseClicked(java.awt.event.MouseEvent evt) { EJBCompsNotCalledTable tableModel = (EJBCompsNotCalledTable)ejbMethodsNotCalledTable.getModel(); 441 tableModel.handleMouseClicked(evt); 442 } 444 private void ejbMethodsUnSuccessfullyCalledTableMouseClicked(java.awt.event.MouseEvent evt) { EJBCompsUnSuccessfullyCalledTable tableModel = (EJBCompsUnSuccessfullyCalledTable)ejbMethodsUnSuccessfullyCalledTable.getModel(); 447 tableModel.handleMouseClicked(evt); 448 } 450 private void webCompsSuccessfullyCalledTableMouseClicked(java.awt.event.MouseEvent evt) { WebCompsSuccessfullyCalledTable tableModel = (WebCompsSuccessfullyCalledTable)webCompsSuccessfullyCalledTable.getModel(); 453 tableModel.handleMouseClicked(evt); 454 } 456 private void webCompsNotCalledTableMouseClicked(java.awt.event.MouseEvent evt) { WebCompsNotCalledTable tableModel = (WebCompsNotCalledTable)webCompsNotCalledTable.getModel(); 459 tableModel.handleMouseClicked(evt); 460 } 462 private void webCompsUnSuccessfullyCalledTableMouseClicked(java.awt.event.MouseEvent evt) { WebCompsUnSuccessfullyCalledTable tableModel = (WebCompsUnSuccessfullyCalledTable) webCompsUnSuccessfullyCalledTable.getModel(); 465 tableModel.handleMouseClicked(evt); 466 } 468 469 private javax.swing.JLabel appName; 471 private javax.swing.JTabbedPane compsTabbedPane; 472 private javax.swing.JLabel ejbCompPercentage; 473 private javax.swing.JPanel ejbCompsPanel; 474 private javax.swing.JPanel ejbMethodsNotCalledPanel; 475 private javax.swing.JTable ejbMethodsNotCalledTable; 476 private javax.swing.JPanel ejbMethodsSuccessfullyCalledPanel; 477 private javax.swing.JTable ejbMethodsSuccessfullyCalledTable; 478 private javax.swing.JPanel ejbMethodsUnSuccessfullyCalledPanel; 479 private javax.swing.JTable ejbMethodsUnSuccessfullyCalledTable; 480 private javax.swing.JButton jButton1; 481 private javax.swing.JLabel jLabel1; 482 private javax.swing.JLabel jLabel2; 483 private javax.swing.JLabel jLabel3; 484 private javax.swing.JPanel jPanel1; 485 private javax.swing.JScrollPane jScrollPane1; 486 private javax.swing.JScrollPane jScrollPane2; 487 private javax.swing.JScrollPane jScrollPane3; 488 private javax.swing.JTabbedPane jTabbedPane1; 489 private javax.swing.JPanel summaryPanel; 490 private javax.swing.JLabel webCompPercentage; 491 private javax.swing.JPanel webCompsNotCalledPanel; 492 private javax.swing.JTable webCompsNotCalledTable; 493 private javax.swing.JPanel webCompsPanel; 494 private javax.swing.JPanel webCompsSuccessfullyCalledPanel; 495 private javax.swing.JTable webCompsSuccessfullyCalledTable; 496 private javax.swing.JPanel webCompsUnSuccessfullyCalledPanel; 497 private javax.swing.JTable webCompsUnSuccessfullyCalledTable; 498 500 505 public static synchronized ReportTopComponent getDefault() { 506 if (instance == null) { 507 instance = new ReportTopComponent(); 508 } 509 return instance; 510 } 511 512 515 public static synchronized ReportTopComponent findInstance() { 516 TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); 517 if (win == null) { 518 ErrorManager.getDefault().log(ErrorManager.WARNING, "Cannot find Report component. It will not be located properly in the window system."); 519 return getDefault(); 520 } 521 if (win instanceof ReportTopComponent) { 522 return (ReportTopComponent)win; 523 } 524 ErrorManager.getDefault().log(ErrorManager.WARNING, "There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior."); 525 return getDefault(); 526 } 527 528 public int getPersistenceType() { 529 return TopComponent.PERSISTENCE_ALWAYS; 530 } 531 532 public void componentOpened() { 533 } 535 536 public void componentClosed() { 537 } 539 540 541 public Object writeReplace() { 542 return new ResolvableHelper(); 543 } 544 545 protected String preferredID() { 546 return PREFERRED_ID; 547 } 548 549 final static class ResolvableHelper implements Serializable { 550 private static final long serialVersionUID = 1L; 551 public Object readResolve() { 552 return ReportTopComponent.getDefault(); 553 } 554 } 555 556 557 560 private ReportModel avkReport; 561 562 public void repaint() { 563 566 updateVisibility(); 567 568 try { 569 jTabbedPane1.setTitleAt(0, "AVK Reports"); 570 } catch(Exception ex) { 571 ex.printStackTrace(); 572 } 573 super.repaint(); 574 } 575 576 private void updateVisibility(JTabbedPane tabbedPane, int index, JScrollPane child, int... sizeOfChild) { 577 tabbedPane.setTitleAt(0, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompsTabTitle")); 578 tabbedPane.setTitleAt(1, java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("EjbCompsTabTitle")); 579 580 601 } 602 603 private void updateVisibility(JPanel panel, int... sizeOfChild) { 604 int sizeOfChildren = 0; 605 for(int i=0; i<sizeOfChild.length; i++) { 606 sizeOfChildren += sizeOfChild[i]; 607 } 608 boolean visible = sizeOfChildren == 0 ? false : true; 609 panel.setVisible(visible); 610 } 611 612 private void updateVisibility() { 613 614 int webCompsUnSuccessfullyCalled = webCompsUnSuccessfullyCalledTable.getRowCount(); 615 int webCompsSuccessfullyCalled = webCompsSuccessfullyCalledTable.getRowCount(); 616 int webCompsNotCalled = webCompsNotCalledTable.getRowCount(); 617 int ejbCompsUnSuccessfullyCalled = ejbMethodsUnSuccessfullyCalledTable.getRowCount(); 618 int ejbCompsSuccessfullyCalled = ejbMethodsSuccessfullyCalledTable.getRowCount(); 619 int ejbCompsNotCalled = ejbMethodsNotCalledTable.getRowCount(); 620 621 updateVisibility(webCompsUnSuccessfullyCalledPanel,webCompsUnSuccessfullyCalled); 623 updateVisibility(webCompsSuccessfullyCalledPanel, webCompsSuccessfullyCalled); 624 updateVisibility(webCompsNotCalledPanel, webCompsNotCalled); 625 626 updateVisibility(compsTabbedPane, 0, jScrollPane2, webCompsUnSuccessfullyCalled, webCompsSuccessfullyCalled, webCompsNotCalled); 627 updateVisibility(compsTabbedPane, 1, jScrollPane3, ejbCompsUnSuccessfullyCalled, ejbCompsSuccessfullyCalled, ejbCompsNotCalled); 628 629 updateVisibility(ejbMethodsUnSuccessfullyCalledPanel, ejbCompsUnSuccessfullyCalled); 631 updateVisibility(ejbMethodsSuccessfullyCalledPanel, ejbCompsSuccessfullyCalled); 632 633 updateVisibility(ejbMethodsNotCalledPanel, ejbCompsNotCalled); 634 635 638 updateSize(webCompsNotCalledTable, webCompsNotCalledPanel); 639 updateSize(webCompsSuccessfullyCalledTable, webCompsSuccessfullyCalledPanel); 640 updateSize(webCompsUnSuccessfullyCalledTable, webCompsUnSuccessfullyCalledPanel); 641 642 updateSize(ejbMethodsNotCalledTable, ejbMethodsNotCalledPanel); 643 updateSize(ejbMethodsSuccessfullyCalledTable, ejbMethodsSuccessfullyCalledPanel); 644 updateSize(ejbMethodsUnSuccessfullyCalledTable, ejbMethodsUnSuccessfullyCalledPanel); 645 646 649 appName.setText(getApplicationName()); 650 webCompPercentage.setText(getWebCompCoverage()); 651 ejbCompPercentage.setText(getEJBCompCoverage()); 652 653 655 } 656 657 private void updateSize(javax.swing.JTable table, javax.swing.JPanel parent) { 658 if(!table.isVisible() || !parent.isVisible()) return; 659 double HEIGHT_PADDING = 25.0; 660 661 javax.swing.table.JTableHeader header = table.getTableHeader(); 662 if (header != null) { 663 664 DefaultTableCellRenderer headerRenderer = (DefaultTableCellRenderer )header.getDefaultRenderer(); 666 Font originalFont = headerRenderer.getFont(); 667 Font boldFont = new java.awt.Font (originalFont.getName(), Font.BOLD, originalFont.getSize()); 668 header.setFont(boldFont); 669 headerRenderer.setHorizontalAlignment(SwingConstants.LEFT); 670 671 parent.removeAll(); 673 parent.setLayout(new BorderLayout ()); 674 parent.add(header, BorderLayout.NORTH); 675 parent.add(table, BorderLayout.CENTER); 676 } 677 678 Dimension size = table.getSize(); 679 size.setSize(size.getWidth(), (table.getRowCount() * table.getRowHeight()) + HEIGHT_PADDING); 680 table.setPreferredSize(size); 681 size.setSize(size.getWidth(), size.getHeight() + HEIGHT_PADDING); 682 parent.setPreferredSize(size); 683 } 684 685 class CommonTableModel extends DefaultTableModel { 686 687 protected JTable table; 688 689 public CommonTableModel(JTable table) { 690 this.table = table; 691 } 692 693 public void handleMouseClicked(final MouseEvent evt) { 694 if(evt.getButton() == MouseEvent.BUTTON3 && table.columnAtPoint(evt.getPoint()) == 0) { 695 JPopupMenu popup = new JPopupMenu (); 696 JMenuItem popupShowSource = new JMenuItem (); 697 Font boldfont = popup.getFont().deriveFont(Font.BOLD); 698 ActionListener menuListener = new ActionListener () { 699 public void actionPerformed(ActionEvent actionEvent) { 700 int row = table.rowAtPoint(evt.getPoint()); 701 int col = table.columnAtPoint(evt.getPoint()); 702 String methodSig = (String )getValueAt(row, col); 703 openSource(methodSig); 704 } 705 }; 706 popupShowSource.setFont(boldfont); 707 popupShowSource.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("GoToSource")); 708 popupShowSource.addActionListener(menuListener); 709 popup.add(popupShowSource); 710 popup.show(evt.getComponent(), evt.getX(), evt.getY()); 711 } 712 } 713 714 protected void clear(InputOutput io) { 715 try { 716 io.getOut().reset(); 717 } catch(Exception ex) {} 718 } 719 720 @Override public void setValueAt(Object aValue, int row, int column) { 721 } 723 724 737 private String getClassName(String methodSignature) { 738 String className = methodSignature; 739 try { 740 className = methodSignature.substring(0, methodSignature.lastIndexOf("(")); 741 className = className.substring(className.lastIndexOf(" "), className.lastIndexOf(".")).trim(); 742 } catch(Exception ex) { 743 className = methodSignature; } 745 return className; 746 } 747 748 private String getMethodName(String methodSignature) { 749 String methodName = null; 750 try { 751 methodName = methodSignature.substring(0, methodSignature.lastIndexOf("(")); 752 methodName = methodName.substring(methodName.lastIndexOf(".")+1); 753 } catch(Exception ex) { 754 methodName = null; } 756 return methodName; 757 } 758 759 private List getMethodParams(String methodSignature) { 760 List methodParams = new ArrayList (); 761 try { 762 String params = methodSignature.substring(methodSignature.lastIndexOf("(") + 1, methodSignature.lastIndexOf(")")); 763 AdminTasks.debug("params = " + params); 764 StringTokenizer st = new StringTokenizer (params, ","); 765 while(st.hasMoreTokens()) { 766 String param = st.nextToken(); 767 Type type = JavaModel.getDefaultExtent().getType().resolve(param); 768 methodParams.add(type); 769 } 770 } catch(Exception ex) { 771 methodParams = new ArrayList (); } 773 return methodParams; 774 } 775 776 protected void openSource(String methodSignature) { 777 String className = getClassName(methodSignature); 778 String methodName = getMethodName(methodSignature); 779 List methodParams = getMethodParams(methodSignature); 780 openSource(className, methodName, methodParams); 781 } 782 783 protected void openSource(String className, String methodName, List methodParams) { 784 try { 785 AdminTasks.debug("\n\nOpenSource : \nclassName = " + className + "\nmethodName = " + methodName + "\nmethodParams = " + methodParams); 786 JavaClass javaClass = (JavaClass)JavaModel.getDefaultExtent().getType().resolve(className); 787 FileObject fo = JavaModel.getFileObject(javaClass.getResource()); 788 if(methodName != null) { 789 Resource resource = JavaModel.getResource(fo); 790 JavaMetamodel javaMetamodel = JavaMetamodel.getManager(); 791 Method m = javaClass.getMethod(methodName,methodParams,true); 792 Element element = resource.getElementByOffset(m.getStartOffset()); 793 PositionBounds position = javaMetamodel.getElementPosition(element); 794 ((JavaEditor) javaMetamodel.getDataObject(element.getResource()).getCookie(JavaEditor.class)).openAt(position.getBegin()); 795 } else { 796 DataObject dobj = DataObject.find(fo); 797 OpenCookie oc = (OpenCookie)dobj.getCookie(OpenCookie.class); 798 oc.open(); 799 } 800 } catch (Throwable t) { 801 StatusDisplayer.getDefault().setStatusText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("GoToSourceFailed") + className); 802 t.printStackTrace(); 803 } 804 } 805 } 806 807 class WebCompsSuccessfullyCalledTable extends CommonTableModel { 808 809 List <WebComponent> webCompsSuccessfullyCalled; 810 String [] columnNames; 811 812 public WebCompsSuccessfullyCalledTable(JTable table) { 813 super(table); 814 } 815 816 private void initTable() { 817 webCompsSuccessfullyCalled = ReportModel.getInstance().getWebComponentsSuccessfullyCalled(); 818 columnNames = new String [] { 819 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompName"), 820 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ContextRoot"), 821 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("Invocations") 822 }; 823 } 824 825 public int getColumnCount() { 826 initTable(); 827 return columnNames.length; 828 } 829 830 public int getRowCount() { 831 initTable(); 832 return webCompsSuccessfullyCalled.size(); 833 } 834 835 public String getColumnName(int column) { 836 return columnNames[column]; 837 } 838 839 public Object getValueAt(int row, int column) { 840 initTable(); 841 String value = null; 842 if(column == 0) { try { 844 value = webCompsSuccessfullyCalled.get(row).getWebEntity(0).getName(); 845 } catch(Exception ex) { 846 ex.printStackTrace(); 847 value = null; 848 } 849 } else if(column == 1) { try { 851 value = webCompsSuccessfullyCalled.get(row).getContext(); 852 } catch(Exception ex) { 853 ex.printStackTrace(); 854 value = null; 855 } 856 } else if(column == 2) { try { 858 value = webCompsSuccessfullyCalled.get(row).getWebEntity(0).getCounter(); 859 } catch(Exception ex) { 860 ex.printStackTrace(); 861 value = null; 862 } 863 } 864 return value; 865 } 866 867 } 868 869 class WebCompsUnSuccessfullyCalledTable extends CommonTableModel { 870 871 List <WebComponent> webCompsUnSuccessfullyCalled; 872 String [] columnNames; 873 874 public WebCompsUnSuccessfullyCalledTable(JTable table) { 875 super(table); 876 } 877 878 private void initTable() { 879 webCompsUnSuccessfullyCalled = ReportModel.getInstance().getWebComponentsUnSuccessfullyCalled(); 880 columnNames = new String [] { 881 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompName"), 882 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ContextRoot"), 883 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("Exceptions") 884 }; 885 } 886 887 public int getColumnCount() { 888 initTable(); 889 return columnNames.length; 890 } 891 892 public int getRowCount() { 893 initTable(); 894 return webCompsUnSuccessfullyCalled.size(); 895 } 896 897 public String getColumnName(int column) { 898 return columnNames[column]; 899 } 900 901 public Object getValueAt(int row, int column) { 902 initTable(); 903 String value = null; 904 if(column == 0) { try { 906 value = webCompsUnSuccessfullyCalled.get(row).getWebEntity(0).getName(); 907 } catch(Exception ex) { 908 ex.printStackTrace(); 909 value = null; 910 } 911 } else if(column == 1) { try { 913 value = webCompsUnSuccessfullyCalled.get(row).getContext(); 914 } catch(Exception ex) { 915 ex.printStackTrace(); 916 value = null; 917 } 918 } else if(column == 2) { try { 920 value = webCompsUnSuccessfullyCalled.get(row).getWebEntity(0).getAppVerificationException(0).getExceptionName(); 921 } catch(Exception ex) { 922 ex.printStackTrace(); 923 value = null; 924 } 925 } 926 return value; 927 } 928 929 public void handleMouseClicked(final MouseEvent evt) { 930 if(evt.getButton() == MouseEvent.BUTTON3 && table.columnAtPoint(evt.getPoint()) == 2) { 931 JPopupMenu popup = new JPopupMenu (); 932 JMenuItem popupShowSource = new JMenuItem (); 933 Font boldfont = popup.getFont().deriveFont(Font.BOLD); 934 ActionListener menuListener = new ActionListener () { 935 public void actionPerformed(ActionEvent actionEvent) { 936 int row = table.rowAtPoint(evt.getPoint()); 937 int col = table.columnAtPoint(evt.getPoint()); 938 String exceptionTrace = webCompsUnSuccessfullyCalled.get(row).getWebEntity(0).getAppVerificationException(0).getExceptionTrace(); 939 String exceptionName = (String )getValueAt(row, col); 940 InputOutput io = IOProvider.getDefault().getIO(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ExceptionPrefix") + exceptionName, false); 941 clear(io); 942 io.getOut().write(exceptionTrace); 943 io.getOut().flush(); 944 io.select(); 945 } 946 }; 947 popupShowSource.setFont(boldfont); 948 popupShowSource.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ShowException")); 949 popupShowSource.addActionListener(menuListener); 950 popup.add(popupShowSource); 951 popup.show(evt.getComponent(), evt.getX(), evt.getY()); 952 } else { 953 super.handleMouseClicked(evt); 954 } 955 } 956 957 } 958 959 class WebCompsNotCalledTable extends CommonTableModel { 960 961 List <WebComponent> webCompsNotCalled; 962 String [] columnNames; 963 964 public WebCompsNotCalledTable(JTable table) { 965 super(table); 966 } 967 968 private void initTable() { 969 webCompsNotCalled = ReportModel.getInstance().getWebComponentsNotCalled(); 970 columnNames = new String [] { 971 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("WebCompName"), 972 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ContextRoot") 973 }; 974 } 975 976 public int getColumnCount() { 977 initTable(); 978 return columnNames.length; 979 } 980 981 public int getRowCount() { 982 initTable(); 983 return webCompsNotCalled.size(); 984 } 985 986 public String getColumnName(int column) { 987 return columnNames[column]; 988 } 989 990 public Object getValueAt(int row, int column) { 991 initTable(); 992 String value = null; 993 if(column == 0) { try { 995 value = webCompsNotCalled.get(row).getWebEntity(0).getName(); 996 } catch(Exception ex) { 997 ex.printStackTrace(); 998 value = null; 999 } 1000 } else if(column == 1) { try { 1002 value = webCompsNotCalled.get(row).getContext(); 1003 } catch(Exception ex) { 1004 ex.printStackTrace(); 1005 value = null; 1006 } 1007 } 1008 return value; 1009 } 1010 1011 } 1012 1013 class EJBCompsSuccessfullyCalledTable extends CommonTableModel { 1014 1015 List <EnterpriseBean> ejbCompsSuccessfullyCalled; 1016 String [] columnNames; 1017 1018 public EJBCompsSuccessfullyCalledTable(JTable table) { 1019 super(table); 1020 } 1021 1022 private void initTable() { 1023 ejbCompsSuccessfullyCalled = ReportModel.getInstance().getEJBComponentsSuccessfullyCalled(); 1024 columnNames = new String [] { 1025 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("MethodName"), 1026 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("BeanName"), 1027 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("Invocations") 1028 }; 1029 } 1030 1031 public int getColumnCount() { 1032 initTable(); 1033 return columnNames.length; 1034 } 1035 1036 public int getRowCount() { 1037 initTable(); 1038 return ejbCompsSuccessfullyCalled.size(); 1039 } 1040 1041 public String getColumnName(int column) { 1042 return columnNames[column]; 1043 } 1044 1045 public Object getValueAt(int row, int column) { 1046 initTable(); 1047 String value = null; 1048 if(column == 0) { try { 1050 value = ejbCompsSuccessfullyCalled.get(row).getMethod(0).getMethodSignature(); 1051 } catch(Exception ex) { 1052 ex.printStackTrace(); 1053 value = null; 1054 } 1055 } else if(column == 1) { try { 1057 value = ejbCompsSuccessfullyCalled.get(0).getBeanName(); 1058 } catch(Exception ex) { 1059 ex.printStackTrace(); 1060 value = null; 1061 } 1062 } else if(column == 2) { try { 1064 value = ejbCompsSuccessfullyCalled.get(row).getMethod(0).getCounter(); 1065 } catch(Exception ex) { 1066 ex.printStackTrace(); 1067 value = null; 1068 } 1069 } 1070 return value; 1071 } 1072 1073 } 1074 1075 class EJBCompsUnSuccessfullyCalledTable extends CommonTableModel { 1076 1077 List <EnterpriseBean> ejbCompsUnSuccessfullyCalled; 1078 String [] columnNames; 1079 1080 public EJBCompsUnSuccessfullyCalledTable(JTable table) { 1081 super(table); 1082 } 1083 1084 private void initTable() { 1085 ejbCompsUnSuccessfullyCalled = ReportModel.getInstance().getEJBComponentsUnSuccessfullyCalled(); 1086 columnNames = new String [] { 1087 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("MethodName"), 1088 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("BeanName"), 1089 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("Exceptions") 1090 }; 1091 } 1092 1093 public int getColumnCount() { 1094 initTable(); 1095 return columnNames.length; 1096 } 1097 1098 public int getRowCount() { 1099 initTable(); 1100 return ejbCompsUnSuccessfullyCalled.size(); 1101 } 1102 1103 public String getColumnName(int column) { 1104 return columnNames[column]; 1105 } 1106 1107 public Object getValueAt(int row, int column) { 1108 initTable(); 1109 String value = null; 1110 if(column == 0) { try { 1112 value = ejbCompsUnSuccessfullyCalled.get(row).getMethod(0).getMethodSignature(); 1113 } catch(Exception ex) { 1114 ex.printStackTrace(); 1115 value = null; 1116 } 1117 } else if(column == 1) { try { 1119 value = ejbCompsUnSuccessfullyCalled.get(0).getBeanName(); 1120 } catch(Exception ex) { 1121 ex.printStackTrace(); 1122 value = null; 1123 } 1124 } else if(column == 2) { try { 1126 value = ejbCompsUnSuccessfullyCalled.get(row).getMethod(0).getAppVerificationException(0).getExceptionName(); 1127 } catch(Exception ex) { 1128 ex.printStackTrace(); 1129 value = null; 1130 } 1131 } 1132 return value; 1133 } 1134 1135 public void handleMouseClicked(final MouseEvent evt) { 1136 if(evt.getButton() == MouseEvent.BUTTON3 && table.columnAtPoint(evt.getPoint()) == 2) { 1137 JPopupMenu popup = new JPopupMenu (); 1138 JMenuItem popupShowSource = new JMenuItem (); 1139 Font boldfont = popup.getFont().deriveFont(Font.BOLD); 1140 ActionListener menuListener = new ActionListener () { 1141 public void actionPerformed(ActionEvent actionEvent) { 1142 int row = table.rowAtPoint(evt.getPoint()); 1143 int col = table.columnAtPoint(evt.getPoint()); 1144 String exceptionTrace = ejbCompsUnSuccessfullyCalled.get(row).getMethod(0).getAppVerificationException(0).getExceptionTrace(); 1145 String exceptionName = (String )getValueAt(row, col); 1146 InputOutput io = IOProvider.getDefault().getIO(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("ExceptionPrefix") + exceptionName, false); 1147 clear(io); 1148 io.getOut().write(exceptionTrace); 1149 io.getOut().flush(); 1150 io.select(); 1151 } 1152 }; 1153 popupShowSource.setFont(boldfont); 1154 popupShowSource.setText("Show Exception"); 1155 popupShowSource.addActionListener(menuListener); 1156 popup.add(popupShowSource); 1157 popup.show(evt.getComponent(), evt.getX(), evt.getY()); 1158 } else { 1159 super.handleMouseClicked(evt); 1160 } 1161 } 1162 1163 } 1164 1165 class EJBCompsNotCalledTable extends CommonTableModel { 1166 1167 List <EnterpriseBean> ejbCompsNotCalled; 1168 String [] columnNames; 1169 1170 public EJBCompsNotCalledTable(JTable table) { 1171 super(table); 1172 } 1173 1174 private void initTable() { 1175 ejbCompsNotCalled = ReportModel.getInstance().getEJBComponentsNotCalled(); 1176 columnNames = new String [] { 1177 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("MethodName"), 1178 java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ide/avk/report/view/Bundle").getString("BeanName") 1179 }; 1180 } 1181 1182 public int getColumnCount() { 1183 initTable(); 1184 return columnNames.length; 1185 } 1186 1187 public int getRowCount() { 1188 initTable(); 1189 return ejbCompsNotCalled.size(); 1190 } 1191 1192 public String getColumnName(int column) { 1193 return columnNames[column]; 1194 } 1195 1196 public Object getValueAt(int row, int column) { 1197 initTable(); 1198 String value = null; 1199 if(column == 0) { try { 1201 value = ejbCompsNotCalled.get(row).getMethod(0).getMethodSignature(); 1202 } catch(Exception ex) { 1203 ex.printStackTrace(); 1204 value = null; 1205 } 1206 } else if(column == 1) { try { 1208 value = ejbCompsNotCalled.get(0).getBeanName(); 1209 } catch(Exception ex) { 1210 ex.printStackTrace(); 1211 value = null; 1212 } 1213 } 1214 return value; 1215 } 1216 1217 } 1218 1219 public String getApplicationName() { 1220 avkReport = ReportModel.getInstance(); 1221 return avkReport.getApplicationName(); 1222 } 1223 1224 public String getWebCompCoverage() { 1225 avkReport = ReportModel.getInstance(); 1226 return avkReport.getWebCompCoverage(); 1227 } 1228 1229 public String getEJBCompCoverage() { 1230 avkReport = ReportModel.getInstance(); 1231 return avkReport.getEJBCompCoverage(); 1232 } 1233 1234 1237 1238} 1239 | Popular Tags |