Source Code Cross Referenced for ManualExecution.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » ihm » main » 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 » org.objectweb.salome_tmf.ihm.main 
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 Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
0020:         *
0021:         * Contact: mikael.marche@rd.francetelecom.com
0022:         */
0023:
0024:        package org.objectweb.salome_tmf.ihm.main;
0025:
0026:        import java.awt.BorderLayout;
0027:        import java.awt.Color;
0028:        import java.awt.Container;
0029:        import java.awt.Dimension;
0030:        import java.awt.GraphicsConfiguration;
0031:        import java.awt.GraphicsDevice;
0032:        import java.awt.GraphicsEnvironment;
0033:        import java.awt.GridLayout;
0034:        import java.awt.Rectangle;
0035:        import java.awt.event.ActionEvent;
0036:        import java.awt.event.ActionListener;
0037:        import java.awt.event.WindowEvent;
0038:        import java.awt.event.WindowListener;
0039:        import java.util.ArrayList;
0040:        import java.util.GregorianCalendar;
0041:        import java.util.HashMap;
0042:        import java.util.Vector;
0043:
0044:        import javax.swing.BorderFactory;
0045:        import javax.swing.Box;
0046:        import javax.swing.BoxLayout;
0047:        import javax.swing.ImageIcon;
0048:        import javax.swing.JButton;
0049:        import javax.swing.JDialog;
0050:        import javax.swing.JLabel;
0051:        import javax.swing.JMenu;
0052:        import javax.swing.JMenuBar;
0053:        import javax.swing.JMenuItem;
0054:        import javax.swing.JOptionPane;
0055:        import javax.swing.JPanel;
0056:        import javax.swing.JScrollPane;
0057:        import javax.swing.JTabbedPane;
0058:        import javax.swing.JTable;
0059:        import javax.swing.JTextPane;
0060:        import javax.swing.ListSelectionModel;
0061:        import javax.swing.event.CaretEvent;
0062:        import javax.swing.event.CaretListener;
0063:        import javax.swing.event.ChangeEvent;
0064:        import javax.swing.event.ChangeListener;
0065:        import javax.swing.event.ListSelectionEvent;
0066:        import javax.swing.event.ListSelectionListener;
0067:        import javax.swing.text.html.HTMLDocument;
0068:        import javax.swing.text.html.HTMLEditorKit;
0069:
0070:        import org.objectweb.salome_tmf.api.Api;
0071:        import org.objectweb.salome_tmf.api.ApiConstants;
0072:        import org.objectweb.salome_tmf.data.Action;
0073:        import org.objectweb.salome_tmf.data.DataConstants;
0074:        import org.objectweb.salome_tmf.data.Execution;
0075:        import org.objectweb.salome_tmf.data.ExecutionResult;
0076:        import org.objectweb.salome_tmf.data.ExecutionTestResult;
0077:        import org.objectweb.salome_tmf.data.FileAttachment;
0078:        import org.objectweb.salome_tmf.data.ManualExecutionResult;
0079:        import org.objectweb.salome_tmf.data.ManualTest;
0080:        import org.objectweb.salome_tmf.data.WithAttachment;
0081:        import org.objectweb.salome_tmf.ihm.IHMConstants;
0082:        import org.objectweb.salome_tmf.ihm.languages.Language;
0083:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
0084:        import org.objectweb.salome_tmf.ihm.main.plugins.PluginsTools;
0085:        import org.objectweb.salome_tmf.ihm.models.MyTableModel;
0086:        import org.objectweb.salome_tmf.ihm.tools.Tools;
0087:        import org.objectweb.salome_tmf.plugins.UICompCst;
0088:        import org.objectweb.salome_tmf.plugins.core.BugTracker;
0089:
0090:        /**
0091:         * Classe qui cr?e la fen?tre tracant l'?x?cution d'un test
0092:         * @author teaml039
0093:         * @version : 0.1
0094:         */
0095:        public class ManualExecution extends JDialog implements  ApiConstants,
0096:                DataConstants, IHMConstants, Runnable {
0097:
0098:            /**
0099:             * Bouton pour indiquer que l'action a r?ussi
0100:             */
0101:            JButton statusOkButton;
0102:
0103:            /**
0104:             * Bouton pour indiquer que l'action a ?chou?
0105:             */
0106:            JButton statusFailedButton;
0107:
0108:            /**
0109:             * Bouton pour indiquer que l'on ne conna?t pas le r?sultat de l'action
0110:             */
0111:            JButton statusUnknowButton;
0112:
0113:            /**
0114:             * Bouton pour revenir au test pr?c?dent
0115:             */
0116:            JButton prevTestButton;
0117:
0118:            /**
0119:             * Bouton pour passer au test suivant
0120:             */
0121:            JButton nextTestButton;
0122:
0123:            /**
0124:             * Bouton pour interrompre l'ex?cution
0125:             */
0126:            //JButton stopButton;
0127:            /**
0128:             * Bouton pour sortir de la fen?tre
0129:             */
0130:            JButton endButton;
0131:
0132:            JButton screenShootButton;
0133:
0134:            /**
0135:             * Mod?le de donn?es pour la table des actions
0136:             */
0137:            MyTableModel actionsTableModel;
0138:
0139:            /**
0140:             * Table des actions
0141:             */
0142:            JTable actionsTable;
0143:
0144:            /**
0145:             * Description de l'action courante
0146:             */
0147:            JTextPane actionDescription;
0148:
0149:            /**
0150:             * R?sultat attendu de l'action courante
0151:             */
0152:            JTextPane awaitedResult;
0153:
0154:            /**
0155:             * R?sultat effectif de l'action courante
0156:             */
0157:            JTextPane effectiveResult;
0158:
0159:            /**
0160:             * Liste des tests ? ex?cuter
0161:             */
0162:            ArrayList testsToBeExecuted;
0163:
0164:            /**
0165:             * Nom du test courant
0166:             */
0167:            JLabel testName;
0168:
0169:            /**
0170:             * Description du test courant
0171:             */
0172:            JTextPane testDescription;
0173:            HTMLDocument m_oDocument;
0174:            HTMLEditorKit m_oHTML;
0175:            /**
0176:             * Conteneur pour l'affichage
0177:             */
0178:            Container contentPaneFrame;
0179:
0180:            /**
0181:             * Le test en cours d'ex?cution
0182:             */
0183:            ManualTest testInExecution;
0184:
0185:            ManualExecutionResult execTestRes;
0186:            /**
0187:             * Indice du test en cours d'ex?cution
0188:             */
0189:            int indexOfTextInExecution;
0190:
0191:            /**
0192:             * R?sultat de l'?x?cution
0193:             */
0194:            ExecutionResult execResult;
0195:
0196:            /**
0197:             * Nom du r?sultat d'ex?cution courant
0198:             */
0199:            String currentExecutionResultName;
0200:
0201:            /**
0202:             * Indexe de bloquage dans la table des actions (pour emp?cher la s?lection)
0203:             */
0204:            int blockIndex;
0205:
0206:            /**
0207:             * Mod?le de s?lection pour la table des actions
0208:             */
0209:            ListSelectionModel rowSM;
0210:
0211:            /**
0212:             * Execution courante
0213:             */
0214:            Execution currentExecution;
0215:
0216:            HashMap oldMap;
0217:
0218:            Thread t;
0219:
0220:            //ExecutionView execView;
0221:
0222:            //JButton addBugButton;
0223:
0224:            boolean finished = false;
0225:            boolean stop_exec = false;
0226:
0227:            String title;
0228:            /******************************************************************************/
0229:            /** 							CONSTRUCTEUR								***/
0230:            /******************************************************************************/
0231:            //ExecutionResult finalExecResult;
0232:            int t_x = 1024 - 100;
0233:            int t_y = 768 - 200;
0234:            int t_x2 = 1024;
0235:            int t_y2 = 768;
0236:
0237:            /****** Gestion des attachements par onglet *******/
0238:            AttachmentView resExecTestAttachmentPanel;
0239:            AttachmentView testAttachmentPanel;
0240:            AttachmentView actionAttachmentPanel;
0241:            JTabbedPane pJTabbedPane;
0242:
0243:            /**
0244:             * Constructeur de la fen?tre
0245:             * @param testList liste de tests ? ex?cuter
0246:             */
0247:            public ManualExecution(ArrayList testList, Execution execution,
0248:                    ExecutionResult executionResult, boolean contineExec) {
0249:
0250:                super (SalomeTMFContext.getInstance().ptrFrame, true);
0251:                //setResizable(false);
0252:                //this.finalExecResult = finalExecResult;
0253:
0254:                DataModel.setObervedExecutionResult(executionResult);
0255:
0256:                try {
0257:                    GraphicsEnvironment ge = GraphicsEnvironment
0258:                            .getLocalGraphicsEnvironment();
0259:                    GraphicsDevice[] gs = ge.getScreenDevices();
0260:                    GraphicsDevice gd = gs[0];
0261:                    GraphicsConfiguration[] gc = gd.getConfigurations();
0262:                    Rectangle r = gc[0].getBounds();
0263:                    t_x = r.width - 100;
0264:                    t_y = r.height - 200;
0265:                    t_x2 = r.width;
0266:                    t_y2 = r.height;
0267:                } catch (Exception E) {
0268:
0269:                }
0270:
0271:                finished = false;
0272:                blockIndex = 0;
0273:
0274:                oldMap = new HashMap();
0275:
0276:                statusOkButton = new JButton(Language.getInstance().getText(
0277:                        "Succès"));
0278:
0279:                statusFailedButton = new JButton(Language.getInstance()
0280:                        .getText("Echec"));
0281:
0282:                statusUnknowButton = new JButton(Language.getInstance()
0283:                        .getText("Inconclusif"));
0284:
0285:                prevTestButton = new JButton(Language.getInstance().getText(
0286:                        "Test_précédent"));
0287:
0288:                nextTestButton = new JButton(Language.getInstance().getText(
0289:                        "Test_suivant"));
0290:
0291:                //stopButton = new JButton(Language.getInstance().getText("Stop"));
0292:
0293:                endButton = new JButton(Language.getInstance().getText(
0294:                        "Terminer"));
0295:
0296:                screenShootButton = new JButton();
0297:                screenShootButton.setIcon(Tools.createAppletImageIcon(
0298:                        PATH_TO_SCREENSHOT_ICON, ""));
0299:
0300:                actionsTableModel = new MyTableModel();
0301:
0302:                actionsTable = new JTable();
0303:
0304:                actionDescription = new JTextPane();
0305:
0306:                awaitedResult = new JTextPane();
0307:
0308:                effectiveResult = new JTextPane();
0309:
0310:                testsToBeExecuted = new ArrayList();
0311:
0312:                testName = new JLabel();
0313:
0314:                testDescription = new JTextPane();
0315:                m_oDocument = new HTMLDocument();
0316:                m_oHTML = new HTMLEditorKit();
0317:                testDescription.setEditorKit(m_oHTML);
0318:                testDescription.setDocument(m_oDocument);
0319:
0320:                // Mapping entre objets graphiques et constantes
0321:                SalomeTMFContext.getInstance().addToUIComponentsMap(
0322:                        UICompCst.MANUAL_EXECUTION_TEST_DESCRIPTION_TEXTPANE,
0323:                        testDescription);
0324:                SalomeTMFContext.getInstance().addToUIComponentsMap(
0325:                        UICompCst.MANUAL_EXECUTION_ACTION_DESCRIPTION_TEXTPANE,
0326:                        actionDescription);
0327:                SalomeTMFContext
0328:                        .getInstance()
0329:                        .addToUIComponentsMap(
0330:                                UICompCst.MANUAL_EXECUTION_ACTION_WAITED_RESULT_TEXTPANE,
0331:                                awaitedResult);
0332:                SalomeTMFContext
0333:                        .getInstance()
0334:                        .addToUIComponentsMap(
0335:                                UICompCst.MANUAL_EXECUTION_ACTION_EFFECTIVE_RESULT_TEXTPANE,
0336:                                effectiveResult);
0337:                // Activation des plugins associ?s
0338:                PluginsTools
0339:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_TEST_DESCRIPTION_TEXTPANE);
0340:                PluginsTools
0341:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTION_DESCRIPTION_TEXTPANE);
0342:                PluginsTools
0343:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTION_WAITED_RESULT_TEXTPANE);
0344:                PluginsTools
0345:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTION_EFFECTIVE_RESULT_TEXTPANE);
0346:
0347:                //execView = executionView;
0348:
0349:                statusOkButton.setToolTipText(Language.getInstance().getText(
0350:                        "L'action_a_réussie"));
0351:                statusOkButton.setIcon(Tools.createAppletImageIcon(
0352:                        PATH_TO_SUCCESS_ICON, ""));
0353:                statusOkButton.addActionListener(new ActionListener() {
0354:                    public void actionPerformed(ActionEvent e) {
0355:                        int selectedRowIndex = actionsTable.getSelectedRow();
0356:                        Action pAction = testInExecution
0357:                                .getActionFromModel((String) actionsTableModel
0358:                                        .getValueAt(selectedRowIndex, 0));
0359:                        if (selectedRowIndex != -1 && pAction != null) {
0360:                            actionsTableModel.setValueAt(Tools
0361:                                    .createAppletImageIcon(
0362:                                            PATH_TO_SUCCESS_ICON, ""),
0363:                                    selectedRowIndex, actionsTableModel
0364:                                            .getColumnCount() - 1);
0365:                            //execResult.addStatusForAction(testInExecution.getActionFromModel((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), SUCCESS);
0366:
0367:                            //ManualExecutionResult execTestRes = (ManualExecutionResult) execResult.getExecutionTestResultFromModel(testInExecution);
0368:                            execTestRes
0369:                                    .addStatusForActionInModel(
0370:                                            testInExecution
0371:                                                    .getActionFromModel((String) actionsTableModel
0372:                                                            .getValueAt(
0373:                                                                    selectedRowIndex,
0374:                                                                    0)),
0375:                                            SUCCESS);
0376:                            if (selectedRowIndex < (actionsTableModel
0377:                                    .getRowCount() - 1)) {
0378:
0379:                                blockIndexCalculation(selectedRowIndex);
0380:                                ListSelectionModel lsm = actionsTable
0381:                                        .getSelectionModel();
0382:                                lsm.setSelectionInterval(selectedRowIndex + 1,
0383:                                        selectedRowIndex + 1);
0384:                            } else {
0385:
0386:                                blockIndexCalculation(0);
0387:                                changeTest();
0388:                            }
0389:                        }
0390:                    }
0391:                });
0392:
0393:                statusFailedButton.setToolTipText(Language.getInstance()
0394:                        .getText("L'action_a_échouée"));
0395:                statusFailedButton.setIcon(Tools.createAppletImageIcon(
0396:                        PATH_TO_FAIL_ICON, ""));
0397:                statusFailedButton.addActionListener(new ActionListener() {
0398:                    public void actionPerformed(ActionEvent e) {
0399:                        int selectedRowIndex = actionsTable.getSelectedRow();
0400:                        Action pAction = testInExecution
0401:                                .getActionFromModel((String) actionsTableModel
0402:                                        .getValueAt(selectedRowIndex, 0));
0403:
0404:                        if (selectedRowIndex != -1 && pAction != null) {
0405:
0406:                            //execResult.addStatusForAction(testInExecution.getActionFromModel((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), FAIL);
0407:                            execTestRes
0408:                                    .addStatusForActionInModel(
0409:                                            testInExecution
0410:                                                    .getActionFromModel((String) actionsTableModel
0411:                                                            .getValueAt(
0412:                                                                    selectedRowIndex,
0413:                                                                    0)), FAIL);
0414:                            actionsTableModel.setValueAt(Tools
0415:                                    .createAppletImageIcon(PATH_TO_FAIL_ICON,
0416:                                            ""), selectedRowIndex,
0417:                                    actionsTableModel.getColumnCount() - 1);
0418:                            if (selectedRowIndex < (actionsTableModel
0419:                                    .getRowCount() - 1)) {
0420:                                //blockIndex = selectedRowIndex + 1;
0421:                                blockIndexCalculation(selectedRowIndex);
0422:                            } else {
0423:                                //blockIndex = 0;
0424:                                blockIndexCalculation(0);
0425:                            }
0426:                        }
0427:                    }
0428:                });
0429:
0430:                statusUnknowButton.setToolTipText(Language.getInstance()
0431:                        .getText("Pas_de_résultat_pour_cette_action"));
0432:                statusUnknowButton.setIcon(Tools.createAppletImageIcon(
0433:                        PATH_TO_UNKNOW_ICON, ""));
0434:                statusUnknowButton.addActionListener(new ActionListener() {
0435:                    public void actionPerformed(ActionEvent e) {
0436:                        int selectedRowIndex = actionsTable.getSelectedRow();
0437:                        Action pAction = testInExecution
0438:                                .getActionFromModel((String) actionsTableModel
0439:                                        .getValueAt(selectedRowIndex, 0));
0440:
0441:                        if (selectedRowIndex != -1 && pAction != null) {
0442:
0443:                            //execResult.addStatusForAction(testInExecution.getActionFromModel((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), UNKNOWN);
0444:                            execTestRes
0445:                                    .addStatusForActionInModel(
0446:                                            testInExecution
0447:                                                    .getActionFromModel((String) actionsTableModel
0448:                                                            .getValueAt(
0449:                                                                    selectedRowIndex,
0450:                                                                    0)),
0451:                                            UNKNOWN);
0452:                            actionsTableModel.setValueAt(Tools
0453:                                    .createAppletImageIcon(PATH_TO_UNKNOW_ICON,
0454:                                            ""), selectedRowIndex,
0455:                                    actionsTableModel.getColumnCount() - 1);
0456:                            if (selectedRowIndex < (actionsTableModel
0457:                                    .getRowCount() - 1)) {
0458:                                //blockIndex = selectedRowIndex + 1;
0459:                                blockIndexCalculation(selectedRowIndex);
0460:                            } else {
0461:                                //blockIndex = 0;
0462:                                blockIndexCalculation(0);
0463:                            }
0464:                        }
0465:                    }
0466:                });
0467:
0468:                prevTestButton.setToolTipText(Language.getInstance().getText(
0469:                        "Revenir_au_test_précédent"));
0470:                prevTestButton.setEnabled(false);
0471:                prevTestButton.setIcon(Tools.createAppletImageIcon(
0472:                        PATH_TO_ARROW_BACK_ICON, ""));
0473:                prevTestButton.addActionListener(new ActionListener() {
0474:                    public void actionPerformed(ActionEvent e) {
0475:                        changeTestBack();
0476:                        blockIndexCalculation(0);
0477:                    }
0478:                });
0479:
0480:                nextTestButton.setToolTipText(Language.getInstance().getText(
0481:                        "Passer_au_test_suivant"));
0482:                nextTestButton.setIcon(Tools.createAppletImageIcon(
0483:                        PATH_TO_ARROW_ICON, ""));
0484:                nextTestButton.addActionListener(new ActionListener() {
0485:                    public void actionPerformed(ActionEvent e) {
0486:                        changeTest();
0487:                        blockIndexCalculation(0);
0488:                    }
0489:                });
0490:                if (testList.size() < 2) {
0491:                    nextTestButton.setEnabled(false);
0492:                }
0493:
0494:                /*
0495:                stopButton.setToolTipText(Language.getInstance().getText("Interrompre_l'exécution"));
0496:                stopButton.setIcon(Tools.createAppletImageIcon(PATH_TO_STOP_ICON,""));
0497:                stopButton.addActionListener(new ActionListener() {
0498:                    public void actionPerformed(ActionEvent e) {
0499:                        testStatusCalculation();
0500:                        stop_exec = true;
0501:                        execResult.setExecutionStatusInModel(INTERRUPT);
0502:                        //execView.libere();
0503:                        finished = true;
0504:                        ManualExecution.this.dispose();
0505:                    }
0506:                });
0507:                 */
0508:
0509:                endButton.setToolTipText(Language.getInstance().getText(
0510:                        "Sortir_de_l'exécution"));
0511:                endButton.setIcon(Tools.createAppletImageIcon(
0512:                        PATH_TO_MOVE_ICON, ""));
0513:                endButton.addActionListener(new ActionListener() {
0514:                    public void actionPerformed(ActionEvent e) {
0515:                        testStatusCalculation();
0516:
0517:                        finished = true;
0518:                        ManualExecution.this .dispose();
0519:                    }
0520:                });
0521:
0522:                screenShootButton.addActionListener(new ActionListener() {
0523:                    public void actionPerformed(java.awt.event.ActionEvent e) {
0524:                        screeshootFrame(e);
0525:                    }
0526:                });
0527:
0528:                /*
0529:                JButton attachButton = new JButton(Language.getInstance().getText("Attachements"));
0530:                attachButton.addActionListener(new ActionListener() {
0531:                    public void actionPerformed(ActionEvent e) {
0532:                    	//new AttachmentViewWindow(SalomeTMF.ptrSalomeTMF, EXECUTION_RESULT_TEST, DataModel.getCurrentExecutionTestResult(), null, null, null);
0533:                    	new AttachmentViewWindow(SalomeTMFContext.getInstance().getBaseIHM(), EXECUTION_RESULT_TEST, DataModel.getCurrentExecutionTestResult());
0534:                        
0535:                    }
0536:                });
0537:                 */
0538:
0539:                /*
0540:                  JMenu attachMenu = new JMenu(Language.getInstance().getText("Attachements"));
0541:                  
0542:                  // Test execution result attachments
0543:                  JMenuItem resExecAttachSubMenu = new JMenuItem(Language.getInstance().getText("Res_Exec_Attachs"));
0544:                  resExecAttachSubMenu.addActionListener(new ActionListener() {
0545:                      public void actionPerformed(ActionEvent e) {
0546:                      	//new AttachmentViewWindow(SalomeTMF.ptrSalomeTMF, EXECUTION_RESULT_TEST, DataModel.getCurrentExecutionTestResult(), null, null, null);
0547:                      	new AttachmentViewWindow(SalomeTMFContext.getInstance().getBaseIHM(), EXECUTION_RESULT_TEST, DataModel.getCurrentExecutionTestResult());
0548:                      	
0549:                      }
0550:                  });
0551:                  attachMenu.add(resExecAttachSubMenu);
0552:                  attachMenu.addSeparator();
0553:                  
0554:                  // Current test in execution attachments
0555:                  JMenuItem currentTestAttachSubMenu = new JMenuItem(Language.getInstance().getText("Current_Test_Attachs"));
0556:                  currentTestAttachSubMenu.addActionListener(new ActionListener() {
0557:                      public void actionPerformed(ActionEvent e) {
0558:                      	DataModel.setCurrentTest(testInExecution);
0559:                      	JDialog testAttachsDialog = new JDialog(SalomeTMFContext.getInstance().ptrFrame, true);
0560:                          AttachmentView attachView = new AttachmentView(SalomeTMFContext.getInstance().getBaseIHM(), TEST, TEST, null, NORMAL_SIZE_FOR_ATTACH, testAttachsDialog);
0561:                          attachView.setReadOnly();
0562:                          Container contentPaneFrame = testAttachsDialog.getContentPane();
0563:                          contentPaneFrame.add(attachView, BorderLayout.CENTER);
0564:                          testAttachsDialog.setTitle(Language.getInstance().getText("Attachements") + " (Test = " + testInExecution.getNameFromModel() + ")");
0565:                          testAttachsDialog.pack();
0566:                          testAttachsDialog.setLocation((t_x2 - contentPaneFrame.getSize().width) /2 , (t_y2 - contentPaneFrame.getSize().height)/2);
0567:                          
0568:                          testAttachsDialog.setVisible(true);
0569:                      }
0570:                  });
0571:                  attachMenu.add(currentTestAttachSubMenu);
0572:                  
0573:                  // Currents action in execution attachments
0574:                  JMenuItem currentActionAttachSubMenu = new JMenuItem(Language.getInstance().getText("Current_Action_Attachs"));
0575:                  currentActionAttachSubMenu.addActionListener(new ActionListener() {
0576:                      public void actionPerformed(ActionEvent e) {
0577:                      	int selectedRowIndex = actionsTable.getSelectedRow();
0578:                      	ArrayList dataList = actionsTableModel.getData(selectedRowIndex);
0579:                          Action action = testInExecution.getActionFromModel((String)dataList.get(0));
0580:                      	DataModel.setCurrentAction(action);
0581:                      	JDialog actionAttachsDialog = new JDialog(SalomeTMFContext.getInstance().ptrFrame, true);
0582:                          AttachmentView attachView = new AttachmentView(SalomeTMFContext.getInstance().getBaseIHM(), ACTION, ACTION, null, NORMAL_SIZE_FOR_ATTACH, actionAttachsDialog);
0583:                          attachView.setReadOnly();
0584:                          Container contentPaneFrame = actionAttachsDialog.getContentPane();
0585:                          contentPaneFrame.add(attachView, BorderLayout.CENTER);
0586:                          
0587:                          //actionAttachsDialog.setLocation(400,400);
0588:                          
0589:                          actionAttachsDialog.setTitle(Language.getInstance().getText("Attachements") + " (Test = " + testInExecution.getNameFromModel()+ ", " + "Action = " + action.getNameFromModel() + ")");
0590:                          actionAttachsDialog.pack();
0591:                          actionAttachsDialog.setLocation((t_x2 - contentPaneFrame.getSize().width)/2, (t_y2 - contentPaneFrame.getSize().height)/2);
0592:                          
0593:                          actionAttachsDialog.setVisible(true);
0594:                      }
0595:                  });
0596:                  attachMenu.add(currentActionAttachSubMenu);
0597:                 */
0598:
0599:                // Details sur le test
0600:                testDescription.setEditable(false);
0601:                JScrollPane testDescriptionScrollPane = new JScrollPane(
0602:                        testDescription, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
0603:                        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
0604:                //testDescriptionScrollPane.setPreferredSize(new Dimension(150, 100));
0605:                testDescriptionScrollPane.setBorder(BorderFactory
0606:                        .createTitledBorder(BorderFactory
0607:                                .createLineBorder(Color.BLACK), Language
0608:                                .getInstance().getText("Description_du_test")));
0609:                testDescriptionScrollPane.setMaximumSize(new Dimension(t_x / 3,
0610:                        t_y / 3)); //MM
0611:
0612:                // Table d'actions
0613:
0614:                actionsTableModel.addColumnNameAndColumn(Language.getInstance()
0615:                        .getText("Action"));
0616:                actionsTableModel.addColumnNameAndColumn(Language.getInstance()
0617:                        .getText("Attachement"));
0618:                actionsTableModel.addColumnNameAndColumn(Language.getInstance()
0619:                        .getText("Date"));
0620:                actionsTableModel.addColumnNameAndColumn(Language.getInstance()
0621:                        .getText("Statut"));
0622:
0623:                /*TableSorter  sorter = new TableSorter(actionsTableModel);
0624:                actionsTable.setModel(sorter);
0625:                sorter.setTableHeader(actionsTable.getTableHeader()); */
0626:                actionsTable.setModel(actionsTableModel);
0627:
0628:                //actionsTable.setPreferredScrollableViewportSize(new Dimension(700, 150));
0629:                actionsTable
0630:                        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
0631:
0632:                rowSM = actionsTable.getSelectionModel();
0633:                rowSM.addListSelectionListener(new ListSelectionListener() {
0634:                    public void valueChanged(ListSelectionEvent e) {
0635:                        if (e.getValueIsAdjusting())
0636:                            return;
0637:
0638:                        int selectedRowIndex = actionsTable.getSelectedRow();
0639:                        if (selectedRowIndex != -1
0640:                                && actionsTableModel.getRowCount() > 0) {
0641:                            if (blockIndex != -1
0642:                                    && selectedRowIndex > blockIndex) {
0643:                                selectedRowIndex = blockIndex;
0644:                                rowSM.setSelectionInterval(selectedRowIndex,
0645:                                        selectedRowIndex);
0646:                            }
0647:                            Rectangle rect = actionsTable.getCellRect(
0648:                                    selectedRowIndex, actionsTable
0649:                                            .getSelectedColumn(), false);
0650:                            actionsTable.scrollRectToVisible(rect);
0651:                            ArrayList dataList = actionsTableModel
0652:                                    .getData(selectedRowIndex);
0653:                            Action action = testInExecution
0654:                                    .getActionFromModel((String) dataList
0655:                                            .get(0));
0656:                            /*actionDescription.setText(Tools.getInstantiedDescription(action.getDescriptionFromModel(), currentExecution.getDataSetFromModel()));
0657:                            actionDescription.getCaret().setDot(0);
0658:                            awaitedResult.setText(Tools.getInstantiedDescription(action.getAwaitedResultFromModel(), currentExecution.getDataSetFromModel()));
0659:                            awaitedResult.getCaret().setDot(0);*/
0660:                            actionDescription.setText(Tools
0661:                                    .getInstantiedDescription(action
0662:                                            .getDescriptionFromModel(),
0663:                                            currentExecution));
0664:                            actionDescription.getCaret().setDot(0);
0665:                            awaitedResult.setText(Tools
0666:                                    .getInstantiedDescription(action
0667:                                            .getAwaitedResultFromModel(),
0668:                                            currentExecution));
0669:                            awaitedResult.getCaret().setDot(0);
0670:                            //effectiveResult.setText(execResult.getEffectivResult(action));
0671:                            effectiveResult.setText(execTestRes
0672:                                    .getEffectivResultFromModel(action));
0673:                            effectiveResult.getCaret().setDot(0);
0674:                        }
0675:                    }
0676:                });
0677:
0678:                // Mapping entre objets graphiques et constantes
0679:                SalomeTMFContext.getInstance().addToUIComponentsMap(
0680:                        UICompCst.MANUAL_EXECUTION_ACTIONS_TABLE, actionsTable);
0681:                // Activation des plugins associés
0682:                PluginsTools
0683:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_ACTIONS_TABLE);
0684:
0685:                JScrollPane actionsTableScrollPane = new JScrollPane(
0686:                        actionsTable);
0687:                actionsTableScrollPane.setBorder(BorderFactory
0688:                        .createTitledBorder(BorderFactory
0689:                                .createLineBorder(Color.BLACK), Language
0690:                                .getInstance().getText("Actions")));
0691:                actionsTableScrollPane.setMinimumSize(new Dimension(t_x / 2,
0692:                        t_y / 3)); //MM
0693:
0694:                //actionsTableScrollPane.setMaximumSize(new Dimension(t_x/2,t_y/3)); //MM
0695:
0696:                //actionsTableScrollPane.setPreferredSize(new Dimension(200,250)); //MM
0697:
0698:                // Details sur les actions
0699:                actionDescription.setEditable(false);
0700:                JScrollPane actionDescriptionScrollPane = new JScrollPane(
0701:                        actionDescription);
0702:                actionDescriptionScrollPane.setBorder(BorderFactory
0703:                        .createTitledBorder(BorderFactory
0704:                                .createLineBorder(Color.BLACK), Language
0705:                                .getInstance().getText(
0706:                                        "Description_de_l'action")));
0707:                actionDescriptionScrollPane.setMinimumSize(new Dimension(t_x,
0708:                        t_y / 3)); //MM
0709:
0710:                awaitedResult.setEditable(false);
0711:                JScrollPane awaitedResultScrollPane = new JScrollPane(
0712:                        awaitedResult);
0713:                awaitedResultScrollPane.setBorder(BorderFactory
0714:                        .createTitledBorder(BorderFactory
0715:                                .createLineBorder(Color.BLACK), Language
0716:                                .getInstance().getText("Résultat_attendu")));
0717:                awaitedResultScrollPane.setMinimumSize(new Dimension(t_x / 2,
0718:                        t_y / 3)); //MM
0719:
0720:                effectiveResult.addCaretListener(new EffectivResultListener());
0721:                JScrollPane effectiveResultScrollPane = new JScrollPane(
0722:                        effectiveResult);
0723:                effectiveResultScrollPane.setBorder(BorderFactory
0724:                        .createTitledBorder(BorderFactory
0725:                                .createLineBorder(Color.BLACK), Language
0726:                                .getInstance().getText("Résultat_effectif")));
0727:                effectiveResultScrollPane.setMinimumSize(new Dimension(t_x / 2,
0728:                        t_y / 3)); //MM
0729:
0730:                // Construction de la fen?tre
0731:                JPanel buttonsPanel = new JPanel();
0732:                buttonsPanel.setLayout(new BoxLayout(buttonsPanel,
0733:                        BoxLayout.X_AXIS));
0734:
0735:                JPanel basicbuttonPanel = new JPanel(new GridLayout(1, 8));
0736:                int bouton_x = 120;
0737:                int bouton_y = 30;
0738:                statusOkButton
0739:                        .setMinimumSize(new Dimension(t_x / 10, bouton_y));
0740:                statusOkButton
0741:                        .setMaximumSize(new Dimension(t_x2 / 10, bouton_y));
0742:                buttonsPanel.add(statusOkButton);
0743:
0744:                statusFailedButton.setMinimumSize(new Dimension(t_x / 10,
0745:                        bouton_y));
0746:                statusFailedButton.setMaximumSize(new Dimension(t_x2 / 10,
0747:                        bouton_y));
0748:                buttonsPanel.add(statusFailedButton);
0749:
0750:                statusUnknowButton.setMinimumSize(new Dimension(t_x / 10,
0751:                        bouton_y));
0752:                statusUnknowButton.setMaximumSize(new Dimension(t_x2 / 10,
0753:                        bouton_y));
0754:                buttonsPanel.add(statusUnknowButton);
0755:                buttonsPanel.add(Box.createRigidArea(new Dimension(t_x / 20,
0756:                        bouton_y)));
0757:
0758:                prevTestButton
0759:                        .setMinimumSize(new Dimension(t_x / 10, bouton_y));
0760:                prevTestButton
0761:                        .setMaximumSize(new Dimension(t_x2 / 10, bouton_y));
0762:                buttonsPanel.add(prevTestButton);
0763:
0764:                nextTestButton
0765:                        .setMinimumSize(new Dimension(t_x / 10, bouton_y));
0766:                nextTestButton
0767:                        .setMaximumSize(new Dimension(t_x2 / 10, bouton_y));
0768:                buttonsPanel.add(nextTestButton);
0769:
0770:                endButton.setMinimumSize(new Dimension(t_x / 10, bouton_y));
0771:                endButton.setMaximumSize(new Dimension(t_x2 / 10, bouton_y));
0772:                buttonsPanel.add(endButton);
0773:
0774:                buttonsPanel.add(Box.createRigidArea(new Dimension(t_x / 20,
0775:                        bouton_y)));
0776:
0777:                screenShootButton.setMinimumSize(new Dimension(t_x / 20,
0778:                        bouton_y));
0779:                screenShootButton.setMaximumSize(new Dimension(t_x2 / 20,
0780:                        bouton_y));
0781:                buttonsPanel.add(screenShootButton);
0782:
0783:                /* JMenuBar attachsMenuBar = new JMenuBar();
0784:                 attachsMenuBar.add(attachMenu);
0785:                 buttonsPanel.add(attachsMenuBar);
0786:                 */
0787:
0788:                // Menu for bugtrackers
0789:                //Vector bugTrackers = SalomeTMFContext.getInstance().bugTrackerExtensions; 
0790:                Vector bugTrackers = SalomeTMFContext.getInstance()
0791:                        .getBugTracker();
0792:                if (bugTrackers.size() != 0) {
0793:                    JMenu bugTrackMenu = new JMenu(Language.getInstance()
0794:                            .getText("add_bug"));
0795:                    for (int i = 0; i < bugTrackers.size(); i++) {
0796:                        //final BugTracker bugTracker = (BugTracker)SalomeTMFContext.getInstance().bugTrackers.elementAt(i);
0797:                        final BugTracker bugTracker = (BugTracker) bugTrackers
0798:                                .elementAt(i);
0799:                        JMenuItem bugTrackerItem = new JMenuItem(bugTracker
0800:                                .getBugTrackerName());
0801:                        bugTrackerItem.addActionListener(new ActionListener() {
0802:                            public void actionPerformed(ActionEvent e) {
0803:                                int selectedRowIndex = actionsTable
0804:                                        .getSelectedRow();
0805:                                ArrayList dataList = actionsTableModel
0806:                                        .getData(selectedRowIndex);
0807:                                Action action = testInExecution
0808:                                        .getActionFromModel((String) dataList
0809:                                                .get(0));
0810:                                new AskNewBug(ManualExecution.this , bugTracker,
0811:                                        true, action.getNameFromModel(),
0812:                                        actionDescription.getText(),
0813:                                        awaitedResult.getText(),
0814:                                        effectiveResult.getText());
0815:
0816:                            }
0817:                        });
0818:
0819:                        if (!bugTracker.isUserExistsInBugDB()) {
0820:                            bugTrackerItem.setEnabled(false);
0821:                        }
0822:                        bugTrackMenu.add(bugTrackerItem);
0823:                    }
0824:                    JMenuBar menuBar = new JMenuBar();
0825:                    menuBar.add(bugTrackMenu);
0826:                    buttonsPanel.add(menuBar);
0827:                }
0828:
0829:                // Mapping entre objets graphiques et constantes
0830:                SalomeTMFContext.getInstance().addToUIComponentsMap(
0831:                        UICompCst.MANUAL_EXECUTION_BUTTONS_PANEL, buttonsPanel);
0832:                // Activation des plugins associ?es
0833:                PluginsTools
0834:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_BUTTONS_PANEL);
0835:
0836:                JPanel testDetailsPanel = new JPanel();
0837:                /*testDetailsPanel.setLayout(new BoxLayout(testDetailsPanel, BoxLayout.Y_AXIS));
0838:                testDetailsPanel.add(testName);
0839:                testDetailsPanel.add(Box.createRigidArea(new Dimension(1,10)));
0840:                testDetailsPanel.add(testDescriptionScrollPane);
0841:                 */
0842:
0843:                JPanel actionsResults = new JPanel();
0844:                actionsResults.setLayout(new BoxLayout(actionsResults,
0845:                        BoxLayout.X_AXIS));
0846:                actionsResults.add(awaitedResultScrollPane);
0847:                actionsResults.add(effectiveResultScrollPane);
0848:
0849:                /*JPanel actionsDetailsPanel = new JPanel(new BorderLayout());
0850:                actionsDetailsPanel.add(actionDescriptionScrollPane, BorderLayout.NORTH);
0851:                actionsDetailsPanel.add(actionsResults, BorderLayout.SOUTH);
0852:                 */
0853:                JPanel actionsDetailsPanel = new JPanel();
0854:                actionsDetailsPanel.setLayout(new BoxLayout(
0855:                        actionsDetailsPanel, BoxLayout.Y_AXIS));
0856:                actionsDetailsPanel.add(actionDescriptionScrollPane);
0857:                actionsDetailsPanel.add(actionsResults);
0858:
0859:                /*JPanel showTestPanel = new JPanel(new BorderLayout());
0860:                showTestPanel.add(testDetailsPanel, BorderLayout.WEST);
0861:                showTestPanel.add(actionsTableScrollPane, BorderLayout.CENTER);
0862:                 */
0863:
0864:                JPanel showTestPanel = new JPanel(new BorderLayout());
0865:
0866:                JPanel showTestPanel2 = new JPanel();
0867:                showTestPanel2.setLayout(new BoxLayout(showTestPanel2,
0868:                        BoxLayout.X_AXIS));
0869:                //showTestPanel.add(testDetailsPanel);
0870:                showTestPanel2.add(testDescriptionScrollPane);
0871:                showTestPanel2.add(actionsTableScrollPane);
0872:
0873:                showTestPanel.add(testName, BorderLayout.NORTH);
0874:                showTestPanel.add(showTestPanel2, BorderLayout.CENTER);
0875:
0876:                /*
0877:                contentPaneFrame.add(actionsDetailsPanel, BorderLayout.SOUTH);
0878:                contentPaneFrame.add(showTestPanel, BorderLayout.CENTER);
0879:                contentPaneFrame.add(buttonsPanel, BorderLayout.NORTH);
0880:                 */
0881:                initData(testList, execution, executionResult);
0882:                if (contineExec) {
0883:                    setFirstTestWithNoResult();
0884:                }
0885:                setSize(t_x, t_y);
0886:
0887:                pJTabbedPane = new JTabbedPane();
0888:
0889:                JPanel mainPanel = new JPanel();
0890:                mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
0891:                buttonsPanel.setMaximumSize(new Dimension(t_x2, 55));
0892:                mainPanel.add(buttonsPanel);
0893:                //nom du test
0894:                //mainPanel.add(testName);
0895:                showTestPanel.setPreferredSize(new Dimension(t_x, t_y / 3));
0896:                mainPanel.add(showTestPanel);
0897:                actionsDetailsPanel.setPreferredSize(new Dimension(t_x,
0898:                        t_y / 3 * 2));
0899:                mainPanel.add(actionsDetailsPanel);
0900:                pJTabbedPane.add(Language.getInstance().getText("Test"),
0901:                        mainPanel);
0902:
0903:                /****** Attachement en panel ***********/
0904:                resExecTestAttachmentPanel = new AttachmentView(DataModel
0905:                        .getApplet(), EXECUTION_RESULT_TEST,
0906:                        EXECUTION_RESULT_TEST, execTestRes,
0907:                        SMALL_SIZE_FOR_ATTACH, this );
0908:                resExecTestAttachmentPanel.setBorder(BorderFactory
0909:                        .createTitledBorder(BorderFactory
0910:                                .createLineBorder(Color.BLACK), Language
0911:                                .getInstance().getText("Attachements")));
0912:                pJTabbedPane.add(resExecTestAttachmentPanel, Language
0913:                        .getInstance().getText("Res_Exec_Attachs"));
0914:
0915:                testAttachmentPanel = new AttachmentView(DataModel.getApplet(),
0916:                        TEST, TEST, null, SMALL_SIZE_FOR_ATTACH, this );
0917:                testAttachmentPanel.setReadOnly();
0918:                pJTabbedPane.add(testAttachmentPanel, Language.getInstance()
0919:                        .getText("Current_Test_Attachs"));
0920:
0921:                actionAttachmentPanel = new AttachmentView(DataModel
0922:                        .getApplet(), ACTION, ACTION, null,
0923:                        NORMAL_SIZE_FOR_ATTACH, this );
0924:                actionAttachmentPanel.setReadOnly();
0925:                pJTabbedPane.add(actionAttachmentPanel, Language.getInstance()
0926:                        .getText("Current_Action_Attachs"));
0927:
0928:                pJTabbedPane.addChangeListener(new ChangeListener() {
0929:                    public void stateChanged(ChangeEvent e) {
0930:                        if (pJTabbedPane.getSelectedComponent().equals(
0931:                                resExecTestAttachmentPanel)) {
0932:                            //DataModel.getCurrentExecutionTestResult()
0933:                            resExecTestAttachmentPanel
0934:                                    .setAttachmentObject(DataModel
0935:                                            .getCurrentExecutionTestResult());
0936:                        } else if (pJTabbedPane.getSelectedComponent().equals(
0937:                                testAttachmentPanel)) {
0938:                            DataModel.setCurrentTest(testInExecution);
0939:                            testAttachmentPanel
0940:                                    .setAttachmentObject(testInExecution);
0941:                        } else if (pJTabbedPane.getSelectedComponent().equals(
0942:                                actionAttachmentPanel)) {
0943:                            int selectedRowIndex = actionsTable
0944:                                    .getSelectedRow();
0945:                            ArrayList dataList = actionsTableModel
0946:                                    .getData(selectedRowIndex);
0947:                            Action action = testInExecution
0948:                                    .getActionFromModel((String) dataList
0949:                                            .get(0));
0950:                            DataModel.setCurrentAction(action);
0951:                            actionAttachmentPanel.setAttachmentObject(action);
0952:                        }
0953:                    }
0954:                });
0955:                /**************************************/
0956:
0957:                contentPaneFrame = this .getContentPane();
0958:                contentPaneFrame.add(pJTabbedPane);
0959:
0960:                SalomeTMFContext.getInstance().addToUIComponentsMap(
0961:                        UICompCst.MANUAL_EXECUTION_TAB, pJTabbedPane);
0962:                PluginsTools
0963:                        .activateAssociatedPlgs(UICompCst.MANUAL_EXECUTION_TAB);
0964:
0965:                /*contentPaneFrame = this.getContentPane();
0966:                contentPaneFrame.setLayout(new BoxLayout(contentPaneFrame, BoxLayout.Y_AXIS));
0967:                buttonsPanel.setMaximumSize(new Dimension(t_x2, 55));
0968:                contentPaneFrame.add(buttonsPanel); 
0969:                showTestPanel.setPreferredSize(new Dimension(t_x, t_y/3));
0970:                contentPaneFrame.add(showTestPanel);
0971:                actionsDetailsPanel.setPreferredSize(new Dimension(t_x, t_y/3*2 ));
0972:                contentPaneFrame.add(actionsDetailsPanel);
0973:                 */
0974:
0975:                if (actionsTableModel.getRowCount() > 0) {
0976:                    rowSM.setSelectionInterval(0, 0);
0977:                }
0978:
0979:                this .addWindowListener(new WindowListener() {
0980:                    public void windowClosing(WindowEvent e) {
0981:
0982:                        testStatusCalculation();
0983:                        //execView.libere();
0984:                        //execResult.setExecutionStatus(INTERRUPT);
0985:                        stop_exec = true;
0986:                        finished = true;
0987:                    }
0988:
0989:                    public void windowDeiconified(WindowEvent e) {
0990:                    }
0991:
0992:                    public void windowOpened(WindowEvent e) {
0993:                    }
0994:
0995:                    public void windowActivated(WindowEvent e) {
0996:                    }
0997:
0998:                    public void windowDeactivated(WindowEvent e) {
0999:                    }
1000:
1001:                    public void windowClosed(WindowEvent e) {
1002:                    }
1003:
1004:                    public void windowIconified(WindowEvent e) {
1005:                    }
1006:                });
1007:
1008:                title = Language.getInstance().getText(
1009:                        "Execution_d'un_test_manuel_(exéc._en_cours_:_")
1010:                        + execution.getNameFromModel() + ")";
1011:                this .setTitle(title + ", test : "
1012:                        + testInExecution.getNameFromModel());
1013:
1014:                /*this.setLocation(50,50);
1015:                this.pack();
1016:                 */
1017:                centerScreen();
1018:            } // Fin du constructeur ManualExecution/0
1019:
1020:            void centerScreen() {
1021:                Dimension dim = getToolkit().getScreenSize();
1022:                this .pack();
1023:                Rectangle abounds = getBounds();
1024:                setLocation((dim.width - abounds.width) / 2,
1025:                        (dim.height - abounds.height) / 2);
1026:                //this.setVisible(true); 
1027:                requestFocus();
1028:            }
1029:
1030:            /**
1031:             * M?thode qui initialise l'ex?cution avec la liste des tests pass?e en
1032:             * param?tre
1033:             * @param list une liste de tests
1034:             */
1035:            public void initData(ArrayList list, Execution execution,
1036:                    ExecutionResult executionResult) {
1037:
1038:                execResult = executionResult;
1039:
1040:                currentExecution = execution;
1041:                int transNumber = -1;
1042:                try {
1043:                    transNumber = Api.beginTransaction(111,
1044:                            ApiConstants.LOADING);
1045:                    ProgressBar pProgressBar = new ProgressBar("Data Loading",
1046:                            "", list.size() + 1);
1047:                    pProgressBar.show();
1048:                    if (list != null && list.size() > 0) {
1049:                        testsToBeExecuted = list;
1050:                        indexOfTextInExecution = 0;
1051:                        blockIndex = 0;
1052:                        testInExecution = (ManualTest) testsToBeExecuted.get(0);
1053:                        this .setTitle(title + ", test : "
1054:                                + testInExecution.getNameFromModel());
1055:                        //DataModel.setCurrentExecutionTestResult(execResult.getExecutionTestResultFromModel(testInExecution));
1056:                        execTestRes = (ManualExecutionResult) execResult
1057:                                .getExecutionTestResultFromModel(testInExecution); //Add FOR V2
1058:                        DataModel.setCurrentExecutionTestResult(execTestRes);
1059:                        testName.setText(Language.getInstance().getText(
1060:                                "Nom_du_test_:_")
1061:                                + testInExecution.getNameFromModel());
1062:                        testDescription.setText(testInExecution
1063:                                .getDescriptionFromModel());
1064:                        ArrayList actionList = testInExecution
1065:                                .getActionListFromModel(false);
1066:                        pProgressBar.doTask("Load action");
1067:                        for (int i = 0; i < actionList.size(); i++) {
1068:                            Action action = (Action) actionList.get(i);
1069:                            ArrayList actionData = new ArrayList();
1070:                            actionData.add(action.getNameFromModel());
1071:                            actionData.add(action.getAttachmentMapFromModel()
1072:                                    .keySet());
1073:                            actionData.add(GregorianCalendar.getInstance()
1074:                                    .getTime().toString());
1075:                            /*actionData.add(Tools.getActionStatusIcon(execResult.getActionStatus(action)));
1076:                            if (execResult.getActionStatus(action) != null && !execResult.getActionStatus(action).equals("")) {
1077:                                blockIndex = blockIndex + 1;
1078:                            }*/
1079:                            actionData.add(Tools
1080:                                    .getActionStatusIcon(execTestRes
1081:                                            .getActionStatusInModel(action)));
1082:                            if (execTestRes.getActionStatusInModel(action) != null
1083:                                    && !execTestRes.getActionStatusInModel(
1084:                                            action).equals("")) {
1085:                                blockIndex = blockIndex + 1;
1086:                            }
1087:                            actionsTableModel.addRow(actionData);
1088:                        }
1089:                        for (int i = 0; i < list.size(); i++) {
1090:                            pProgressBar.doTask("Load action");
1091:                            ManualTest test = (ManualTest) list.get(i);
1092:                            //ADD FOR V2
1093:                            ManualExecutionResult pExecTestRes = (ManualExecutionResult) execResult
1094:                                    .getExecutionTestResultFromModel(test);
1095:                            ArrayList actionList2 = test
1096:                                    .getActionListFromModel(false);
1097:                            for (int j = 0; j < actionList2.size(); j++) {
1098:                                Action action = (Action) actionList2.get(j);
1099:                                //pExecTestRes.addDescriptionResultInModel(action, Tools.getInstantiedDescription(action.getDescriptionFromModel(), currentExecution.getDataSetFromModel()));
1100:                                //pExecTestRes.addAwaitedResultInModel(action, Tools.getInstantiedDescription(action.getAwaitedResultFromModel(), currentExecution.getDataSetFromModel()));
1101:                                pExecTestRes.addDescriptionResultInModel(
1102:                                        action,
1103:                                        Tools.getInstantiedDescription(action
1104:                                                .getDescriptionFromModel(),
1105:                                                currentExecution));
1106:                                pExecTestRes.addAwaitedResultInModel(action,
1107:                                        Tools.getInstantiedDescription(action
1108:                                                .getAwaitedResultFromModel(),
1109:                                                currentExecution));
1110:                            }
1111:                        }
1112:                    }
1113:                    Api.commitTrans(transNumber);
1114:                    transNumber = -1;
1115:                    pProgressBar.finishAllTask();
1116:                } catch (Exception e) {
1117:                    Api.forceRollBackTrans(transNumber);
1118:                }
1119:            } // Fin de la m?thode initData/1
1120:
1121:            void setFirstTestWithNoResult() {
1122:                if (testsToBeExecuted.size() > 1) {
1123:                    testInExecution = (ManualTest) testsToBeExecuted
1124:                            .get(indexOfTextInExecution);
1125:                    ExecutionTestResult pExecutionTestResult = execResult
1126:                            .getExecutionTestResultFromModel(testInExecution);
1127:                    String status = pExecutionTestResult.getStatusFromModel();
1128:                    while ((indexOfTextInExecution + 1) < testsToBeExecuted
1129:                            .size()
1130:                            && status != null && !status.equals("")) {
1131:                        changeTest();
1132:                        testInExecution = (ManualTest) testsToBeExecuted
1133:                                .get(indexOfTextInExecution);
1134:                        pExecutionTestResult = execResult
1135:                                .getExecutionTestResultFromModel(testInExecution);
1136:                        status = pExecutionTestResult.getStatusFromModel();
1137:                    }
1138:                }
1139:            }
1140:
1141:            /**
1142:             * M?thode qui permet de passer au test suivant.
1143:             */
1144:            public void changeTest() {
1145:                if (testsToBeExecuted.size() > 1) {
1146:                    prevTestButton.setEnabled(true);
1147:                }
1148:                if ((indexOfTextInExecution + 1) == (testsToBeExecuted.size() - 1)) {
1149:
1150:                    nextTestButton.setEnabled(false);
1151:                }
1152:                testStatusCalculation();
1153:                if ((indexOfTextInExecution + 1) < testsToBeExecuted.size()) {
1154:
1155:                    indexOfTextInExecution++;
1156:                    testInExecution = (ManualTest) testsToBeExecuted
1157:                            .get(indexOfTextInExecution);
1158:                    this .setTitle(title + ", test : "
1159:                            + testInExecution.getNameFromModel());
1160:
1161:                    DataModel.setCurrentExecutionTestResult(execResult
1162:                            .getExecutionTestResultFromModel(testInExecution));
1163:                    //NEW FOR V2
1164:                    execTestRes = (ManualExecutionResult) execResult
1165:                            .getExecutionTestResultFromModel(testInExecution);
1166:
1167:                    testName.setText(Language.getInstance().getText(
1168:                            "Nom_du_test_:_")
1169:                            + testInExecution.getNameFromModel());
1170:                    testDescription.setText(testInExecution
1171:                            .getDescriptionFromModel());
1172:                    actionsTableModel.clearTable();
1173:                    ArrayList actionList = testInExecution
1174:                            .getActionListFromModel(false);
1175:                    if (actionList != null && actionList.size() > 0) {
1176:                        for (int i = 0; i < actionList.size(); i++) {
1177:                            Action action = (Action) actionList.get(i);
1178:                            ArrayList actionData = new ArrayList();
1179:                            actionData.add(action.getNameFromModel());
1180:                            actionData.add(action.getAttachmentMapFromModel()
1181:                                    .keySet());
1182:                            actionData.add(GregorianCalendar.getInstance()
1183:                                    .getTime().toString());
1184:                            //putIconStatusInTable(actionData, execResult.getActionStatus(action), i);
1185:                            putIconStatusInTable(actionData, execTestRes
1186:                                    .getActionStatusInModel(action), i);
1187:                            actionsTableModel.addRow(actionData);
1188:                        }
1189:                    } else {
1190:                        /* clear INFO */
1191:                        actionDescription.setText("");
1192:                        actionDescription.getCaret().setDot(0);
1193:                        awaitedResult.setText("");
1194:                        awaitedResult.getCaret().setDot(0);
1195:                        //effectiveResult.setText(execResult.getEffectivResult(action));
1196:                        effectiveResult.setText("");
1197:                        effectiveResult.getCaret().setDot(0);
1198:                    }
1199:                    ListSelectionModel lsm = actionsTable.getSelectionModel();
1200:                    lsm.setSelectionInterval(0, 0);
1201:
1202:                } else if ((indexOfTextInExecution + 1) == testsToBeExecuted
1203:                        .size()) {
1204:
1205:                }
1206:
1207:            } // Fin de la m?thode changeTest/0
1208:
1209:            /**
1210:             * M?thode qui permet de passer au test pr?c?dant.
1211:             */
1212:            public void changeTestBack() {
1213:                if (testsToBeExecuted.size() > 1) {
1214:                    nextTestButton.setEnabled(true);
1215:                }
1216:                if ((indexOfTextInExecution - 1) == 0) {
1217:                    prevTestButton.setEnabled(false);
1218:                }
1219:                testStatusCalculation();
1220:                if ((indexOfTextInExecution - 1) > -1) {
1221:                    indexOfTextInExecution--;
1222:                    testInExecution = (ManualTest) testsToBeExecuted
1223:                            .get(indexOfTextInExecution);
1224:                    DataModel.setCurrentExecutionTestResult(execResult
1225:                            .getExecutionTestResultFromModel(testInExecution));
1226:                    this .setTitle(title + ", test : "
1227:                            + testInExecution.getNameFromModel());
1228:                    //NEW FOR V2
1229:                    execTestRes = (ManualExecutionResult) execResult
1230:                            .getExecutionTestResultFromModel(testInExecution);
1231:                    testName.setText(Language.getInstance().getText(
1232:                            "Nom_du_test_:_")
1233:                            + testInExecution.getNameFromModel());
1234:                    testDescription.setText(testInExecution
1235:                            .getDescriptionFromModel());
1236:                    actionsTableModel.clearTable();
1237:                    ArrayList actionList = testInExecution
1238:                            .getActionListFromModel(false);
1239:                    for (int i = 0; i < actionList.size(); i++) {
1240:                        Action action = (Action) actionList.get(i);
1241:                        ArrayList actionData = new ArrayList();
1242:                        actionData.add(action.getNameFromModel());
1243:                        actionData.add(action.getAttachmentMapFromModel()
1244:                                .keySet());
1245:                        actionData.add(GregorianCalendar.getInstance()
1246:                                .getTime().toString());
1247:                        //putIconStatusInTable(actionData, execResult.getActionStatus(action), i);
1248:                        putIconStatusInTable(actionData, execTestRes
1249:                                .getActionStatusInModel(action), i);
1250:                        actionsTableModel.addRow(actionData);
1251:                    }
1252:                    ListSelectionModel lsm = actionsTable.getSelectionModel();
1253:                    lsm.setSelectionInterval(0, 0);
1254:
1255:                }
1256:
1257:            } // Fin de la m?thode changeTestBack/0
1258:
1259:            /**
1260:             * M?thode qui retourne le r?sultat de l'ex?cution
1261:             * @return le r?sultat de l'ex?cution
1262:             */
1263:            public ExecutionResult getExecutionResult() {
1264:                return execResult;
1265:            } // Fin de la m?thode getExecutionResult/0
1266:
1267:            /**
1268:             *
1269:             * @param data
1270:             * @param type
1271:             * @param index
1272:             */
1273:            public void putIconStatusInTable(ArrayList data, String type,
1274:                    int index) {
1275:                ImageIcon icon = getActionStatusIcon(type, index);
1276:                if (icon != null) {
1277:                    data.add(icon);
1278:                } else {
1279:                    data.add("");
1280:                }
1281:            } // Fin de la m?thode putIconStatusInTable/2
1282:
1283:            /**
1284:             * Retourne l'icone associ?e au type pass? au param?tre. On retourne <code>null</code>
1285:             * si le type n'est pas SUCCESS, FAIL ou UNKNOW.
1286:             * @param type
1287:             * @param index
1288:             * @return
1289:             */
1290:            public ImageIcon getActionStatusIcon(String type, int index) {
1291:                if (type.equals(SUCCESS)) {
1292:                } else if (type.equals(FAIL)) {
1293:                    blockIndex = index;
1294:                } else if (type.equals(UNKNOWN)) {
1295:                    blockIndex = index;
1296:                }
1297:                return Tools.getActionStatusIcon(type);
1298:            } // Fin de la m?thode getActionStatusIcon/1
1299:
1300:            /**
1301:             *
1302:             *
1303:             */
1304:            public void testStatusCalculation() {
1305:                int successAction = 0;
1306:                ArrayList actionList = testInExecution
1307:                        .getActionListFromModel(false);
1308:                for (int i = 0; i < actionList.size(); i++) {
1309:                    /*if (execResult.getActionStatus(((Action)actionList.get(i))).equals(FAIL)) {
1310:                        execResult.addTestResultStatusInModel(testInExecution, FAIL);
1311:                        return;
1312:                    } else if (execResult.getActionStatus(((Action)actionList.get(i))).equals(UNKNOWN)) {
1313:                        execResult.addTestResultStatusInModel(testInExecution, UNKNOWN);
1314:                        return;
1315:                    } else if (execResult.getActionStatus(((Action)actionList.get(i))).equals(SUCCESS)) {
1316:                        successAction++;
1317:                    }*/
1318:                    if (execTestRes.getActionStatusInModel(
1319:                            ((Action) actionList.get(i))).equals(FAIL)) {
1320:                        execResult.addTestResultStatusInModel(testInExecution,
1321:                                FAIL);
1322:                        return;
1323:                    } else if (execTestRes.getActionStatusInModel(
1324:                            ((Action) actionList.get(i))).equals(UNKNOWN)) {
1325:                        execResult.addTestResultStatusInModel(testInExecution,
1326:                                UNKNOWN);
1327:                        return;
1328:                    } else if (execTestRes.getActionStatusInModel(
1329:                            ((Action) actionList.get(i))).equals(SUCCESS)) {
1330:                        successAction++;
1331:                    }
1332:
1333:                }
1334:                if (successAction == actionList.size()) {
1335:                    execResult.addTestResultStatusInModel(testInExecution,
1336:                            SUCCESS);
1337:                    return;
1338:                }
1339:                execResult.addTestResultStatusInModel(testInExecution, "");
1340:            } // Fin de la m?thode testStatusCalculation/0
1341:
1342:            /**
1343:             * Calcule l'index de bloquage de la s?lection.
1344:             */
1345:            private void blockIndexCalculation(int selectedRowIndex) {
1346:                ArrayList actionList = testInExecution
1347:                        .getActionListFromModel(false);
1348:                blockIndex = selectedRowIndex + 1;
1349:
1350:                /*while (blockIndex < actionList.size() && !execResult.getActionStatus(((Action)actionList.get(blockIndex))).equals("")) {
1351:                    blockIndex++;
1352:                }*/
1353:                while (blockIndex < actionList.size()
1354:                        && !execTestRes.getActionStatusInModel(
1355:                                ((Action) actionList.get(blockIndex))).equals(
1356:                                "")) {
1357:                    blockIndex++;
1358:                }
1359:
1360:            } // Fin de la m?thode blockIndexCalculation/0
1361:
1362:            /**
1363:             * Retourne la liste des attachements ? supprimer
1364:             * @return
1365:             */
1366:            public HashMap getOldAttachMap() {
1367:                return oldMap;
1368:            } // Fin de la m?thode getOldAttachMap/0
1369:
1370:            /**
1371:             *
1372:             * @author teaml039
1373:             */
1374:            public class EffectivResultListener implements  CaretListener {
1375:
1376:                /* (non-Javadoc)
1377:                 * @see javax.swing.event.CaretListener#caretUpdate(javax.swing.event.CaretEvent)
1378:                 */
1379:                public void caretUpdate(CaretEvent e) {
1380:                    int selectedRowIndex = actionsTable.getSelectedRow();
1381:                    /*if (selectedRowIndex != -1) {
1382:                        execResult.addEffectivResult(testInExecution.getActionFromModel((String)actionsTableModel.getValueAt(selectedRowIndex, 0)), ((JTextPane)e.getSource()).getText());
1383:                    }*/
1384:                    if (selectedRowIndex != -1) {
1385:                        execTestRes.addEffectivResultInModel(testInExecution
1386:                                .getActionFromModel((String) actionsTableModel
1387:                                        .getValueAt(selectedRowIndex, 0)),
1388:                                ((JTextPane) e.getSource()).getText());
1389:                    }
1390:                }
1391:            } // Fin de la classe EffectivResultListener
1392:
1393:            public void lauchManualExecution() {
1394:                t = new Thread(this );
1395:                stop_exec = false;
1396:                t.start();
1397:            }
1398:
1399:            public void run() {
1400:                this .setVisible(true);
1401:            }
1402:
1403:            public boolean isStoped() {
1404:                return stop_exec;
1405:            }
1406:
1407:            public boolean isFinished() {
1408:                return finished;
1409:            }
1410:
1411:            public void setFinished(boolean b) {
1412:                finished = b;
1413:            }
1414:
1415:            /************************** ScreenShot *********************/
1416:
1417:            JDialog takeScreenShoot;
1418:            boolean screenShootValided = false;
1419:
1420:            public void screeshootFrame(java.awt.event.ActionEvent e) {
1421:                screenShootValided = false;
1422:                takeScreenShoot = new JDialog();
1423:                takeScreenShoot.setResizable(false);
1424:                takeScreenShoot.setTitle("Capture Screen");
1425:                JButton screeshootButton2 = new JButton();
1426:                ImageIcon icon = Tools.createAppletImageIcon(
1427:                        PATH_TO_SCREENSHOT_ICON, "");
1428:                screeshootButton2.setIcon(icon);
1429:                screeshootButton2.setMinimumSize(new Dimension(icon
1430:                        .getIconWidth(), icon.getIconHeight()));
1431:                //takeScreenShoot.setSize(new Dimension(icon.getIconWidth(),icon.getIconHeight()));
1432:                screeshootButton2.addActionListener(new ActionListener() {
1433:                    public void actionPerformed(java.awt.event.ActionEvent e) {
1434:                        screenShootValided = true;
1435:                        takeScreenShoot.dispose();
1436:                        screeshootPerformed(DataModel
1437:                                .getCurrentExecutionTestResult());
1438:                        //SalomeTMFContext.getInstance().getSalomeFrame().setVisible(true);	
1439:                        setVisible(true);
1440:                    }
1441:                });
1442:
1443:                takeScreenShoot.addWindowListener(new WindowListener() {
1444:                    public void windowActivated(WindowEvent e) {
1445:                    }
1446:
1447:                    public void windowClosed(WindowEvent e) {
1448:
1449:                    }
1450:
1451:                    public void windowClosing(WindowEvent e) {
1452:                        if (!screenShootValided) {
1453:                            screenShootValided = true;
1454:                            takeScreenShoot.dispose();
1455:                            setVisible(true);
1456:                        }
1457:                    }
1458:
1459:                    public void windowDeactivated(WindowEvent e) {
1460:                        takeScreenShoot.toFront();
1461:                    }
1462:
1463:                    public void windowDeiconified(WindowEvent e) {
1464:                    }
1465:
1466:                    public void windowIconified(WindowEvent e) {
1467:                        takeScreenShoot.toFront();
1468:                    }
1469:
1470:                    public void windowOpened(WindowEvent e) {
1471:                    }
1472:
1473:                });
1474:                //SalomeTMFContext.getInstance().getSalomeFrame().setVisible(false);
1475:                setVisible(false);
1476:                takeScreenShoot.getContentPane().add(screeshootButton2);
1477:                takeScreenShoot.pack();
1478:                takeScreenShoot.setVisible(true);
1479:
1480:            }
1481:
1482:            public void screeshootPerformed(WithAttachment withAttachment) {
1483:                if (withAttachment == null) {
1484:                    return;
1485:                }
1486:                try {
1487:                    FileAttachment fileAttachment = withAttachment
1488:                            .takeScreenShot();
1489:                    withAttachment.addAttachementInModel(fileAttachment);
1490:
1491:                } catch (Exception ex1) {
1492:                    JOptionPane.showMessageDialog(ManualExecution.this ,
1493:                            Language.getInstance().getText("Le_fichier_")
1494:                                    + "Screenshot "
1495:                                    + Language.getInstance().getText(
1496:                                            "_est_déjà_attaché_à_")
1497:                                    + withAttachment.getNameFromModel() + " !",
1498:                            Language.getInstance().getText("Erreur_!"),
1499:                            JOptionPane.ERROR_MESSAGE);
1500:                }
1501:            }
1502:        } // Fin de la classe ManualExecution
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.