Source Code Cross Referenced for RequirementDescriptionPanel.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) 


0001:        /*
0002:         * SalomeTMF is a Test Management Framework
0003:         * Copyright (C) 2005 France Telecom R&D
0004:         *
0005:         * This library is free software; you can redistribute it and/or
0006:         * modify it under the terms of the GNU Lesser General Public
0007:         * License as published by the Free Software Foundation; either
0008:         * version 2 of the License, or (at your option) any later version.
0009:         *
0010:         * This library is distributed in the hope that it will be useful,
0011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013:         * Lesser General Public License for more details.
0014:         *
0015:         * You should have received a copy of the GNU Lesser General Public
0016:         * License along with this library; if not, write to the Free Software
0017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018:         *
0019:         * @author Marche Mikael
0020:         *
0021:         * Contact: mikael.marche@rd.francetelecom.com
0022:         */
0023:
0024:        package salomeTMF_plug.requirements.ihm;
0025:
0026:        import java.awt.BorderLayout;
0027:        import java.awt.Color;
0028:        import java.awt.Dimension;
0029:        import java.awt.FlowLayout;
0030:        import java.awt.FontMetrics;
0031:        import java.awt.GridLayout;
0032:        import java.awt.event.ActionEvent;
0033:        import java.awt.event.ActionListener;
0034:        import java.util.Enumeration;
0035:        import java.util.Hashtable;
0036:        import java.util.Observable;
0037:        import java.util.Observer;
0038:        import java.util.Vector;
0039:
0040:        import javax.swing.BorderFactory;
0041:        import javax.swing.Box;
0042:        import javax.swing.JButton;
0043:        import javax.swing.JComboBox;
0044:        import javax.swing.JLabel;
0045:        import javax.swing.JPanel;
0046:        import javax.swing.JScrollPane;
0047:        import javax.swing.JTabbedPane;
0048:        import javax.swing.JTable;
0049:        import javax.swing.JTextField;
0050:        import javax.swing.ListSelectionModel;
0051:        import javax.swing.event.ListSelectionEvent;
0052:        import javax.swing.event.ListSelectionListener;
0053:        import javax.swing.tree.DefaultMutableTreeNode;
0054:        import javax.swing.tree.TreePath;
0055:
0056:        import org.jfree.chart.ChartFactory;
0057:        import org.jfree.chart.ChartPanel;
0058:        import org.jfree.chart.JFreeChart;
0059:        import org.jfree.chart.plot.PiePlot3D;
0060:        import org.jfree.data.general.DefaultPieDataset;
0061:        import org.jfree.util.Rotation;
0062:        import org.objectweb.salome_tmf.api.ApiConstants;
0063:        import org.objectweb.salome_tmf.data.Campaign;
0064:        import org.objectweb.salome_tmf.data.DataConstants;
0065:        import org.objectweb.salome_tmf.data.Environment;
0066:        import org.objectweb.salome_tmf.data.Execution;
0067:        import org.objectweb.salome_tmf.data.ExecutionResult;
0068:        import org.objectweb.salome_tmf.data.ManualTest;
0069:        import org.objectweb.salome_tmf.data.Test;
0070:        import org.objectweb.salome_tmf.ihm.languages.Language;
0071:        import org.objectweb.salome_tmf.ihm.main.ActionDetailsView;
0072:        import org.objectweb.salome_tmf.ihm.main.AttachmentView;
0073:        import org.objectweb.salome_tmf.ihm.main.AttachmentViewWindow;
0074:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
0075:        import org.objectweb.salome_tmf.ihm.main.ViewCampaignOfTest;
0076:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
0077:        import org.objectweb.salome_tmf.ihm.main.htmleditor.EkitCore;
0078:        import org.objectweb.salome_tmf.ihm.models.DynamicTree;
0079:        import org.objectweb.salome_tmf.plugins.core.BugTracker;
0080:
0081:        import salomeTMF_plug.requirements.ReqPlugin;
0082:        import salomeTMF_plug.requirements.data.ReqFilter;
0083:        import salomeTMF_plug.requirements.data.ReqLeaf;
0084:        import salomeTMF_plug.requirements.data.Requirement;
0085:        import salomeTMF_plug.requirements.sqlWrapper.ReqWrapper;
0086:
0087:        public class RequirementDescriptionPanel extends JPanel implements 
0088:                Observer, ListSelectionListener, ActionListener {
0089:
0090:            //JTextPane requirementDescription;
0091:            EkitCore pRequirementDescription;
0092:            HistoryPanel pHistoryPanel;
0093:            JPanel requirementIDPanel;
0094:            JPanel requirementInfoPanel;
0095:
0096:            JComboBox priorityBox;
0097:            Vector itemPriority;
0098:
0099:            JComboBox catBox;
0100:            Vector itemCat;
0101:
0102:            JComboBox complexeBox;
0103:            Vector itemComplex;
0104:
0105:            JComboBox stateBox;
0106:            Vector itemState;
0107:
0108:            JTextField versionField;
0109:            //Vector versionList;
0110:            JComboBox origineField;
0111:            Vector origineList;
0112:            JComboBox verifmodeField;
0113:            Vector verifList;
0114:            JComboBox referenceField;
0115:            Vector referenceList;
0116:
0117:            JComboBox comboFiltreChoice;
0118:            JComboBox comboNameChoice;
0119:            JButton changeVersion;
0120:
0121:            JTabbedPane requirementWorkSpace;
0122:            AttachmentView attachment;
0123:            String lastDes;
0124:
0125:            Requirement pRequirement;
0126:            Requirement poldRequirement;
0127:
0128:            //boolean tabChanged = false;
0129:            boolean isPie3D = false;
0130:
0131:            JTable testReqFamilyTable;
0132:            JTable testReqLeafTable;
0133:            JTable satisfactionTable;
0134:
0135:            Vector testCover;
0136:            DynamicTree pDynamicTree;
0137:
0138:            JButton viewTestFamilyReqButton;
0139:            JButton viewCampFamilyReqButton;
0140:            JPanel coverFamilyPanel;
0141:
0142:            JButton viewTestReqLeafButton;
0143:            JButton viewCampReqLeafButton;
0144:            JPanel coverLeafPanel;
0145:
0146:            JPanel details;
0147:
0148:            JButton viewResExecReqButton;
0149:            JButton viewCampButton;
0150:            JPanel statisfactionPanel;
0151:            JLabel coverTestRepresend;
0152:            JLabel satisfaction;
0153:
0154:            ChartPanel chartPanAllCover;
0155:            PiePlot3D plotAllCover;
0156:            DefaultPieDataset datasetAllCover;
0157:
0158:            ChartPanel chartPanFamilyCover;
0159:            PiePlot3D plotFamilyCover;
0160:            DefaultPieDataset datasetFamilyCover;
0161:
0162:            //ChartPanel chartPanSatisCover;
0163:            JTabbedPane defectTabPanel;
0164:
0165:            PiePlot3D plotSatisCover;
0166:            DefaultPieDataset datasetSatisCover;
0167:
0168:            boolean canDoUpdatePrirotity = false;
0169:            boolean canDoUpdateNameChoise = true;
0170:            boolean canDoUpdateState = false;
0171:            boolean canDoUpdateComplexe = false;
0172:            boolean canDoUpdateCat = false;
0173:
0174:            StatRequirement pStatRequirement;
0175:
0176:            /*Vartiable used for computation (refhresh by updateData*/
0177:            Vector satisfactionTableData = new Vector();
0178:            Vector satisfactionTableFiltredData = new Vector();
0179:
0180:            //Vector leafInCurrentFamily;
0181:            //Hashtable coverReqsInCurrentFamily  = new Hashtable();
0182:            FiltrePanel pFiltrePanel;
0183:            RequirementTree pReqTree;
0184:
0185:            public RequirementDescriptionPanel(
0186:                    StatRequirement _pStatRequirement,
0187:                    FiltrePanel _pFiltrePanel, RequirementTree reqTree) {
0188:                super (new BorderLayout());
0189:                pFiltrePanel = _pFiltrePanel;
0190:                pReqTree = reqTree;
0191:                pStatRequirement = _pStatRequirement;
0192:                initComponent();
0193:                add(requirementWorkSpace, BorderLayout.CENTER);
0194:            }
0195:
0196:            void initComponent() {
0197:                testCover = new Vector();
0198:                requirementWorkSpace = new JTabbedPane();
0199:
0200:                attachment = new AttachmentView(null, -1, -1, null,
0201:                        DataConstants.NORMAL_SIZE_FOR_ATTACH, null);
0202:
0203:                details = initDetailPanel();
0204:
0205:                coverLeafPanel = initCoverLeafPanel();
0206:                coverFamilyPanel = initCoverFamilyPanel();
0207:                chartPanAllCover = initChartPanAllCover();
0208:                statisfactionPanel = initSatisfactionReqPanel();
0209:                //requirementWorkSpace.addTab(Language.getInstance().getText("D\u00E9tails"),details) ;
0210:                //requirementWorkSpace.addTab(Language.getInstance().getText("Attachements"), attachment);
0211:                //requirementWorkSpace.addTab(Language.getInstance().getText("Couverture"), coverFamilyPanel);
0212:                requirementWorkSpace.addTab(Language.getInstance().getText(
0213:                        "Couverture"), chartPanAllCover);
0214:            }
0215:
0216:            JPanel initDetailPanel() {
0217:                JPanel jp_details = new JPanel(new BorderLayout());
0218:                itemPriority = new Vector();
0219:                itemPriority.add(Language.getInstance().getText(
0220:                        "Filtre_Exigence_Haute"));
0221:                itemPriority.add(Language.getInstance().getText(
0222:                        "Filtre_Exigence_Moyenne"));
0223:                itemPriority.add(Language.getInstance().getText(
0224:                        "Filtre_Exigence_Faible"));
0225:                itemPriority.add(Language.getInstance().getText(
0226:                        "Filtre_Exigence_Option"));
0227:
0228:                itemCat = new Vector();
0229:                itemCat.add(Language.getInstance().getText("Cat_Fonctionnel"));
0230:                itemCat.add(Language.getInstance().getText(
0231:                        "Cat_Interoperabilite"));
0232:                itemCat.add(Language.getInstance().getText("Cat_Charge"));
0233:                itemCat.add(Language.getInstance().getText("Cat_Performance"));
0234:                itemCat
0235:                        .add(Language.getInstance()
0236:                                .getText("Cat_Disponibilite"));
0237:                itemCat.add(Language.getInstance().getText("Cat_Securite"));
0238:                itemCat.add(Language.getInstance()
0239:                        .getText("Cat_Exploitabilite"));
0240:                itemCat.add(Language.getInstance().getText("Cat_Autre"));
0241:
0242:                itemState = new Vector();
0243:                itemState.add(Language.getInstance()
0244:                        .getText("State_A_Analyser"));
0245:                itemState.add(Language.getInstance().getText("State_Analysee"));
0246:                itemState
0247:                        .add(Language.getInstance().getText("State_Approuvee"));
0248:                itemState.add(Language.getInstance().getText("State_Verifiee"));
0249:                itemState
0250:                        .add(Language.getInstance().getText("State_Finalisee"));
0251:                itemState.add(Language.getInstance().getText("State_Reportee"));
0252:                itemState.add(Language.getInstance()
0253:                        .getText("State_Abandonnee"));
0254:
0255:                itemComplex = new Vector();
0256:                itemComplex.add(Language.getInstance().getText("Com_C0"));
0257:                itemComplex.add(Language.getInstance().getText("Com_C1"));
0258:                itemComplex.add(Language.getInstance().getText("Com_C2"));
0259:                itemComplex.add(Language.getInstance().getText("Com_C3"));
0260:
0261:                requirementIDPanel = new JPanel();
0262:                requirementIDPanel.setLayout(new GridLayout(2, 4));
0263:
0264:                JLabel labelCat = new JLabel(Language.getInstance().getText(
0265:                        "Categorie")
0266:                        + " :");
0267:                catBox = new JComboBox(itemCat);
0268:                catBox.setEditable(false);
0269:                catBox.addActionListener(this );
0270:
0271:                JLabel labelPriority = new JLabel(Language.getInstance()
0272:                        .getText("Priority")
0273:                        + " :");
0274:                priorityBox = new JComboBox(itemPriority);
0275:                priorityBox.setEditable(false);
0276:                priorityBox.addActionListener(this );
0277:
0278:                JLabel labelComplexe = new JLabel(Language.getInstance()
0279:                        .getText("Complexite")
0280:                        + " :");
0281:                complexeBox = new JComboBox(itemComplex);
0282:                complexeBox.setEditable(false);
0283:                complexeBox.addActionListener(this );
0284:
0285:                JLabel labelState = new JLabel(Language.getInstance().getText(
0286:                        "Etat")
0287:                        + " :");
0288:                stateBox = new JComboBox(itemState);
0289:                stateBox.setEditable(false);
0290:                stateBox.addActionListener(this );
0291:
0292:                requirementIDPanel.add(labelCat);
0293:                requirementIDPanel.add(labelPriority);
0294:                requirementIDPanel.add(labelComplexe);
0295:                requirementIDPanel.add(labelState);
0296:                requirementIDPanel.add(catBox);
0297:                requirementIDPanel.add(priorityBox);
0298:                requirementIDPanel.add(complexeBox);
0299:                requirementIDPanel.add(stateBox);
0300:                requirementIDPanel.setBorder(BorderFactory.createTitledBorder(
0301:                        BorderFactory.createLineBorder(Color.BLACK), "id : "));
0302:
0303:                //JPanel desc_histoPanel = new JPanel(new BorderLayout());
0304:                JPanel desc_histoPanel = new JPanel(new GridLayout(2, 1));
0305:                /*requirementDescription = new JTextPane();
0306:                requirementDescription.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),"Description"));
0307:                 */
0308:                pRequirementDescription = new EkitCore(pReqTree, true);
0309:                pHistoryPanel = new HistoryPanel();
0310:                //desc_histoPanel.add(requirementDescription, BorderLayout.CENTER);
0311:                desc_histoPanel.add(pRequirementDescription,
0312:                        BorderLayout.CENTER);
0313:                //desc_histoPanel.add(pHistoryPanel, BorderLayout.SOUTH);
0314:                //desc_histoPanel.add(requirementDescription);
0315:                desc_histoPanel.add(pHistoryPanel);
0316:
0317:                requirementInfoPanel = new JPanel();
0318:                requirementInfoPanel.setLayout(new GridLayout(2, 6));
0319:                requirementInfoPanel.setBorder(BorderFactory
0320:                        .createTitledBorder(BorderFactory
0321:                                .createLineBorder(Color.BLACK), "Information"));
0322:
0323:                origineList = new Vector();
0324:                origineList.add(Language.getInstance().getText(
0325:                        "Origine_value_0"));
0326:                origineList.add(Language.getInstance().getText(
0327:                        "Origine_value_1"));
0328:                origineList.add(Language.getInstance().getText(
0329:                        "Origine_value_2"));
0330:                origineList.add(Language.getInstance().getText(
0331:                        "Origine_value_3"));
0332:
0333:                verifList = new Vector();
0334:                verifList.add(Language.getInstance().getText("Verif_value_0"));
0335:                verifList.add(Language.getInstance().getText("Verif_value_1"));
0336:                verifList.add(Language.getInstance().getText("Verif_value_2"));
0337:                verifList.add(Language.getInstance().getText("Verif_value_3"));
0338:
0339:                referenceList = new Vector();
0340:                referenceList.add(Language.getInstance().getText(
0341:                        "Reference_value_0"));
0342:                referenceList.add(Language.getInstance().getText(
0343:                        "Reference_value_1"));
0344:                referenceList.add(Language.getInstance().getText(
0345:                        "Reference_value_2"));
0346:                referenceList.add(Language.getInstance().getText(
0347:                        "Reference_value_3"));
0348:
0349:                JLabel labelOrigine = new JLabel("Origine : ");
0350:                origineField = new JComboBox();
0351:                origineField.setEditable(true);
0352:
0353:                JLabel labelVersion = new JLabel("Version : ");
0354:                versionField = new JTextField();
0355:
0356:                JLabel labelReference = new JLabel(Language.getInstance()
0357:                        .getText("Reference")
0358:                        + " : ");
0359:                referenceField = new JComboBox();
0360:                referenceField.setEditable(true);
0361:
0362:                JLabel labelVerif = new JLabel(Language.getInstance().getText(
0363:                        "Mode_de_verification"));
0364:                verifmodeField = new JComboBox();
0365:                verifmodeField.setEditable(true);
0366:
0367:                changeVersion = new JButton(Language.getInstance().getText(
0368:                        "Valider"));
0369:                changeVersion.addActionListener(this );
0370:
0371:                requirementInfoPanel.add(labelOrigine);
0372:                requirementInfoPanel.add(origineField);
0373:                //requirementInfoPanel.add(Box.createRigidArea(new Dimension(5,5)));
0374:                requirementInfoPanel.add(labelReference);
0375:                requirementInfoPanel.add(referenceField);
0376:                //requirementInfoPanel.add(Box.createRigidArea(new Dimension(5,5)));		
0377:                requirementInfoPanel.add(labelVersion);
0378:                requirementInfoPanel.add(versionField);
0379:
0380:                requirementInfoPanel.add(labelVerif);
0381:                requirementInfoPanel.add(verifmodeField);
0382:                requirementInfoPanel.add(Box
0383:                        .createRigidArea(new Dimension(5, 5)));
0384:                requirementInfoPanel.add(Box
0385:                        .createRigidArea(new Dimension(5, 5)));
0386:                requirementInfoPanel.add(Box
0387:                        .createRigidArea(new Dimension(5, 5)));
0388:                requirementInfoPanel.add(changeVersion);
0389:
0390:                jp_details.add(requirementIDPanel, BorderLayout.NORTH);
0391:                //jp_details.add(requirementDescription,BorderLayout.CENTER);
0392:                jp_details.add(desc_histoPanel, BorderLayout.CENTER);
0393:                jp_details.add(requirementInfoPanel, BorderLayout.SOUTH);
0394:
0395:                /*requirementInfoPanel = new JPanel();
0396:                requirementInfoPanel.setLayout(new GridLayout(1, 6));
0397:                JLabel labelPriority = new JLabel("Priority : ");
0398:                priorityBox = new JComboBox(itemPriority);
0399:                priorityBox.setEditable(false);
0400:                priorityBox.addActionListener(this);
0401:                JLabel labelVersion = new JLabel("Version : ");
0402:                versionField = new JTextField();
0403:                changeVersion = new JButton(Language.getInstance().getText("Valider"));
0404:                changeVersion.addActionListener(this);
0405:                
0406:                requirementInfoPanel.add(labelPriority);
0407:                requirementInfoPanel.add(priorityBox);
0408:                requirementInfoPanel.add(Box.createRigidArea(new Dimension(15,15)));
0409:                requirementInfoPanel.add(labelVersion);
0410:                requirementInfoPanel.add(versionField);
0411:                requirementInfoPanel.add(changeVersion);
0412:                requirementInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),"Information"));
0413:                
0414:                requirementDescription = new JTextPane();
0415:                requirementDescription.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK),"Description"));
0416:                //requirementDescription.addFocusListener(new requirementDescriptionFocusListener());
0417:                
0418:                jp_details.add(requirementInfoPanel,BorderLayout.NORTH);
0419:                jp_details.add(requirementDescription,BorderLayout.CENTER);
0420:                 */
0421:                return jp_details;
0422:            }
0423:
0424:            JPanel initSatisfactionReqPanel() {
0425:                JPanel jp_sat_Req = new JPanel(new GridLayout(2, 1));
0426:
0427:                viewResExecReqButton = new JButton(Language.getInstance()
0428:                        .getText("Visualiser")
0429:                        + " "
0430:                        + Language.getInstance().getText(
0431:                                "Derni\u00E8re_Ex\u00E9cution"));
0432:                viewResExecReqButton.addActionListener(this );
0433:                viewCampButton = new JButton(Language.getInstance().getText(
0434:                        "Visualiser")
0435:                        + " " + Language.getInstance().getText("Campagne"));
0436:                viewCampButton.addActionListener(this );
0437:                /*viewCampFamilyReqButton = new JButton(Language.getInstance().getText("Campagne"));
0438:                viewCampFamilyReqButton.addActionListener(this);
0439:                 */
0440:                JPanel buttonsPanel = new JPanel(new GridLayout(1, 2));
0441:                buttonsPanel.add(viewResExecReqButton);
0442:                buttonsPanel.add(viewCampButton);
0443:                //buttonsPanel.add(viewCampFamilyReqButton);
0444:
0445:                SimpleTableModel model = new SimpleTableModel();
0446:
0447:                satisfactionTable = new JTable(model);
0448:
0449:                model.addColumn(Language.getInstance().getText("Exigence"));
0450:                model.addColumn(Language.getInstance().getText("Test"));
0451:                model.addColumn(Language.getInstance().getText("Campagnes")
0452:                        + "/"
0453:                        + Language.getInstance().getText("Ex\u00E9cutions"));
0454:                model.addColumn(Language.getInstance().getText(
0455:                        "R\u00E9sultats_d'ex\u00E9cution"));
0456:                model.addColumn(Language.getInstance().getText(
0457:                        "Derni\u00E8re_Ex\u00E9cution"));
0458:
0459:                satisfactionTable
0460:                        .setPreferredScrollableViewportSize(new Dimension(600,
0461:                                200));
0462:                satisfactionTable
0463:                        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
0464:                ListSelectionModel rowSM = satisfactionTable
0465:                        .getSelectionModel();
0466:                rowSM.addListSelectionListener(this );
0467:
0468:                JScrollPane tablePane = new JScrollPane(satisfactionTable);
0469:                tablePane.setBorder(BorderFactory.createRaisedBevelBorder());
0470:
0471:                JPanel infoSatisCoverPanel = new JPanel(new BorderLayout());
0472:                JPanel fitrePanel = initFiltreSatisCoverPanel();
0473:                infoSatisCoverPanel.add(fitrePanel, BorderLayout.NORTH);
0474:                infoSatisCoverPanel.add(buttonsPanel, BorderLayout.SOUTH);
0475:                infoSatisCoverPanel.add(tablePane, BorderLayout.CENTER);
0476:                //chartPanSatisCover = initChartPanSatisCover();
0477:
0478:                JPanel defectPanel = new JPanel(new BorderLayout());
0479:                JPanel labelPanel = new JPanel(
0480:                        new FlowLayout(FlowLayout.CENTER));
0481:                JLabel defectLabel = new JLabel(Language.getInstance().getText(
0482:                        "Anomalies"));
0483:                labelPanel.add(defectLabel);
0484:                defectTabPanel = new JTabbedPane();
0485:                defectPanel.add(labelPanel, BorderLayout.NORTH);
0486:                defectPanel.add(defectTabPanel, BorderLayout.CENTER);
0487:
0488:                jp_sat_Req.add(infoSatisCoverPanel);
0489:                //jp_sat_Req.add(chartPanSatisCover);
0490:                jp_sat_Req.add(defectPanel);
0491:
0492:                return jp_sat_Req;
0493:            }
0494:
0495:            JPanel initFiltreSatisCoverPanel() {
0496:
0497:                JPanel filtreSatisCoverPanel = new JPanel(new GridLayout(2, 3));
0498:
0499:                JLabel filtreByLabel = new JLabel(Language.getInstance()
0500:                        .getText("Filtrer_par")
0501:                        + " : ");
0502:                Vector choice = new Vector();
0503:                choice.add(Language.getInstance().getText("Tout"));
0504:                choice.add(Language.getInstance().getText("Campagnes"));
0505:                choice.add(Language.getInstance().getText("Campagnes") + "/"
0506:                        + Language.getInstance().getText("Ex\u00E9cutions"));
0507:                choice.add(Language.getInstance().getText("Environnements"));
0508:                choice.add(Language.getInstance().getText("Campagnes") + "/"
0509:                        + Language.getInstance().getText("Environnements"));
0510:                comboFiltreChoice = new JComboBox(choice);
0511:                comboFiltreChoice.setEditable(false);
0512:                comboFiltreChoice.addActionListener(this );
0513:
0514:                JLabel nameLabel = new JLabel(Language.getInstance().getText(
0515:                        "Nom")
0516:                        + " : ");
0517:
0518:                Vector choice2 = new Vector();
0519:                choice2.add(Language.getInstance().getText("Tout"));
0520:                comboNameChoice = new JComboBox(choice2);
0521:                comboNameChoice.setEditable(false);
0522:                comboNameChoice.addActionListener(this );
0523:
0524:                coverTestRepresend = new JLabel(Language.getInstance().getText(
0525:                        "Test_couvert_represente")
0526:                        + ": 100%");
0527:
0528:                satisfaction = new JLabel(Language.getInstance().getText(
0529:                        "Satisfaction"));
0530:
0531:                filtreSatisCoverPanel.add(filtreByLabel);
0532:                filtreSatisCoverPanel.add(nameLabel);
0533:                filtreSatisCoverPanel.add(coverTestRepresend);
0534:
0535:                filtreSatisCoverPanel.add(comboFiltreChoice);
0536:                filtreSatisCoverPanel.add(comboNameChoice);
0537:                filtreSatisCoverPanel.add(satisfaction);
0538:
0539:                return filtreSatisCoverPanel;
0540:            }
0541:
0542:            JPanel initCoverFamilyPanel() {
0543:                JPanel jp_cover_fam = new JPanel(new GridLayout(2, 1));
0544:
0545:                viewTestFamilyReqButton = new JButton(Language.getInstance()
0546:                        .getText("Visualiser"));
0547:                viewTestFamilyReqButton.addActionListener(this );
0548:                viewCampFamilyReqButton = new JButton(Language.getInstance()
0549:                        .getText("Campagne"));
0550:                viewCampFamilyReqButton.addActionListener(this );
0551:
0552:                JPanel buttonsPanel = new JPanel(new GridLayout(1, 2));
0553:                buttonsPanel.add(viewTestFamilyReqButton);
0554:                buttonsPanel.add(viewCampFamilyReqButton);
0555:
0556:                SimpleTableModel model = new SimpleTableModel();
0557:
0558:                testReqFamilyTable = new JTable(model);
0559:
0560:                model.addColumn(Language.getInstance().getText("Famille"));
0561:                model.addColumn(Language.getInstance().getText("Suite"));
0562:                model.addColumn(Language.getInstance().getText("Test"));
0563:                model.addColumn(Language.getInstance().getText("Exécute"));
0564:
0565:                testReqFamilyTable
0566:                        .setPreferredScrollableViewportSize(new Dimension(600,
0567:                                200));
0568:                testReqFamilyTable
0569:                        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
0570:                //ListSelectionModel rowSM = testTable.getSelectionModel();
0571:                //rowSM.addListSelectionListener(this);
0572:
0573:                JScrollPane tablePane = new JScrollPane(testReqFamilyTable);
0574:                tablePane.setBorder(BorderFactory.createRaisedBevelBorder());
0575:
0576:                JPanel infoTestCoverPanel = new JPanel(new BorderLayout());
0577:                infoTestCoverPanel.add(buttonsPanel, BorderLayout.NORTH);
0578:                infoTestCoverPanel.add(tablePane, BorderLayout.CENTER);
0579:                chartPanFamilyCover = initChartPanFamilyCover();
0580:                jp_cover_fam.add(infoTestCoverPanel);
0581:                jp_cover_fam.add(chartPanFamilyCover);
0582:
0583:                return jp_cover_fam;
0584:            }
0585:
0586:            JPanel initCoverLeafPanel() {
0587:
0588:                viewTestReqLeafButton = new JButton(Language.getInstance()
0589:                        .getText("Visualiser"));
0590:                viewTestReqLeafButton.addActionListener(this );
0591:                viewCampReqLeafButton = new JButton(Language.getInstance()
0592:                        .getText("Campagne"));
0593:                viewCampReqLeafButton.addActionListener(this );
0594:
0595:                JPanel buttonsPanel = new JPanel(new GridLayout(1, 2));
0596:                buttonsPanel.add(viewTestReqLeafButton);
0597:                buttonsPanel.add(viewCampReqLeafButton);
0598:
0599:                SimpleTableModel model = new SimpleTableModel();
0600:
0601:                testReqLeafTable = new JTable(model);
0602:
0603:                model.addColumn(Language.getInstance().getText("Famille"));
0604:                model.addColumn(Language.getInstance().getText("Suite"));
0605:                model.addColumn(Language.getInstance().getText("Test"));
0606:                model.addColumn(Language.getInstance().getText("Exécute"));
0607:
0608:                testReqLeafTable
0609:                        .setPreferredScrollableViewportSize(new Dimension(600,
0610:                                200));
0611:                testReqLeafTable
0612:                        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
0613:                //ListSelectionModel rowSM = testTable.getSelectionModel();
0614:                //rowSM.addListSelectionListener(this);
0615:
0616:                JScrollPane tablePane = new JScrollPane(testReqLeafTable);
0617:                tablePane.setBorder(BorderFactory.createRaisedBevelBorder());
0618:
0619:                JPanel infoTestCoverPanel = new JPanel(new BorderLayout());
0620:                infoTestCoverPanel.add(buttonsPanel, BorderLayout.NORTH);
0621:                infoTestCoverPanel.add(tablePane, BorderLayout.CENTER);
0622:                return infoTestCoverPanel;
0623:            }
0624:
0625:            ChartPanel initChartPanSatisCover() {
0626:                datasetSatisCover = new DefaultPieDataset();
0627:                JFreeChart chart = ChartFactory.createPieChart3D(Language
0628:                        .getInstance().getText("Satisfaction"), // chart title
0629:                        datasetSatisCover, // data
0630:                        true, // include legend
0631:                        true, false);
0632:
0633:                plotSatisCover = (PiePlot3D) chart.getPlot();
0634:                plotSatisCover.setStartAngle(290);
0635:                plotSatisCover.setDirection(Rotation.CLOCKWISE);
0636:                plotSatisCover.setForegroundAlpha(0.5f);
0637:                plotSatisCover.setNoDataMessage("No data to display");
0638:                return new ChartPanel(chart);
0639:
0640:            }
0641:
0642:            ChartPanel initChartPanFamilyCover() {
0643:                datasetFamilyCover = new DefaultPieDataset();
0644:                JFreeChart chart = ChartFactory.createPieChart3D(Language
0645:                        .getInstance().getText("Exigence_couverte"), // chart title
0646:                        datasetFamilyCover, // data
0647:                        true, // include legend
0648:                        true, false);
0649:
0650:                plotFamilyCover = (PiePlot3D) chart.getPlot();
0651:                plotFamilyCover.setStartAngle(290);
0652:                plotFamilyCover.setDirection(Rotation.CLOCKWISE);
0653:                plotFamilyCover.setForegroundAlpha(0.5f);
0654:                plotFamilyCover.setNoDataMessage("No data to display");
0655:                return new ChartPanel(chart);
0656:            }
0657:
0658:            ChartPanel initChartPanAllCover() {
0659:                datasetAllCover = new DefaultPieDataset();
0660:                JFreeChart chart = ChartFactory.createPieChart3D(Language
0661:                        .getInstance().getText("Exigence_couverte"), // chart title
0662:                        datasetAllCover, // data
0663:                        true, // include legend
0664:                        true, false);
0665:
0666:                plotAllCover = (PiePlot3D) chart.getPlot();
0667:                plotAllCover.setStartAngle(290);
0668:                plotAllCover.setDirection(Rotation.CLOCKWISE);
0669:                plotAllCover.setForegroundAlpha(0.5f);
0670:                plotAllCover.setNoDataMessage("No data to display");
0671:                //chartPanAllCover = new ChartPanel(chart);
0672:                return new ChartPanel(chart);
0673:            }
0674:
0675:            void setPie3D(int filtre) {
0676:                if (isPie3D)
0677:                    return;
0678:                isPie3D = true;
0679:                /*requirementWorkSpace.remove(details) ;
0680:                requirementWorkSpace.remove(attachment);
0681:                requirementWorkSpace.remove(coverFamilyPanel);*/
0682:                requirementWorkSpace.removeAll();
0683:                calcStatAllCover(filtre);
0684:                requirementWorkSpace.addTab(Language.getInstance().getText(
0685:                        "Couverture"), chartPanAllCover);
0686:
0687:            }
0688:
0689:            void unsetPie3D(int filtre, Requirement pReq) {
0690:                //if (!isPie3D)
0691:                //return;
0692:                isPie3D = false;
0693:                //requirementWorkSpace.remove(chartPanAllCover);
0694:                int selectedTab = requirementWorkSpace.getSelectedIndex();
0695:                requirementWorkSpace.removeAll();
0696:                requirementWorkSpace.addTab(Language.getInstance().getText(
0697:                        "D\u00E9tails"), details);
0698:                requirementWorkSpace.addTab(Language.getInstance().getText(
0699:                        "Attachements"), attachment);
0700:                if (pReq.isFamilyReq()) {
0701:                    calcStatFamilyCover(filtre);
0702:                    requirementWorkSpace.addTab(Language.getInstance().getText(
0703:                            "Couverture"), coverFamilyPanel);
0704:                } else {
0705:                    requirementWorkSpace.addTab(Language.getInstance().getText(
0706:                            "Couverture"), coverLeafPanel);
0707:                }
0708:                requirementWorkSpace.addTab(Language.getInstance().getText(
0709:                        "Satisfaction"), statisfactionPanel);
0710:                if (selectedTab < requirementWorkSpace.getTabCount()) {
0711:                    requirementWorkSpace.setSelectedIndex(selectedTab);
0712:                }
0713:            }
0714:
0715:            public void update(Observable o, Object arg) {
0716:                //System.out.println("requirementdescription-update : ReqEvent.REQSELECTED");
0717:                if (arg instanceof  ReqEvent) {
0718:                    //System.out.println("requirementdescription-update : ReqEvent.REQSELECTED");
0719:                    ReqEvent event = (ReqEvent) arg;
0720:                    if (event.code == ReqEvent.REQSELECTED) {
0721:                        poldRequirement = pRequirement;
0722:                        pRequirement = (Requirement) event.arg;
0723:                        if (!pRequirement.getNameFromModel().equals(
0724:                                "Requirements_"
0725:                                        + ReqPlugin.getProjectRef()
0726:                                                .getNameFromModel())) {
0727:                            attachment.setAttachmentObject(pRequirement);
0728:                            if (pRequirement.isFamilyReq()) {
0729:                                updateData(pFiltrePanel.getFiltre(),
0730:                                        (SimpleTableModel) testReqFamilyTable
0731:                                                .getModel());
0732:                            } else {
0733:                                updateData(pFiltrePanel.getFiltre(),
0734:                                        (SimpleTableModel) testReqLeafTable
0735:                                                .getModel());
0736:                            }
0737:                            upDateHistory(pRequirement);
0738:                        }
0739:
0740:                        if (!pRequirement.getNameFromModel().equals(
0741:                                "Requirements_"
0742:                                        + ReqPlugin.getProjectRef()
0743:                                                .getNameFromModel())) {
0744:                            //requirementDescription.setText(pRequirement.getDescriptionFromModel());
0745:                            pRequirementDescription.setText(pRequirement
0746:                                    .getDescriptionFromModel());
0747:                        }
0748:
0749:                        if (pRequirement instanceof  ReqLeaf) {
0750:                            requirementInfoPanel.setVisible(true);
0751:                            requirementIDPanel.setBorder(BorderFactory
0752:                                    .createTitledBorder(BorderFactory
0753:                                            .createLineBorder(Color.BLACK),
0754:                                            "id : " + pRequirement.getIdBdd()));
0755:                            requirementIDPanel.setVisible(true);
0756:
0757:                            versionField.setText(((ReqLeaf) pRequirement)
0758:                                    .getVersionFromModel());
0759:                            setInfo(referenceField, referenceList,
0760:                                    ((ReqLeaf) pRequirement)
0761:                                            .getReferenceFromModel());
0762:                            setInfo(origineField, origineList,
0763:                                    ((ReqLeaf) pRequirement)
0764:                                            .getOrigineFromModel());
0765:                            setInfo(verifmodeField, verifList,
0766:                                    ((ReqLeaf) pRequirement)
0767:                                            .getVerifFromModel());
0768:
0769:                            canDoUpdatePrirotity = false;
0770:                            int priority = ((ReqLeaf) pRequirement)
0771:                                    .getPriorityFromModel();
0772:                            if (priority == ReqFilter.P_HIGHT) {
0773:                                priorityBox.setSelectedIndex(0);
0774:                            } else if (priority == ReqFilter.P_MEDIUM) {
0775:                                priorityBox.setSelectedIndex(1);
0776:                            } else if (priority == ReqFilter.P_LOW) {
0777:                                priorityBox.setSelectedIndex(2);
0778:                            } else if (priority == ReqFilter.P_NONE) {
0779:                                priorityBox.setSelectedIndex(3);
0780:                            }
0781:                            canDoUpdatePrirotity = true;
0782:
0783:                            canDoUpdateState = false;
0784:                            int state = ((ReqLeaf) pRequirement)
0785:                                    .getStateFromModel();
0786:                            stateBox.setSelectedIndex(state);
0787:                            canDoUpdateState = true;
0788:
0789:                            canDoUpdateComplexe = false;
0790:                            int complexe = ((ReqLeaf) pRequirement)
0791:                                    .getComplexeFromModel();
0792:                            if (complexe == ReqFilter.C0) {
0793:                                complexeBox.setSelectedIndex(0);
0794:                            } else if (complexe == ReqFilter.C1) {
0795:                                complexeBox.setSelectedIndex(1);
0796:                            } else if (complexe == ReqFilter.C2) {
0797:                                complexeBox.setSelectedIndex(2);
0798:                            } else if (complexe == ReqFilter.C3) {
0799:                                complexeBox.setSelectedIndex(3);
0800:                            }
0801:                            canDoUpdateComplexe = true;
0802:
0803:                            canDoUpdateCat = false;
0804:                            int cat = ((ReqLeaf) pRequirement)
0805:                                    .getCatFromModel();
0806:                            catBox.setSelectedIndex(cat);
0807:                            canDoUpdateCat = true;
0808:
0809:                        } else {
0810:                            requirementInfoPanel.setVisible(false);
0811:                            requirementIDPanel.setVisible(false);
0812:                        }
0813:
0814:                        if (pRequirement.getParent() == null) {
0815:                            setPie3D(pFiltrePanel.getFiltre());
0816:                        } else {
0817:                            unsetPie3D(pFiltrePanel.getFiltre(), pRequirement);
0818:                        }
0819:                    } else if (event.code == ReqEvent.FILTRE_REQ_CHANGE) {
0820:                        if (pRequirement != null
0821:                                && pRequirement.getParent() != null) {
0822:                            calcStatAllCover(pFiltrePanel.getFiltre());
0823:                        }
0824:
0825:                    }
0826:                }
0827:            }
0828:
0829:            void updateData(int filtre, SimpleTableModel pTestTable) {
0830:                int typeSelected = comboFiltreChoice.getSelectedIndex();
0831:                String nameStelected = (String) comboNameChoice
0832:                        .getSelectedItem();
0833:                canDoUpdateNameChoise = false;
0834:                if (typeSelected > 0) {
0835:                    comboNameChoice.removeAllItems();
0836:                    comboNameChoice.addItem(Language.getInstance().getText(
0837:                            "Tout"));
0838:                }
0839:
0840:                pTestTable.clearTable();
0841:                SimpleTableModel satisfactionTableModel = (SimpleTableModel) satisfactionTable
0842:                        .getModel();
0843:                satisfactionTableModel.clearTable();
0844:                satisfactionTableData.clear();
0845:                satisfactionTableFiltredData.clear();
0846:
0847:                Hashtable executedStatCovredByCurrentReq = pStatRequirement
0848:                        .getEexecutedStatCovredByCurrentReq();
0849:                Enumeration enumCovredTest = pStatRequirement
0850:                        .getAllTestCovredByCurrentReq().elements();
0851:                testCover.clear();
0852:                int i = 0;
0853:                int j = 0;
0854:                int nbLastPass = 0;
0855:                Vector listTest = new Vector();
0856:                while (enumCovredTest.hasMoreElements()) {
0857:                    Test pTest = (Test) enumCovredTest.nextElement();
0858:                    Vector data = new Vector();
0859:                    testCover.add(pTest);
0860:                    String famName = pTest.getTestListFromModel()
0861:                            .getFamilyFromModel().getNameFromModel();
0862:                    String suiteName = pTest.getTestListFromModel()
0863:                            .getNameFromModel();
0864:                    String testName = pTest.getNameFromModel();
0865:                    data.add(famName);
0866:                    data.add(pTest.getTestListFromModel().getNameFromModel());
0867:                    data.add(testName);
0868:                    boolean executed = false;
0869:                    Vector statExec = (Vector) executedStatCovredByCurrentReq
0870:                            .get(pTest);
0871:                    if (statExec != null) {
0872:                        //statExec = Vector[campain, Execution, {ExecResult}, nbP, nbF, nbU, lastExecRusult, lastResult]
0873:                        executed = true;
0874:                        int size = statExec.size();
0875:                        for (int k = 0; k < size; k++) {
0876:                            Vector statExecLine = (Vector) statExec
0877:                                    .elementAt(k);
0878:                            Vector data2 = new Vector();
0879:                            String str_listOfReq = "";
0880:                            Hashtable hashTestReq = pStatRequirement
0881:                                    .getAllReqCovredByTest();
0882:                            Vector listOfReq = (Vector) hashTestReq
0883:                                    .get(new Integer(pTest.getIdBdd()));
0884:                            if (listOfReq != null && listOfReq.size() > 0) {
0885:                                str_listOfReq = ((Requirement) listOfReq
0886:                                        .elementAt(0)).getNameFromModel();
0887:                                for (int l = 1; l < listOfReq.size(); l++) {
0888:                                    str_listOfReq += ", "
0889:                                            + ((Requirement) listOfReq
0890:                                                    .elementAt(l))
0891:                                                    .getNameFromModel();
0892:                                }
0893:                            }
0894:                            data2.add(str_listOfReq);
0895:                            data2.add(testName + " (" + famName + "/"
0896:                                    + suiteName + ")");
0897:                            if (!listTest.contains(pTest)) {
0898:                                listTest.add(pTest);
0899:                            }
0900:                            Campaign pCamp = (Campaign) statExecLine
0901:                                    .elementAt(0);
0902:                            Execution pExec = (Execution) statExecLine
0903:                                    .elementAt(1);
0904:                            int nbPass = ((Integer) statExecLine.elementAt(3))
0905:                                    .intValue();
0906:                            int nbFail = ((Integer) statExecLine.elementAt(4))
0907:                                    .intValue();
0908:                            int nbUnknow = ((Integer) statExecLine.elementAt(5))
0909:                                    .intValue();
0910:                            String lastResult = (String) statExecLine
0911:                                    .elementAt(7);
0912:                            data2.add(pCamp.getNameFromModel() + "/"
0913:                                    + pExec.getNameFromModel());
0914:                            data2.add("" + nbPass + "P, " + nbFail + "F, "
0915:                                    + nbUnknow + "I");
0916:                            data2.add(lastResult);
0917:                            if (lastResult.equals(ApiConstants.SUCCESS)) {
0918:                                nbLastPass++;
0919:                            }
0920:                            satisfactionTableModel.insertRow(j, data2);
0921:                            satisfactionTableData.add(j, statExecLine);
0922:                            satisfactionTableFiltredData.add(j, statExecLine);
0923:                            j++;
0924:                            //Set campagne, exec, env Filtres //remplir des hashtables
0925:                        }
0926:                    }
0927:                    //boolean executed = pStatRequirement.isCovredTestIsExecuted(pTest);
0928:                    data.add("" + executed);
0929:                    pTestTable.insertRow(i, data);
0930:                    i++;
0931:                }
0932:                float pourcentSat = 0;
0933:                if (j != 0) {
0934:                    pourcentSat = nbLastPass * 100 / j;
0935:                }
0936:                //satisfaction.setText(Language.getInstance().getText("Satisfaction") + " : " + pourcentSat +"%");
0937:
0938:                int nbTest = pStatRequirement.getAllTestCovredByCurrentReq()
0939:                        .size();
0940:                int nbTest2 = pStatRequirement
0941:                        .getEexecutedStatCovredByCurrentReq().size();
0942:                float pourcentTest = 0;
0943:                float pourcentTest2 = 0;
0944:                if (nbTest != 0) {
0945:                    pourcentTest = listTest.size() * 100 / nbTest;
0946:                }
0947:                if (nbTest2 != 0) {
0948:                    pourcentTest2 = listTest.size() * 100 / nbTest2;
0949:                }
0950:                coverTestRepresend.setText(Language.getInstance().getText(
0951:                        "Test_couvert_represente")
0952:                        + ": " + pourcentTest + "%");
0953:                satisfaction.setText(Language.getInstance().getText(
0954:                        "Satisfaction")
0955:                        + " : "
0956:                        + pourcentSat
0957:                        + "% / "
0958:                        + pourcentTest2
0959:                        + "% "
0960:                        + Language.getInstance().getText("Exécute"));
0961:                canDoUpdateNameChoise = true;
0962:                if (typeSelected > 0) {
0963:                    changeFiltreChoicePerformed(null);
0964:                    int nbName = comboNameChoice.getItemCount();
0965:                    if (nbName > 0) {
0966:                        int index = 0;
0967:                        boolean trouve = false;
0968:                        while (index < nbName && !trouve) {
0969:                            String tempName = (String) comboNameChoice
0970:                                    .getItemAt(index);
0971:                            if (tempName.equals(nameStelected)) {
0972:                                trouve = true;
0973:                                comboNameChoice.setSelectedIndex(index);
0974:                            }
0975:                            index++;
0976:                        }
0977:                    }
0978:                }
0979:
0980:                Vector allTrackers = SalomeTMFContext.getInstance()
0981:                        .getBugTracker();
0982:                defectTabPanel.removeAll();
0983:                int size = allTrackers.size();
0984:                for (int k = 0; k < size; k++) {
0985:                    BugTracker pBugTracker = (BugTracker) allTrackers
0986:                            .elementAt(k);
0987:                    JPanel pJPanel = pBugTracker
0988:                            .getDefectPanelForTests(listTest);
0989:                    if (pJPanel != null) {
0990:                        defectTabPanel.addTab(pBugTracker.getBugTrackerName(),
0991:                                pJPanel);
0992:                    }
0993:                }
0994:                setColumnSize(testReqFamilyTable);
0995:                setColumnSize(testReqLeafTable);
0996:                setColumnSize(satisfactionTable);
0997:            }
0998:
0999:            void upDateHistory(Requirement pReq) {
1000:                pHistoryPanel.updateData(pReq, false);
1001:            }
1002:
1003:            void calcStatFamilyCover(int filtre) {
1004:                try {
1005:
1006:                    int nbTotalReq = 0;
1007:                    int nbCoveredReq = 0;
1008:                    if (filtre > 0) {
1009:                        //nbTotalReq = leafInCurrentFamily.size();
1010:                        nbTotalReq = pStatRequirement.getLeafInCurrentFamily()
1011:                                .size();
1012:                        //int nbTotalReq2 = 0;
1013:                        for (int i = 0; i < nbTotalReq; i++) {
1014:                            //ReqLeaf pReqLeaf = (ReqLeaf) leafInCurrentFamily.elementAt(i);
1015:                            ReqLeaf pReqLeaf = (ReqLeaf) pStatRequirement
1016:                                    .getLeafInCurrentFamily().elementAt(i);
1017:
1018:                            //int reqP = pReqLeaf.getPriorityFromModel();
1019:                            //if ((reqP & filtre) > 0){
1020:                            //nbTotalReq2++;
1021:                            /*if (coverReqsInCurrentFamily.get(new Integer(pReqLeaf.getIdBdd())) != null){
1022:                             nbCoveredReq++;
1023:                             }*/
1024:                            if (pStatRequirement.getAllTestCovredByReq().get(
1025:                                    new Integer(pReqLeaf.getIdBdd())) != null) {
1026:                                nbCoveredReq++;
1027:                            }
1028:                            //}
1029:
1030:                        }
1031:                        //nbTotalReq = nbTotalReq2;
1032:
1033:                    }
1034:
1035:                    //int nbTotalReq = Requirement.getReqWrapperLeafInCurrentProject().size();
1036:                    //int nbCoveredReq =  Requirement.getReqWrapperCovered().size(); 
1037:                    if (nbTotalReq > 0) {
1038:                        Double nbCovered = new Double((nbCoveredReq * 100)
1039:                                / nbTotalReq);
1040:                        Double nbNotCovered = new Double(100
1041:                                - (nbCoveredReq * 100) / nbTotalReq);
1042:                        datasetFamilyCover
1043:                                .setValue(Language.getInstance().getText(
1044:                                        "Exigence_non_couverte"), nbNotCovered);
1045:                        datasetFamilyCover.setValue(Language.getInstance()
1046:                                .getText("Exigence_couverte"), nbCovered);
1047:                        plotFamilyCover.setDataset(datasetFamilyCover);
1048:                    }
1049:
1050:                } catch (Exception e) {
1051:
1052:                }
1053:            }
1054:
1055:            void initCalcStatAllCover(int filtre) {
1056:                try {
1057:                    int nbTotalReq = 1;
1058:                    int nbCoveredReq = 0;
1059:                    if (filtre > 0) {
1060:                        Vector leafInCurrentProject = Requirement
1061:                                .getReqWrapperLeafInCurrentProject();
1062:                        nbTotalReq = leafInCurrentProject.size();
1063:
1064:                        Vector reqWrapperCovered = Requirement
1065:                                .getReqWrapperCovered();
1066:                        nbCoveredReq = reqWrapperCovered.size();
1067:                        if (filtre != 111) {
1068:                            int nbTotalReq2 = 0;
1069:                            for (int i = 0; i < nbTotalReq; i++) {
1070:                                int reqP = ((ReqWrapper) leafInCurrentProject
1071:                                        .elementAt(i)).getPriority();
1072:                                if ((reqP & filtre) > 0) {
1073:                                    nbTotalReq2++;
1074:                                }
1075:                            }
1076:                            int nbCoveredReq2 = 0;
1077:                            for (int i = 0; i < nbCoveredReq; i++) {
1078:                                int reqP = ((ReqWrapper) reqWrapperCovered
1079:                                        .elementAt(i)).getPriority();
1080:                                if ((reqP & filtre) > 0) {
1081:                                    nbCoveredReq2++;
1082:                                }
1083:                            }
1084:                            nbTotalReq = nbTotalReq2;
1085:                            nbCoveredReq = nbCoveredReq2;
1086:                        }
1087:                    }
1088:
1089:                    if (nbTotalReq > 0) {
1090:                        Double nbCovered = new Double((nbCoveredReq * 100)
1091:                                / nbTotalReq);
1092:                        Double nbNotCovered = new Double(100
1093:                                - (nbCoveredReq * 100) / nbTotalReq);
1094:                        datasetAllCover
1095:                                .setValue(Language.getInstance().getText(
1096:                                        "Exigence_non_couverte"), nbNotCovered);
1097:                        datasetAllCover.setValue(Language.getInstance()
1098:                                .getText("Exigence_couverte"), nbCovered);
1099:                        plotAllCover.setDataset(datasetAllCover);
1100:                    }
1101:
1102:                } catch (Exception e) {
1103:
1104:                }
1105:            }
1106:
1107:            void calcStatAllCover(int filtre) {
1108:                try {
1109:                    /*int nbTotalReq = 1;
1110:                    int nbCoveredReq = 0;
1111:                    if (filtre> 0){
1112:                    	Vector leafInCurrentProject = Requirement.getReqWrapperLeafInCurrentProject();
1113:                    	nbTotalReq = leafInCurrentProject.size();
1114:                    	
1115:                    	Vector reqWrapperCovered =  Requirement.getReqWrapperCovered(); 
1116:                    	nbCoveredReq = reqWrapperCovered.size();
1117:                    	if (filtre != 111){
1118:                    		int nbTotalReq2 = 0;
1119:                    		for (int i = 0 ; i < nbTotalReq; i++){
1120:                    			int reqP = ((ReqWrapper) leafInCurrentProject.elementAt(i)).getPriority();
1121:                    			if ((reqP & filtre) > 0){
1122:                    				nbTotalReq2++;
1123:                    			}
1124:                    		}
1125:                    		int nbCoveredReq2 = 0;
1126:                    		for (int i = 0 ; i < nbCoveredReq; i++){
1127:                    			int reqP = ((ReqWrapper) reqWrapperCovered.elementAt(i)).getPriority();
1128:                    			if ((reqP & filtre) > 0){
1129:                    				nbCoveredReq2++;
1130:                    			}
1131:                    		}
1132:                    		nbTotalReq = nbTotalReq2;
1133:                    		nbCoveredReq = nbCoveredReq2;
1134:                    	}
1135:                    }*/
1136:
1137:                    int nbTotalReq = 1;
1138:                    int nbCoveredReq = 0;
1139:                    if (filtre > 0) {
1140:                        //nbTotalReq = leafInCurrentFamily.size();
1141:                        nbTotalReq = pStatRequirement.getLeafInCurrentFamily()
1142:                                .size();
1143:                        //int nbTotalReq2 = 0;
1144:                        for (int i = 0; i < nbTotalReq; i++) {
1145:                            //ReqLeaf pReqLeaf = (ReqLeaf) leafInCurrentFamily.elementAt(i);
1146:                            ReqLeaf pReqLeaf = (ReqLeaf) pStatRequirement
1147:                                    .getLeafInCurrentFamily().elementAt(i);
1148:
1149:                            //int reqP = pReqLeaf.getPriorityFromModel();
1150:                            //if ((reqP & filtre) > 0){
1151:                            //nbTotalReq2++;
1152:                            /*if (coverReqsInCurrentFamily.get(new Integer(pReqLeaf.getIdBdd())) != null){
1153:                             nbCoveredReq++;
1154:                             }*/
1155:                            if (pStatRequirement.getAllTestCovredByReq().get(
1156:                                    new Integer(pReqLeaf.getIdBdd())) != null) {
1157:                                nbCoveredReq++;
1158:                            }
1159:                            //}
1160:
1161:                        }
1162:                        //nbTotalReq = nbTotalReq2;
1163:
1164:                    }
1165:
1166:                    if (nbTotalReq > 0) {
1167:                        Double nbCovered = new Double((nbCoveredReq * 100)
1168:                                / nbTotalReq);
1169:                        Double nbNotCovered = new Double(100
1170:                                - (nbCoveredReq * 100) / nbTotalReq);
1171:                        datasetAllCover
1172:                                .setValue(Language.getInstance().getText(
1173:                                        "Exigence_non_couverte"), nbNotCovered);
1174:                        datasetAllCover.setValue(Language.getInstance()
1175:                                .getText("Exigence_couverte"), nbCovered);
1176:                        plotAllCover.setDataset(datasetAllCover);
1177:                    }
1178:
1179:                } catch (Exception e) {
1180:
1181:                }
1182:            }
1183:
1184:            void setRequirement(Requirement pRequirement) {
1185:                poldRequirement = this .pRequirement;
1186:                this .pRequirement = pRequirement;
1187:                if (!pRequirement.getNameFromModel().equals(
1188:                        "Requirements_"
1189:                                + ReqPlugin.getProjectRef().getNameFromModel())) {
1190:                    attachment.setAttachmentObject(pRequirement);
1191:                    if (pRequirement.isFamilyReq()) {
1192:                        updateData(pFiltrePanel.getFiltre(),
1193:                                (SimpleTableModel) testReqFamilyTable
1194:                                        .getModel());
1195:                    } else {
1196:                        updateData(pFiltrePanel.getFiltre(),
1197:                                (SimpleTableModel) testReqLeafTable.getModel());
1198:                    }
1199:                }
1200:                if (pRequirement.getParent() == null) {
1201:                    setPie3D(pFiltrePanel.getFiltre());
1202:                } else {
1203:                    unsetPie3D(pFiltrePanel.getFiltre(), pRequirement);
1204:                }
1205:            }
1206:
1207:            public void actionPerformed(ActionEvent e) {
1208:                if (e.getSource().equals(viewTestFamilyReqButton)) {
1209:                    viewTestPerformed(e, testReqFamilyTable);
1210:                } else if (e.getSource().equals(viewCampFamilyReqButton)) {
1211:                    viewCampPerformed(e, testReqFamilyTable);
1212:                } else if (e.getSource().equals(viewTestReqLeafButton)) {
1213:                    viewTestPerformed(e, testReqLeafTable);
1214:                } else if (e.getSource().equals(viewCampReqLeafButton)) {
1215:                    viewCampPerformed(e, testReqLeafTable);
1216:                } else if (e.getSource().equals(priorityBox)) {
1217:                    priorityBoxPerformed(e);
1218:                } else if (e.getSource().equals(stateBox)) {
1219:                    stateBoxPerformed(e);
1220:                } else if (e.getSource().equals(complexeBox)) {
1221:                    complexeBoxPerformed(e);
1222:                } else if (e.getSource().equals(catBox)) {
1223:                    catBoxPerformed(e);
1224:                } else if (e.getSource().equals(changeVersion)) {
1225:                    changeVersionPerformed(e);
1226:                } else if (e.getSource().equals(comboNameChoice)) {
1227:                    changeNamePerformed(e);
1228:                } else if (e.getSource().equals(comboFiltreChoice)) {
1229:                    changeFiltreChoicePerformed(e);
1230:                } else if (e.getSource().equals(viewResExecReqButton)) {
1231:                    viewResExecReqButtonPerformed(e);
1232:                } else if (e.getSource().equals(viewCampButton)) {
1233:                    viewCampButtonButtonPerformed(e);
1234:                }
1235:            }
1236:
1237:            void setTestTree(DynamicTree _pDynamicTree) {
1238:                pDynamicTree = _pDynamicTree;
1239:            }
1240:
1241:            void viewCampButtonButtonPerformed(ActionEvent e) {
1242:                int selectedRow = satisfactionTable.getSelectedRow();
1243:                if (selectedRow > -1) {
1244:                    Vector statExecLine = (Vector) satisfactionTableFiltredData
1245:                            .elementAt(selectedRow);
1246:                    Campaign pCamp = (Campaign) statExecLine.elementAt(0);
1247:                    DataModel.view(pCamp);
1248:                }
1249:            }
1250:
1251:            void viewResExecReqButtonPerformed(ActionEvent e) {
1252:                //Get selected 
1253:                int selectedIndex = satisfactionTable.getSelectedRow();
1254:                if (selectedIndex > -1) {
1255:                    Vector statExecLine = (Vector) satisfactionTableFiltredData
1256:                            .elementAt(selectedIndex);
1257:                    ExecutionResult lastExecutionResult = (ExecutionResult) statExecLine
1258:                            .elementAt(6);
1259:                    Test pTest = (Test) statExecLine.elementAt(8);
1260:                    DataModel.setCurrentExecutionTestResult(lastExecutionResult
1261:                            .getExecutionTestResultFromModel(pTest));
1262:                    DataModel.setObervedExecutionResult(lastExecutionResult);
1263:                    if (pTest instanceof  ManualTest) {
1264:                        new ActionDetailsView((ManualTest) pTest,
1265:                                lastExecutionResult.getExecution(),
1266:                                lastExecutionResult, lastExecutionResult
1267:                                        .getExecutionTestResultFromModel(pTest));
1268:                    } else {
1269:                        new AttachmentViewWindow(SalomeTMFContext.getBaseIHM(),
1270:                                DataConstants.EXECUTION_RESULT_TEST, DataModel
1271:                                        .getCurrentExecutionTestResult());
1272:                    }
1273:                }
1274:            }
1275:
1276:            void changeNamePerformed(ActionEvent e) {
1277:                if (!canDoUpdateNameChoise) {
1278:                    return;
1279:                }
1280:                int choice = comboFiltreChoice.getSelectedIndex();
1281:                Vector data = null;
1282:                Enumeration keys;
1283:                boolean trouve = false;
1284:                String name = (String) comboNameChoice.getSelectedItem();
1285:                if (choice == 0) {
1286:                    //ALL
1287:                    //USE satisfactionTableData
1288:                    reloadDefaultSatisfactionTable();
1289:                } else if (choice == 1) {
1290:                    //Camp
1291:                    keys = pStatRequirement.executedStatByCamp.keys();
1292:                    while (keys.hasMoreElements() && !trouve) {
1293:                        Campaign pCamp = (Campaign) keys.nextElement();
1294:                        if (pCamp.getNameFromModel().equals(name)) {
1295:                            trouve = true;
1296:                            data = (Vector) pStatRequirement.executedStatByCamp
1297:                                    .get(pCamp);
1298:                        }
1299:                    }
1300:                } else if (choice == 2) {
1301:                    //Exex
1302:                    keys = pStatRequirement.executedStatByExec.keys();
1303:                    while (keys.hasMoreElements() && !trouve) {
1304:                        Execution pExec = (Execution) keys.nextElement();
1305:                        String longName = pExec.getCampagneFromModel()
1306:                                .getNameFromModel()
1307:                                + "/" + pExec.getNameFromModel();
1308:                        if (longName.equals(name)) {
1309:                            trouve = true;
1310:                            data = (Vector) pStatRequirement.executedStatByExec
1311:                                    .get(pExec);
1312:                        }
1313:                    }
1314:                } else if (choice == 3) {
1315:                    //Env
1316:                    keys = pStatRequirement.executedStatByEnv.keys();
1317:                    while (keys.hasMoreElements() && !trouve) {
1318:                        Environment pEnv = (Environment) keys.nextElement();
1319:                        if (pEnv.getNameFromModel().equals(name)) {
1320:                            trouve = true;
1321:                            data = (Vector) pStatRequirement.executedStatByEnv
1322:                                    .get(pEnv);
1323:                        }
1324:                    }
1325:                } else if (choice == 4) {
1326:                    //Exex
1327:                    keys = pStatRequirement.executedStatByExec.keys();
1328:                    while (keys.hasMoreElements()) {
1329:                        Execution pExec = (Execution) keys.nextElement();
1330:                        String longName = pExec.getCampagneFromModel()
1331:                                .getNameFromModel()
1332:                                + "/"
1333:                                + pExec.getEnvironmentFromModel()
1334:                                        .getNameFromModel();
1335:                        if (longName.equals(name)) {
1336:                            if (data == null) {
1337:                                data = new Vector();
1338:                            }
1339:                            Vector data2 = (Vector) pStatRequirement.executedStatByExec
1340:                                    .get(pExec);
1341:                            int size = data2.size();
1342:                            for (int i = 0; i < size; i++) {
1343:                                data.add(data2.elementAt(i));
1344:                            }
1345:                        }
1346:                    }
1347:                }
1348:
1349:                if (data != null) {
1350:                    //loadFromFiltre(data);
1351:                    loadSatisfactionTable(data);
1352:                } else {
1353:                    reloadDefaultSatisfactionTable();
1354:                }
1355:            }
1356:
1357:            void changeFiltreChoicePerformed(ActionEvent e) {
1358:                int choice = comboFiltreChoice.getSelectedIndex();
1359:
1360:                //if e != null
1361:                canDoUpdateNameChoise = false;
1362:                comboNameChoice.removeAllItems();
1363:                comboNameChoice.addItem(Language.getInstance().getText("Tout"));
1364:                Enumeration data = null;
1365:
1366:                if (choice == 0) {
1367:
1368:                } else if (choice == 1) {
1369:                    //Camp
1370:                    data = pStatRequirement.executedStatByCamp.keys();
1371:                } else if (choice == 2) {
1372:                    //Exex
1373:                    data = pStatRequirement.executedStatByExec.keys();
1374:                } else if (choice == 3) {
1375:                    //Env
1376:                    data = pStatRequirement.executedStatByEnv.keys();
1377:                } else if (choice == 4) {
1378:                    //Env
1379:                    data = pStatRequirement.executedStatByExec.keys();
1380:                }
1381:                if (data != null) {
1382:                    Vector unique = new Vector();
1383:                    while (data.hasMoreElements()) {
1384:                        if (choice == 1) {
1385:                            //Camp
1386:                            Campaign pCamp = (Campaign) data.nextElement();
1387:                            comboNameChoice.addItem(pCamp.getNameFromModel());
1388:                        } else if (choice == 2) {
1389:                            //Exex
1390:                            Execution pExec = (Execution) data.nextElement();
1391:                            comboNameChoice.addItem(pExec
1392:                                    .getCampagneFromModel().getNameFromModel()
1393:                                    + "/" + pExec.getNameFromModel());
1394:                        } else if (choice == 3) {
1395:                            //Env
1396:                            Environment pEnv = (Environment) data.nextElement();
1397:                            comboNameChoice.addItem(pEnv.getNameFromModel());
1398:                        } else if (choice == 4) {
1399:                            Execution pExec = (Execution) data.nextElement();
1400:                            String name = pExec.getCampagneFromModel()
1401:                                    .getNameFromModel()
1402:                                    + "/"
1403:                                    + pExec.getEnvironmentFromModel()
1404:                                            .getNameFromModel();
1405:                            if (!unique.contains(name)) {
1406:                                comboNameChoice.addItem(pExec
1407:                                        .getCampagneFromModel()
1408:                                        .getNameFromModel()
1409:                                        + "/"
1410:                                        + pExec.getEnvironmentFromModel()
1411:                                                .getNameFromModel());
1412:                                unique.add(name);
1413:                            }
1414:                        }
1415:                    }
1416:                }
1417:                canDoUpdateNameChoise = true;
1418:                //end if e!=null
1419:
1420:                //SimpleTableModel satisfactionTableModel = (SimpleTableModel) satisfactionTable.getModel();
1421:                //if (satisfactionTableData.size() != satisfactionTableModel.getRowCount()){
1422:                reloadDefaultSatisfactionTable();
1423:                //}
1424:
1425:            }
1426:
1427:            /*void loadFromFiltre(Vector filtredData){
1428:            	satisfactionTableFiltredData.clear();
1429:            	SimpleTableModel satisfactionTableModel = (SimpleTableModel) satisfactionTable.getModel();
1430:            	satisfactionTableModel.clearTable();
1431:            	int nbLastPass = 0;
1432:            	Vector listTest = new Vector();
1433:            	int size = filtredData.size();
1434:            	for (int k=0; k < size ; k++){
1435:            		Vector statExecLine = (Vector) filtredData.elementAt(k);
1436:            		Vector data2 = new Vector();
1437:            		Test pTest =  (Test) statExecLine.elementAt(8);
1438:            		if (!listTest.contains(pTest)){
1439:            			listTest.add(pTest);
1440:            		}
1441:            		String famName = pTest.getTestListFromModel().getFamilyFromModel().getNameFromModel();
1442:            		String suiteName = pTest.getTestListFromModel().getNameFromModel();
1443:            		String testName = pTest.getNameFromModel();
1444:            		
1445:            		data2.add(testName + " (" + famName + "/" + suiteName + ")");
1446:            		Campaign pCamp = (Campaign) statExecLine.elementAt(0);
1447:            		Execution pExec = (Execution) statExecLine.elementAt(1);
1448:            		int nbPass = ((Integer) statExecLine.elementAt(3)).intValue();
1449:            		int nbFail = ((Integer) statExecLine.elementAt(4)).intValue();
1450:            		int nbUnknow = ((Integer) statExecLine.elementAt(5)).intValue();
1451:            		String lastResult = (String) statExecLine.elementAt(7);
1452:            		data2.add(pCamp.getNameFromModel() + "/" + pExec.getNameFromModel());
1453:            		data2.add("" + nbPass + "P, " +nbFail + "F, " +nbUnknow + "I");
1454:            		data2.add(lastResult);
1455:            		if (lastResult.equals(ApiConstants.SUCCESS)){
1456:            			nbLastPass++;
1457:            		}
1458:            		satisfactionTableModel.insertRow(k,data2);
1459:            		satisfactionTableFiltredData.add(k, statExecLine);
1460:            		//j++;
1461:            		//Set campagne, exec, env Filtres //remplir des hashtables
1462:            	}
1463:            	float pourcentSat = 0;
1464:            	if (size!=0){
1465:            		pourcentSat= nbLastPass*100/size;
1466:            	}
1467:            	//satisfaction.setText(Language.getInstance().getText("Satisfaction") + " : " + pourcentSat+"%");
1468:            	int nbTest = pStatRequirement.getAllTestCovredByCurrentReq().size();
1469:            	int nbTest2 = pStatRequirement.getEexecutedStatCovredByCurrentReq().size();
1470:            	float pourcentTest = 0;
1471:            	float pourcentTest2 = 0;
1472:            	if (nbTest!=0){
1473:            		pourcentTest = listTest.size()*100/nbTest;
1474:            	}
1475:            	if (nbTest2 != 0){
1476:            		pourcentTest2 = listTest.size()*100/nbTest2;
1477:            	}
1478:            	coverTestRepresend.setText(Language.getInstance().getText("Test_couvert_represente") + ": " + pourcentTest+"%" ); 
1479:            	satisfaction.setText(Language.getInstance().getText("Satisfaction") + " : " + pourcentSat+"% / " + pourcentTest2 +"% " + Language.getInstance().getText("Exécute"));
1480:            	
1481:            }*/
1482:
1483:            void reloadDefaultSatisfactionTable() {
1484:                loadSatisfactionTable(satisfactionTableData);
1485:                /*int size = satisfactionTableData.size();
1486:                Vector listTest = new Vector();
1487:                satisfactionTableFiltredData.clear();
1488:                SimpleTableModel satisfactionTableModel = (SimpleTableModel) satisfactionTable.getModel();
1489:                satisfactionTableModel.clearTable();
1490:                int nbLastPass = 0;
1491:                for (int k=0; k < size ; k++){
1492:                	Vector statExecLine = (Vector) satisfactionTableData.elementAt(k);
1493:                	Vector data2 = new Vector();
1494:                	Test pTest =  (Test) statExecLine.elementAt(8);
1495:                	if (!listTest.contains(pTest)){
1496:                		listTest.add(pTest);
1497:                	}
1498:                	String famName = pTest.getTestListFromModel().getFamilyFromModel().getNameFromModel();
1499:                	String suiteName = pTest.getTestListFromModel().getNameFromModel();
1500:                	String testName = pTest.getNameFromModel();
1501:                	
1502:                	data2.add(testName + " (" + famName + "/" + suiteName + ")");
1503:                	Campaign pCamp = (Campaign) statExecLine.elementAt(0);
1504:                	Execution pExec = (Execution) statExecLine.elementAt(1);
1505:                	int nbPass = ((Integer) statExecLine.elementAt(3)).intValue();
1506:                	int nbFail = ((Integer) statExecLine.elementAt(4)).intValue();
1507:                	int nbUnknow = ((Integer) statExecLine.elementAt(5)).intValue();
1508:                	String lastResult = (String) statExecLine.elementAt(7);
1509:                	data2.add(pCamp.getNameFromModel() + "/" + pExec.getNameFromModel());
1510:                	data2.add("" + nbPass + "P, " +nbFail + "F, " +nbUnknow + "I");
1511:                	data2.add(lastResult);
1512:                	if (lastResult.equals(ApiConstants.SUCCESS)){
1513:                		nbLastPass++;
1514:                	}
1515:                	satisfactionTableModel.insertRow(k,data2);
1516:                	satisfactionTableFiltredData.add(k, statExecLine);
1517:                	//j++;
1518:                	//Set campagne, exec, env Filtres //remplir des hashtables
1519:                }
1520:                float pourcentSat = 0;
1521:                if (size!=0){
1522:                	pourcentSat= nbLastPass*100/size;
1523:                }
1524:                
1525:                coverTestRepresend.setText(Language.getInstance().getText("Test_couvert_represente") + ": 100%" ); 
1526:                int nbTest = pStatRequirement.getAllTestCovredByCurrentReq().size();
1527:                int nbTest2 = pStatRequirement.getEexecutedStatCovredByCurrentReq().size();
1528:                float pourcentTest = 0;
1529:                float pourcentTest2 = 0;
1530:                if (nbTest!=0){
1531:                	pourcentTest = listTest.size()*100/nbTest;
1532:                }
1533:                if (nbTest2 != 0){
1534:                	pourcentTest2 = listTest.size()*100/nbTest2;
1535:                }
1536:                coverTestRepresend.setText(Language.getInstance().getText("Test_couvert_represente") + ": " + pourcentTest+"%"); 
1537:                satisfaction.setText(Language.getInstance().getText("Satisfaction") + " : " + pourcentSat+"% / " + pourcentTest2 +"% " + Language.getInstance().getText("Exécute"));
1538:                 */
1539:            }
1540:
1541:            void loadSatisfactionTable(Vector satisfactionData) {
1542:                int size = satisfactionData.size();
1543:                Vector listTest = new Vector();
1544:
1545:                satisfactionTableFiltredData.clear();
1546:                SimpleTableModel satisfactionTableModel = (SimpleTableModel) satisfactionTable
1547:                        .getModel();
1548:                satisfactionTableModel.clearTable();
1549:
1550:                int nbLastPass = 0;
1551:                for (int k = 0; k < size; k++) {
1552:                    Vector statExecLine = (Vector) satisfactionData
1553:                            .elementAt(k);
1554:                    Vector data2 = new Vector();
1555:
1556:                    Test pTest = (Test) statExecLine.elementAt(8);
1557:                    if (!listTest.contains(pTest)) {
1558:                        listTest.add(pTest);
1559:                    }
1560:                    String str_listOfReq = "";
1561:                    Hashtable hashTestReq = pStatRequirement
1562:                            .getAllReqCovredByTest();
1563:                    Vector listOfReq = (Vector) hashTestReq.get(new Integer(
1564:                            pTest.getIdBdd()));
1565:                    if (listOfReq != null && listOfReq.size() > 0) {
1566:                        str_listOfReq = ((Requirement) listOfReq.elementAt(0))
1567:                                .getNameFromModel();
1568:                        for (int l = 1; l < listOfReq.size(); l++) {
1569:                            str_listOfReq += ", "
1570:                                    + ((Requirement) listOfReq.elementAt(l))
1571:                                            .getNameFromModel();
1572:                        }
1573:                    }
1574:                    data2.add(str_listOfReq);
1575:                    String famName = pTest.getTestListFromModel()
1576:                            .getFamilyFromModel().getNameFromModel();
1577:                    String suiteName = pTest.getTestListFromModel()
1578:                            .getNameFromModel();
1579:                    String testName = pTest.getNameFromModel();
1580:
1581:                    data2
1582:                            .add(testName + " (" + famName + "/" + suiteName
1583:                                    + ")");
1584:                    Campaign pCamp = (Campaign) statExecLine.elementAt(0);
1585:                    Execution pExec = (Execution) statExecLine.elementAt(1);
1586:                    int nbPass = ((Integer) statExecLine.elementAt(3))
1587:                            .intValue();
1588:                    int nbFail = ((Integer) statExecLine.elementAt(4))
1589:                            .intValue();
1590:                    int nbUnknow = ((Integer) statExecLine.elementAt(5))
1591:                            .intValue();
1592:                    String lastResult = (String) statExecLine.elementAt(7);
1593:                    data2.add(pCamp.getNameFromModel() + "/"
1594:                            + pExec.getNameFromModel());
1595:                    data2.add("" + nbPass + "P, " + nbFail + "F, " + nbUnknow
1596:                            + "I");
1597:                    data2.add(lastResult);
1598:                    if (lastResult.equals(ApiConstants.SUCCESS)) {
1599:                        nbLastPass++;
1600:                    }
1601:                    satisfactionTableModel.insertRow(k, data2);
1602:                    satisfactionTableFiltredData.add(k, statExecLine);
1603:                    //j++;
1604:                    //Set campagne, exec, env Filtres //remplir des hashtables
1605:                }
1606:                float pourcentSat = 0;
1607:                if (size != 0) {
1608:                    pourcentSat = nbLastPass * 100 / size;
1609:                }
1610:
1611:                coverTestRepresend.setText(Language.getInstance().getText(
1612:                        "Test_couvert_represente")
1613:                        + ": 100%");
1614:                int nbTest = pStatRequirement.getAllTestCovredByCurrentReq()
1615:                        .size();
1616:                int nbTest2 = pStatRequirement
1617:                        .getEexecutedStatCovredByCurrentReq().size();
1618:                float pourcentTest = 0;
1619:                float pourcentTest2 = 0;
1620:                if (nbTest != 0) {
1621:                    pourcentTest = listTest.size() * 100 / nbTest;
1622:                }
1623:                if (nbTest2 != 0) {
1624:                    pourcentTest2 = listTest.size() * 100 / nbTest2;
1625:                }
1626:                coverTestRepresend.setText(Language.getInstance().getText(
1627:                        "Test_couvert_represente")
1628:                        + ": " + pourcentTest + "%");
1629:                satisfaction.setText(Language.getInstance().getText(
1630:                        "Satisfaction")
1631:                        + " : "
1632:                        + pourcentSat
1633:                        + "% / "
1634:                        + pourcentTest2
1635:                        + "% "
1636:                        + Language.getInstance().getText("Exécute"));
1637:
1638:                Vector allTrackers = SalomeTMFContext.getInstance()
1639:                        .getBugTracker();
1640:                defectTabPanel.removeAll();
1641:                int size2 = allTrackers.size();
1642:                for (int k = 0; k < size2; k++) {
1643:                    BugTracker pBugTracker = (BugTracker) allTrackers
1644:                            .elementAt(k);
1645:                    JPanel pJPanel = pBugTracker
1646:                            .getDefectPanelForTests(listTest);
1647:                    if (pJPanel != null) {
1648:                        defectTabPanel.addTab(pBugTracker.getBugTrackerName(),
1649:                                pJPanel);
1650:                    }
1651:                }
1652:            }
1653:
1654:            void changeVersionPerformed(ActionEvent e) {
1655:                //if (canDoUpdatePrirotity){
1656:                ReqLeaf pReqLeaf = null;
1657:                if (pRequirement instanceof  ReqLeaf) {
1658:                    try {
1659:                        pReqLeaf = (ReqLeaf) pRequirement;
1660:                        pReqLeaf.updateInfoInDBAndModel(versionField.getText()
1661:                                .trim(), ((String) origineField
1662:                                .getSelectedItem()).trim(),
1663:                                ((String) verifmodeField.getSelectedItem())
1664:                                        .trim(), ((String) referenceField
1665:                                        .getSelectedItem()).trim());
1666:                        pHistoryPanel.updateData(pReqLeaf, true);
1667:                    } catch (Exception ex) {
1668:                        ex.printStackTrace();
1669:                        if (pReqLeaf != null) {
1670:                            versionField.setText(((ReqLeaf) pRequirement)
1671:                                    .getVersionFromModel());
1672:                            setInfo(referenceField, referenceList,
1673:                                    ((ReqLeaf) pRequirement)
1674:                                            .getReferenceFromModel());
1675:                            setInfo(origineField, origineList,
1676:                                    ((ReqLeaf) pRequirement)
1677:                                            .getOrigineFromModel());
1678:                            setInfo(verifmodeField, verifList,
1679:                                    ((ReqLeaf) pRequirement)
1680:                                            .getVerifFromModel());
1681:
1682:                        }
1683:                    }
1684:                }
1685:                //}
1686:            }
1687:
1688:            void stateBoxPerformed(ActionEvent e) {
1689:                if (canDoUpdateState) {
1690:                    int indexSelected = stateBox.getSelectedIndex();
1691:                    int oldstate = -1;
1692:                    ReqLeaf pReqLeaf = null;
1693:                    if (pRequirement instanceof  ReqLeaf) {
1694:                        try {
1695:                            pReqLeaf = (ReqLeaf) pRequirement;
1696:                            oldstate = pReqLeaf.getStateFromModel();
1697:                            if (oldstate == indexSelected) {
1698:                                return;
1699:                            }
1700:                            pReqLeaf.updateStateInDBAndModel(indexSelected);
1701:                            pHistoryPanel.updateData(pReqLeaf, true);
1702:                        } catch (Exception ex) {
1703:                            if (pReqLeaf != null && oldstate != -1) {
1704:                                pReqLeaf.updateStateInModel(oldstate);
1705:                            }
1706:                        }
1707:                    }
1708:                }
1709:            }
1710:
1711:            void catBoxPerformed(ActionEvent e) {
1712:                if (canDoUpdateCat) {
1713:                    int indexSelected = catBox.getSelectedIndex();
1714:                    int oldcat = -1;
1715:                    ReqLeaf pReqLeaf = null;
1716:                    if (pRequirement instanceof  ReqLeaf) {
1717:                        try {
1718:                            pReqLeaf = (ReqLeaf) pRequirement;
1719:                            oldcat = pReqLeaf.getCatFromModel();
1720:                            if (oldcat == indexSelected) {
1721:                                return;
1722:                            }
1723:                            pReqLeaf.updateCatInDBAndModel(indexSelected);
1724:                            pHistoryPanel.updateData(pReqLeaf, true);
1725:                        } catch (Exception ex) {
1726:                            if (pReqLeaf != null && oldcat != -1) {
1727:                                pReqLeaf.updateCatInModel(oldcat);
1728:                            }
1729:                        }
1730:                    }
1731:                }
1732:            }
1733:
1734:            void complexeBoxPerformed(ActionEvent e) {
1735:                if (canDoUpdateComplexe) {
1736:                    int indexSelected = complexeBox.getSelectedIndex();
1737:                    int complexeSelected = 100;
1738:                    if (indexSelected == 0) {
1739:                        complexeSelected = ReqFilter.C0;
1740:                    } else if (indexSelected == 1) {
1741:                        complexeSelected = ReqFilter.C1;
1742:                    } else if (indexSelected == 2) {
1743:                        complexeSelected = ReqFilter.C2;
1744:                    } else if (indexSelected == 3) {
1745:                        complexeSelected = ReqFilter.C3;
1746:                    }
1747:                    int oldComplexe = -1;
1748:                    ReqLeaf pReqLeaf = null;
1749:                    if (pRequirement instanceof  ReqLeaf) {
1750:                        try {
1751:                            pReqLeaf = (ReqLeaf) pRequirement;
1752:                            oldComplexe = pReqLeaf.getComplexeFromModel();
1753:                            if (oldComplexe == complexeSelected) {
1754:                                return;
1755:                            }
1756:                            pReqLeaf
1757:                                    .updateComplexeInDBAndModel(complexeSelected);
1758:                            pHistoryPanel.updateData(pReqLeaf, true);
1759:                        } catch (Exception ex) {
1760:                            if (pReqLeaf != null && oldComplexe != -1) {
1761:                                pReqLeaf.updateComplexeInModel(oldComplexe);
1762:                            }
1763:                        }
1764:                    }
1765:                }
1766:            }
1767:
1768:            void priorityBoxPerformed(ActionEvent e) {
1769:                if (canDoUpdatePrirotity) {
1770:                    int indexSelected = priorityBox.getSelectedIndex();
1771:                    int priroritySelected = 1000;
1772:                    if (indexSelected == 0) {
1773:                        priroritySelected = 1000;
1774:                    } else if (indexSelected == 1) {
1775:                        priroritySelected = 100;
1776:                    } else if (indexSelected == 2) {
1777:                        priroritySelected = 10;
1778:                    } else if (indexSelected == 3) {
1779:                        priroritySelected = 1;
1780:                    }
1781:                    int oldPriority = -1;
1782:                    ReqLeaf pReqLeaf = null;
1783:                    if (pRequirement instanceof  ReqLeaf) {
1784:                        try {
1785:                            pReqLeaf = (ReqLeaf) pRequirement;
1786:                            oldPriority = pReqLeaf.getPriorityFromModel();
1787:                            if (oldPriority == priroritySelected) {
1788:                                return;
1789:                            }
1790:                            pReqLeaf
1791:                                    .updatePriorityInDBAndModel(priroritySelected);
1792:                            pHistoryPanel.updateData(pReqLeaf, true);
1793:                        } catch (Exception ex) {
1794:                            if (pReqLeaf != null && oldPriority != -1) {
1795:                                pReqLeaf.updatePriorityInModel(oldPriority);
1796:                            }
1797:                        }
1798:                    }
1799:                }
1800:            }
1801:
1802:            void viewTestPerformed(ActionEvent e, JTable pTable) {
1803:                int selectedRow = pTable.getSelectedRow();
1804:                if (selectedRow > -1) {
1805:                    if (testCover != null) {
1806:                        Test pTest = (Test) testCover.elementAt(selectedRow);
1807:                        if (pDynamicTree != null) {
1808:                            DefaultMutableTreeNode node = pDynamicTree
1809:                                    .findRemoveTestNode(pTest
1810:                                            .getNameFromModel(), pTest
1811:                                            .getTestListFromModel()
1812:                                            .getNameFromModel(), pTest
1813:                                            .getTestListFromModel()
1814:                                            .getFamilyFromModel()
1815:                                            .getNameFromModel(), false);
1816:                            if (node != null) {
1817:                                //pReqTree.refreshNode(node);
1818:                                ReqPlugin.selectTestTab();
1819:                                pDynamicTree.getTree().setSelectionPath(
1820:                                        new TreePath(node.getPath()));
1821:
1822:                            }
1823:                        }
1824:                    }
1825:                }
1826:            }
1827:
1828:            void viewCampPerformed(ActionEvent e, JTable pTable) {
1829:                int selectedRow = pTable.getSelectedRow();
1830:                if (selectedRow > -1) {
1831:                    if (testCover != null) {
1832:                        Test pTest = (Test) testCover.elementAt(selectedRow);
1833:                        if (DataModel.isTestExecuted(pTest)) {
1834:                            new ViewCampaignOfTest(pTest);
1835:                        }
1836:                    }
1837:                }
1838:            }
1839:
1840:            public void valueChanged(ListSelectionEvent e) {
1841:                //Ignore extra messages.
1842:                if (e.getValueIsAdjusting()) {
1843:                    return;
1844:                }
1845:
1846:                ListSelectionModel lsm = (ListSelectionModel) e.getSource();
1847:                if (lsm.isSelectionEmpty()) {
1848:                    //no rows are selected
1849:
1850:                } else {
1851:                    //int selectedRow = lsm.getMinSelectionIndex();
1852:                    //selectedRow is selected
1853:                }
1854:            }
1855:
1856:            /********************* ComboField from info ************************/
1857:            public void setColumnSize(JTable table) {
1858:                FontMetrics fm = table.getFontMetrics(table.getFont());
1859:                for (int i = 0; i < table.getColumnCount(); i++) {
1860:                    int max = 0;
1861:                    for (int j = 0; j < table.getRowCount(); j++) {
1862:                        int taille = fm.stringWidth((String) table.getValueAt(
1863:                                j, i));
1864:                        if (taille > max)
1865:                            max = taille;
1866:                    }
1867:                    String nom = (String) table.getColumnModel().getColumn(i)
1868:                            .getIdentifier();
1869:                    int taille = fm.stringWidth(nom);
1870:                    if (taille > max)
1871:                        max = taille;
1872:                    table.getColumnModel().getColumn(i).setPreferredWidth(
1873:                            max + 10);
1874:                }
1875:            }
1876:
1877:            void setInfo(JComboBox pJcomboBox, Vector pVector, String value) {
1878:                if (value == null) {
1879:                    value = "";
1880:                }
1881:                pJcomboBox.removeAllItems();
1882:                int size = pVector.size();
1883:                int selectedItem = -1;
1884:                for (int i = 0; i < size; i++) {
1885:                    String item = (String) pVector.elementAt(i);
1886:                    pJcomboBox.addItem(item);
1887:                    if (value.equals(item)) {
1888:                        selectedItem = i;
1889:                    }
1890:                }
1891:                if (selectedItem == -1) {
1892:                    pJcomboBox.addItem(value);
1893:                    pJcomboBox.setSelectedIndex(size);
1894:                } else {
1895:                    pJcomboBox.setSelectedIndex(selectedItem);
1896:                }
1897:            }
1898:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.