Source Code Cross Referenced for ExecResultStatDialog.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » requirements » ihm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » salomeTMF_plug.requirements.ihm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package salomeTMF_plug.requirements.ihm;
025:
026:        import java.awt.BorderLayout;
027:        import java.awt.Component;
028:        import java.awt.Dimension;
029:        import java.awt.FontMetrics;
030:        import java.awt.GridLayout;
031:        import java.awt.Rectangle;
032:        import java.awt.event.ActionEvent;
033:        import java.awt.event.ActionListener;
034:        import java.util.ArrayList;
035:        import java.util.Enumeration;
036:        import java.util.Hashtable;
037:        import java.util.Observable;
038:        import java.util.Observer;
039:        import java.util.Vector;
040:
041:        import javax.swing.BorderFactory;
042:        import javax.swing.DefaultCellEditor;
043:        import javax.swing.JButton;
044:        import javax.swing.JComboBox;
045:        import javax.swing.JDialog;
046:        import javax.swing.JPanel;
047:        import javax.swing.JScrollPane;
048:        import javax.swing.JTable;
049:        import javax.swing.ListSelectionModel;
050:        import javax.swing.event.ListSelectionEvent;
051:        import javax.swing.event.ListSelectionListener;
052:        import javax.swing.table.TableCellRenderer;
053:        import javax.swing.table.TableColumn;
054:        import javax.swing.tree.DefaultMutableTreeNode;
055:
056:        import org.jfree.chart.ChartFactory;
057:        import org.jfree.chart.ChartPanel;
058:        import org.jfree.chart.JFreeChart;
059:        import org.jfree.chart.plot.PiePlot3D;
060:        import org.jfree.data.general.DefaultPieDataset;
061:        import org.jfree.util.Rotation;
062:        import org.objectweb.salome_tmf.api.ApiConstants;
063:        import org.objectweb.salome_tmf.api.data.TestWrapper;
064:        import org.objectweb.salome_tmf.data.ExecutionResult;
065:        import org.objectweb.salome_tmf.data.ExecutionTestResult;
066:        import org.objectweb.salome_tmf.data.Test;
067:        import org.objectweb.salome_tmf.ihm.languages.Language;
068:        import org.objectweb.salome_tmf.ihm.main.ExecutionResultView;
069:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
070:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
071:        import org.objectweb.salome_tmf.ihm.models.MyTableModel;
072:        import org.objectweb.salome_tmf.ihm.models.TableSorter;
073:        import org.objectweb.salome_tmf.ihm.tools.Tools;
074:
075:        import salomeTMF_plug.requirements.ReqPlugin;
076:        import salomeTMF_plug.requirements.data.ReqLeaf;
077:        import salomeTMF_plug.requirements.data.Requirement;
078:        import salomeTMF_plug.requirements.sqlWrapper.ReqWrapper;
079:
080:        public class ExecResultStatDialog extends JDialog implements 
081:                ListSelectionListener, ActionListener, Observer {
082:            PiePlot3D plot;
083:            DefaultPieDataset dataset;
084:            ChartPanel chartPanel;
085:
086:            MyTableModel testResultTableModel;
087:            JTable testResultTable;
088:            TableSorter sorter;
089:            ListSelectionModel rowSM;
090:
091:            JPanel contentPan;
092:            JPanel buttonPan;
093:            JButton detailsButton;
094:            JButton fermerButton;
095:
096:            ReqWrapper currentpReqWrapper;
097:            ExecutionResult currentExecutionResult;
098:            Hashtable reqWrapperList;
099:            Hashtable allReq;
100:            Vector filtredreqCovered;
101:
102:            FiltrePanel pFiltrePanel;
103:            RequirementTree pReqTree;
104:
105:            Vector itemState;
106:
107:            public ExecResultStatDialog(ExecutionResult executionResult,
108:                    RequirementTree _pReqTree) {
109:                super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
110:                pReqTree = _pReqTree;
111:                setTitle("ResExec : " + executionResult.getNameFromModel());
112:                setModal(true);
113:                contentPan = new JPanel(new BorderLayout());
114:                dataset = new DefaultPieDataset();
115:
116:                filtredreqCovered = new Vector();
117:                reqWrapperList = new Hashtable();
118:                allReq = new Hashtable();
119:
120:                JFreeChart chart = ChartFactory.createPieChart3D(
121:                //Language.getInstance().getText("Exigence_couverte"),  // chart title
122:                        Language.getInstance().getText("Exigence_Pass"), // chart title
123:                        dataset, // data
124:                        true, // include legend
125:                        true, false);
126:
127:                plot = (PiePlot3D) chart.getPlot();
128:                plot.setStartAngle(290);
129:                plot.setDirection(Rotation.CLOCKWISE);
130:                plot.setForegroundAlpha(0.5f);
131:                plot.setNoDataMessage("No data to display");
132:                chartPanel = new ChartPanel(chart);
133:
134:                testResultTableModel = new MyTableModel();
135:                testResultTable = new JTable();
136:
137:                sorter = new TableSorter(testResultTableModel);
138:                testResultTable.setModel(sorter);
139:                sorter.setTableHeader(testResultTable.getTableHeader());
140:
141:                try {
142:                    //reqTable.setDefaultRenderer(Class.forName( "java.lang.Object" ), new PriorityTableCellRenderer(reqCovered));
143:                    testResultTable.setDefaultRenderer(Class
144:                            .forName("java.lang.Object"),
145:                            new PriorityTableCellRenderer(filtredreqCovered));
146:                } catch (Exception e) {
147:                    e.printStackTrace();
148:                }
149:
150:                /*testResultTableModel.addColumnNameAndColumn(Language.getInstance().getText("Nom"));
151:                testResultTableModel.addColumnNameAndColumn(Language.getInstance().getText("Description"));
152:                testResultTableModel.addColumnNameAndColumn(Language.getInstance().getText("Résultats"));
153:                 */
154:                testResultTableModel.addColumnNameAndColumn("id");
155:                testResultTableModel.addColumnNameAndColumn(Language
156:                        .getInstance().getText("Nom"));
157:                testResultTableModel.addColumnNameAndColumn(Language
158:                        .getInstance().getText("Categorie"));
159:                testResultTableModel.addColumnNameAndColumn(Language
160:                        .getInstance().getText("Complexite"));
161:                testResultTableModel.addColumnNameAndColumn(Language
162:                        .getInstance().getText("Etat"));
163:
164:                TableColumn stateColumn = testResultTable.getColumnModel()
165:                        .getColumn(4);
166:                itemState = new Vector();
167:                itemState.add(Language.getInstance()
168:                        .getText("State_A_Analyser"));
169:                itemState.add(Language.getInstance().getText("State_Analysee"));
170:                itemState
171:                        .add(Language.getInstance().getText("State_Approuvee"));
172:                itemState.add(Language.getInstance().getText("State_Verifiee"));
173:                itemState
174:                        .add(Language.getInstance().getText("State_Finalisee"));
175:                itemState.add(Language.getInstance().getText("State_Reportee"));
176:                itemState.add(Language.getInstance()
177:                        .getText("State_Abandonnee"));
178:
179:                //JComboBox stateBox = new JComboBox(itemState);
180:                //stateColumn.setCellEditor(new DefaultCellEditor(stateBox));
181:
182:                stateColumn.setCellEditor(new MyComboBoxEditor(itemState));
183:
184:                // If the cell should appear like a combobox in its
185:                // non-editing state, also set the combobox renderer
186:                stateColumn.setCellRenderer(new MyComboBoxRenderer(itemState));
187:
188:                testResultTableModel.addColumnNameAndColumn(Language
189:                        .getInstance().getText("Résultats"));
190:
191:                rowSM = testResultTable.getSelectionModel();
192:                rowSM.addListSelectionListener(this );
193:                testResultTable
194:                        .setPreferredScrollableViewportSize(new Dimension(600,
195:                                200));
196:                testResultTable
197:                        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
198:                JScrollPane tablePane = new JScrollPane(testResultTable);
199:                tablePane.setBorder(BorderFactory.createRaisedBevelBorder());
200:
201:                detailsButton = new JButton(Language.getInstance().getText(
202:                        "Détails"));
203:                detailsButton.setEnabled(true); //false
204:                detailsButton.addActionListener(this );
205:
206:                fermerButton = new JButton(Language.getInstance().getText(
207:                        "Fermer"));
208:                fermerButton.setEnabled(true); //false
209:                fermerButton.addActionListener(this );
210:
211:                buttonPan = new JPanel(new GridLayout(1, 3));
212:                pFiltrePanel = new FiltrePanel(null, this );
213:
214:                buttonPan.add(detailsButton);
215:                buttonPan.add(pFiltrePanel);
216:                buttonPan.add(fermerButton);
217:
218:                contentPan.add(tablePane, BorderLayout.NORTH);
219:                contentPan.add(buttonPan, BorderLayout.CENTER);
220:                contentPan.add(chartPanel, BorderLayout.SOUTH);
221:                setContentPane(contentPan);
222:
223:                initData(executionResult);
224:                /*pack();
225:                setVisible(true);
226:                 */
227:                centerScreen();
228:            }
229:
230:            void centerScreen() {
231:                Dimension dim = getToolkit().getScreenSize();
232:                this .pack();
233:                Rectangle abounds = getBounds();
234:                setLocation((dim.width - abounds.width) / 2,
235:                        (dim.height - abounds.height) / 2);
236:                this .setVisible(true);
237:                requestFocus();
238:            }
239:
240:            public void actionPerformed(ActionEvent e) {
241:                if (e.getSource().equals(detailsButton)) {
242:                    detailsPerformed(e);
243:                }
244:                if (e.getSource().equals(fermerButton)) {
245:                    fermerPerformed(e);
246:                }
247:
248:            }
249:
250:            void detailsPerformed(ActionEvent e) {
251:                if (currentpReqWrapper != null) {
252:                    showDetail(currentExecutionResult, currentpReqWrapper);
253:                }
254:            }
255:
256:            void fermerPerformed(ActionEvent e) {
257:                dispose();
258:            }
259:
260:            public void initData(ExecutionResult executionResult) {
261:                //Campaign pCamp = DataModel.getCurrentCampaign();
262:                currentExecutionResult = executionResult;
263:                testResultTableModel.clearTable();
264:                reqWrapperList.clear();
265:                //filtredreqCovered.clear();
266:                try {
267:                    Vector reqPass = new Vector();
268:                    Vector reqFail = new Vector();
269:                    Vector reqInco = new Vector();
270:
271:                    reqPass = Requirement.getReqWrapperInExecByStatus(
272:                            executionResult.getIdBdd(), ApiConstants.SUCCESS);
273:                    reqFail = Requirement.getReqWrapperInExecByStatus(
274:                            executionResult.getIdBdd(), ApiConstants.FAIL);
275:                    reqInco = Requirement.getReqWrapperInExecByStatus(
276:                            executionResult.getIdBdd(), ApiConstants.UNKNOWN);
277:                    int sizePass = reqPass.size();
278:                    int sizeFail = reqFail.size();
279:                    int sizeInco = reqInco.size();
280:
281:                    allReq.clear();
282:
283:                    for (int i = 0; i < sizePass; i++) {
284:                        ReqWrapper pReqWrapper = (ReqWrapper) reqPass
285:                                .elementAt(i);
286:                        allReq.put(pReqWrapper, ApiConstants.SUCCESS);
287:
288:                    }
289:                    for (int i = 0; i < sizeInco; i++) {
290:                        ReqWrapper pReqWrapper = (ReqWrapper) reqInco
291:                                .elementAt(i);
292:                        allReq.put(pReqWrapper, ApiConstants.UNKNOWN);
293:
294:                    }
295:                    for (int i = 0; i < sizeFail; i++) {
296:                        ReqWrapper pReqWrapper = (ReqWrapper) reqFail
297:                                .elementAt(i);
298:                        allReq.put(pReqWrapper, ApiConstants.FAIL);
299:                    }
300:                    Enumeration enumReq = allReq.keys();
301:                    int nbFail = 0;
302:                    int nbPass = 0;
303:                    int nbInco = 0;
304:                    int filtre = pFiltrePanel.getFiltre();
305:                    filtredreqCovered.clear();
306:                    int ligne = 0;
307:                    while (enumReq.hasMoreElements()) {
308:                        ReqWrapper pReqWrapper = (ReqWrapper) enumReq
309:                                .nextElement();
310:                        //reqWrapperList.put(pReqWrapper.getName(),pReqWrapper);
311:                        DefaultMutableTreeNode node = pReqTree
312:                                .findRequirementFromParent(pReqWrapper);
313:                        Requirement pReq = null;
314:                        if (node != null) {
315:                            pReq = (Requirement) node.getUserObject();
316:                        }
317:                        int reqP = pReqWrapper.getPriority();
318:                        if ((reqP & filtre) > 0) {
319:                            ArrayList data = new ArrayList();
320:                            String nom;
321:                            if (pReq != null) {
322:                                nom = pReq.getLongName();
323:                            } else {
324:                                nom = pReqWrapper.getName();
325:                            }
326:                            reqWrapperList.put(nom, pReqWrapper);
327:                            String description = pReqWrapper.getDescription();
328:                            String status = (String) allReq.get(pReqWrapper);
329:                            if (status.equals(ApiConstants.SUCCESS)) {
330:                                nbPass++;
331:                            } else if (status.equals(ApiConstants.FAIL)) {
332:                                nbFail++;
333:                            } else {
334:                                nbInco++;
335:                            }
336:                            data.add("" + pReq.getIdBdd());
337:                            data.add(nom);
338:                            data.add(ReqWrapper.getCatString(((ReqLeaf) pReq)
339:                                    .getCatFromModel()));
340:                            data.add(ReqWrapper
341:                                    .getComplexString(((ReqLeaf) pReq)
342:                                            .getComplexeFromModel()));
343:                            data.add(ReqWrapper.getStateString(((ReqLeaf) pReq)
344:                                    .getStateFromModel()));
345:                            data.add(Tools.getActionStatusIcon(status));
346:
347:                            //data.add(nom);
348:                            //data.add(description);
349:                            //data.add(Tools.getActionStatusIcon(status));
350:
351:                            /*
352:                            testResultTableModel.addValueAt(data.get(0), ligne, 0 );
353:                            testResultTableModel.addValueAt(data.get(1), ligne, 1 );
354:                            testResultTableModel.addValueAt(data.get(2), ligne, 2 );
355:                            testResultTableModel.addValueAt(data.get(3), ligne, 3 );
356:                            //testResultTableModel.addValueAt(data.get(4), ligne, 4 );
357:                            testResultTableModel.addValueAt(data.get(5), ligne, 5 );
358:                            ligne++;
359:                             */
360:                            testResultTableModel.addRow(data);
361:                            filtredreqCovered.add(pReqWrapper);
362:                        }
363:                    }
364:                    updateChart(nbFail, nbPass, nbInco);
365:
366:                } catch (Exception e) {
367:                    e.printStackTrace();
368:                }
369:            }
370:
371:            void updateTableAndChart(int filtre) {
372:                int nbFail = 0;
373:                int nbPass = 0;
374:                int nbInco = 0;
375:                testResultTableModel.clearTable();
376:                filtredreqCovered.clear();
377:                currentpReqWrapper = null;
378:                Enumeration enumReq = reqWrapperList.elements();
379:                int ligne = 0;
380:                while (enumReq.hasMoreElements()) {
381:                    ReqWrapper pReqWrapper = (ReqWrapper) enumReq.nextElement();
382:                    DefaultMutableTreeNode node = pReqTree
383:                            .findRequirementFromParent(pReqWrapper);
384:                    Requirement pReq = null;
385:                    if (node != null) {
386:                        pReq = (Requirement) node.getUserObject();
387:                    }
388:                    int reqP = pReqWrapper.getPriority();
389:                    if ((reqP & filtre) > 0) {
390:                        ArrayList data = new ArrayList();
391:                        String nom;
392:                        if (pReq != null) {
393:                            nom = pReq.getLongName();
394:                        } else {
395:                            nom = pReqWrapper.getName();
396:                        }
397:                        String description = pReqWrapper.getDescription();
398:                        String status = (String) allReq.get(pReqWrapper);
399:                        if (status.equals(ApiConstants.SUCCESS)) {
400:                            nbPass++;
401:                        } else if (status.equals(ApiConstants.FAIL)) {
402:                            nbFail++;
403:                        } else {
404:                            nbInco++;
405:                        }
406:                        //data.add(nom);
407:                        //data.add(description);
408:                        //data.add(Tools.getActionStatusIcon(status));
409:
410:                        data.add("" + pReq.getIdBdd());
411:                        data.add(nom);
412:                        data.add(ReqWrapper.getCatString(((ReqLeaf) pReq)
413:                                .getCatFromModel()));
414:                        data.add(ReqWrapper.getComplexString(((ReqLeaf) pReq)
415:                                .getComplexeFromModel()));
416:                        data.add(ReqWrapper.getStateString(((ReqLeaf) pReq)
417:                                .getStateFromModel()));
418:                        data.add(Tools.getActionStatusIcon(status));
419:
420:                        /*testResultTableModel.addValueAt(data.get(0), ligne, 0 );
421:                        testResultTableModel.addValueAt(data.get(1), ligne, 1 );
422:                        testResultTableModel.addValueAt(data.get(2), ligne, 2 );
423:                        testResultTableModel.addValueAt(data.get(3), ligne, 3 );
424:                        testResultTableModel.addValueAt(data.get(4), ligne, 4 );
425:                        testResultTableModel.addValueAt(data.get(5), ligne, 5 );
426:                        ligne++;*/
427:
428:                        testResultTableModel.addRow(data);
429:
430:                        filtredreqCovered.add(pReqWrapper);
431:                    }
432:                }
433:                setColumnSize(testResultTable);
434:                updateChart(nbFail, nbPass, nbInco);
435:            }
436:
437:            void updateChart(int nbFail, int nbPass, int nbInco) {
438:
439:                int nbReqTotal = nbFail + nbPass + nbInco;
440:
441:                dataset = new DefaultPieDataset();
442:                if (nbReqTotal > 0) {
443:                    Double percentPass = new Double((nbPass * 100) / nbReqTotal);
444:                    Double percentFail = new Double((nbFail * 100) / nbReqTotal);
445:                    Double percentInco = new Double((nbInco * 100) / nbReqTotal);
446:                    dataset.setValue(Language.getInstance().getText(
447:                            "Exigence_Fail"), percentFail);
448:                    dataset.setValue(Language.getInstance().getText(
449:                            "Exigence_Inco"), percentInco);
450:                    dataset.setValue(Language.getInstance().getText(
451:                            "Exigence_Pass"), percentPass);
452:                }
453:                plot.setDataset(dataset);
454:            }
455:
456:            public void valueChanged(ListSelectionEvent e) {
457:                if (e.getValueIsAdjusting())
458:                    return;
459:
460:                int selectedRowIndex = testResultTable.getSelectedRow();
461:
462:                if (selectedRowIndex != -1
463:                        && testResultTableModel.getRowCount() > 0) {
464:                    String reqNam = (String) sorter.getValueAt(
465:                            selectedRowIndex, 1);
466:                    currentpReqWrapper = (ReqWrapper) reqWrapperList
467:                            .get(reqNam);
468:                    //System.out.println("[ResultPanel] req selected is " + currentpReqWrapper);
469:                }
470:            }
471:
472:            void showDetail(ExecutionResult pCurrentEcutionResult,
473:                    ReqWrapper pReqWrapper) {
474:                ExecutionResult pExecutionResult = new ExecutionResult(
475:                        pCurrentEcutionResult.getNameFromModel(),
476:                        pCurrentEcutionResult.getDescriptionFromModel(),
477:                        DataModel.getObservedExecution());
478:
479:                //pExecutionResult.addTestResultStatusInModel();
480:                try {
481:                    Vector testWraCover = Requirement
482:                            .getTestWrapperCoveredFromDB(pReqWrapper.getIdBDD());
483:                    Vector testCover = new Vector();
484:                    int size = testWraCover.size();
485:
486:                    for (int i = 0; i < size; i++) {
487:                        TestWrapper pTestWrapper = (TestWrapper) testWraCover
488:                                .elementAt(i);
489:                        Test pTest = DataModel.getCurrentProject()
490:                                .getTestFromModel(pTestWrapper.getIdBDD());
491:                        if (pTest == null && !ReqPlugin.isGlobalProject()) {
492:                            if (ReqPlugin.getProjectRef().getIdBdd() == DataModel
493:                                    .getCurrentProject().getIdBdd()) {
494:                                DataModel.reloadFromBase(true);
495:                                pTest = DataModel.getCurrentProject()
496:                                        .getTestFromModel(
497:                                                pTestWrapper.getIdBDD());
498:                                if (pTest == null) {
499:                                    //Hum Data corruption !!!
500:                                    Tools
501:                                            .ihmExceptionView(new Exception(
502:                                                    "Hum ??, it seem that data integrity are corrupted"));
503:                                }
504:                            }
505:                        }
506:                        if (pTest != null) {
507:                            testCover.add(pTest);
508:                        }
509:                    }
510:                    int nbTestCover = testCover.size();
511:                    int order = 0;
512:                    for (int i = 0; i < nbTestCover; i++) {
513:                        Test pTest = (Test) testCover.elementAt(i);
514:                        ExecutionTestResult pExecutionTestResult = pCurrentEcutionResult
515:                                .getExecutionTestResultFromModel(pTest);
516:                        if (pExecutionTestResult != null) {
517:                            pExecutionResult.setTestExecutionTestResultInModel(
518:                                    pTest, pExecutionTestResult, order);
519:                            order++;
520:                        } else {
521:                            /* le test ne fait pas partie de la campagne */
522:                        }
523:                    }
524:                    new ExecutionResultView(pCurrentEcutionResult
525:                            .getNameFromModel(), pExecutionResult);
526:                    //this.setVisible(true);
527:                } catch (Exception e) {
528:                    e.printStackTrace();
529:                }
530:            }
531:
532:            Vector filtredVectorOfReqWrapper(int filtre,
533:                    Vector vectorOfReqWrapper) {
534:                Vector filtredVector = new Vector();
535:                int size = vectorOfReqWrapper.size();
536:                for (int i = 0; i < size; i++) {
537:                    ReqWrapper pReq = (ReqWrapper) vectorOfReqWrapper
538:                            .elementAt(i);
539:                    int reqP = pReq.getPriority();
540:                    if ((reqP & filtre) > 0) {
541:                        filtredVector.add(pReq);
542:                    }
543:
544:                }
545:                return filtredVector;
546:            }
547:
548:            int filtredSizeVectorOfReqWrapper(int filtre,
549:                    Vector vectorOfReqWrapper) {
550:                int filtredVectorSize = 0;
551:                int size = vectorOfReqWrapper.size();
552:                for (int i = 0; i < size; i++) {
553:                    ReqWrapper pReq = (ReqWrapper) vectorOfReqWrapper
554:                            .elementAt(i);
555:                    int reqP = pReq.getPriority();
556:                    if ((reqP & filtre) > 0) {
557:                        filtredVectorSize++;
558:                    }
559:
560:                }
561:                return filtredVectorSize;
562:            }
563:
564:            public void update(Observable o, Object arg) {
565:                if (arg instanceof  ReqEvent) {
566:                    ReqEvent event = (ReqEvent) arg;
567:                    if (event.code == ReqEvent.FILTRE_REQ_CHANGE) {
568:                        int filtre = pFiltrePanel.getFiltre();
569:                        updateTableAndChart(filtre);
570:                    }
571:                }
572:            }
573:
574:            /**
575:             * redefine size of table columns
576:             */
577:            public void setColumnSize(JTable table) {
578:                FontMetrics fm = table.getFontMetrics(table.getFont());
579:                for (int i = 0; i < table.getColumnCount(); i++) {
580:                    int max = 0;
581:                    for (int j = 0; j < table.getRowCount(); j++) {
582:                        int taille = fm.stringWidth((String) table.getValueAt(
583:                                j, i));
584:                        if (taille > max)
585:                            max = taille;
586:                    }
587:                    String nom = (String) table.getColumnModel().getColumn(i)
588:                            .getIdentifier();
589:                    int taille = fm.stringWidth(nom);
590:                    if (taille > max)
591:                        max = taille;
592:                    table.getColumnModel().getColumn(i).setPreferredWidth(
593:                            max + 10);
594:                }
595:            }
596:
597:            public class MyComboBoxRenderer extends JComboBox implements 
598:                    TableCellRenderer {
599:                public MyComboBoxRenderer(Vector items) {
600:                    super (items);
601:                }
602:
603:                public Component getTableCellRendererComponent(JTable table,
604:                        Object value, boolean isSelected, boolean hasFocus,
605:                        int row, int column) {
606:                    if (isSelected) {
607:                        setForeground(table.getSelectionForeground());
608:                        super .setBackground(table.getSelectionBackground());
609:                    } else {
610:                        setForeground(table.getForeground());
611:                        setBackground(table.getBackground());
612:                    }
613:
614:                    // Select the current value
615:                    //setSelectedItem(value);
616:                    setSelectedIndex(0);
617:                    return this ;
618:                }
619:            }
620:
621:            public class MyComboBoxEditor extends DefaultCellEditor {
622:                public MyComboBoxEditor(Vector items) {
623:                    super (new JComboBox(items));
624:                }
625:            }
626:
627:            //////////////////////////////////////////////////
628:
629:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.