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


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package org.objectweb.salome_tmf.ihm.main;
025:
026:        import java.awt.BorderLayout;
027:        import java.awt.Container;
028:        import java.awt.Dimension;
029:        import java.awt.FlowLayout;
030:        import java.awt.Font;
031:        import java.awt.Rectangle;
032:        import java.awt.event.ActionEvent;
033:        import java.awt.event.ActionListener;
034:        import java.util.ArrayList;
035:        import java.util.HashMap;
036:
037:        import javax.swing.BorderFactory;
038:        import javax.swing.BoxLayout;
039:        import javax.swing.ImageIcon;
040:        import javax.swing.JButton;
041:        import javax.swing.JDialog;
042:        import javax.swing.JLabel;
043:        import javax.swing.JPanel;
044:        import javax.swing.JScrollPane;
045:        import javax.swing.JTable;
046:        import javax.swing.ListSelectionModel;
047:        import javax.swing.event.ListSelectionEvent;
048:        import javax.swing.event.ListSelectionListener;
049:
050:        import org.objectweb.salome_tmf.api.Api;
051:        import org.objectweb.salome_tmf.api.ApiConstants;
052:        import org.objectweb.salome_tmf.api.Util;
053:        import org.objectweb.salome_tmf.data.DataConstants;
054:        import org.objectweb.salome_tmf.data.ExecutionResult;
055:        import org.objectweb.salome_tmf.data.ExecutionTestResult;
056:        import org.objectweb.salome_tmf.data.ManualTest;
057:        import org.objectweb.salome_tmf.data.Test;
058:        import org.objectweb.salome_tmf.ihm.IHMConstants;
059:        import org.objectweb.salome_tmf.ihm.languages.Language;
060:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
061:        import org.objectweb.salome_tmf.ihm.main.plugins.PluginsTools;
062:        import org.objectweb.salome_tmf.ihm.models.ActionDetailsResultMouseListener;
063:        import org.objectweb.salome_tmf.ihm.models.AutomaticTestResultMouseListener;
064:        import org.objectweb.salome_tmf.ihm.models.MyTableModel;
065:        import org.objectweb.salome_tmf.ihm.models.TableSorter;
066:        import org.objectweb.salome_tmf.ihm.tools.Tools;
067:        import org.objectweb.salome_tmf.plugins.UICompCst;
068:
069:        /**
070:         * Classe repr?sentant la vue sur les ex?cutions de test
071:         * @author teaml039
072:         * @version 0.1
073:         */
074:        public class ExecutionResultView extends JDialog implements 
075:                DataConstants, IHMConstants {
076:
077:            /**
078:             * Mod?le de donn?es de la table
079:             */
080:            MyTableModel testResultTableModel;
081:
082:            /**
083:             * Table des r?sultats sur les tests
084:             */
085:            JTable testResultTable;
086:            TableSorter sorter;
087:
088:            ListSelectionModel rowSM;
089:
090:            ExecutionResult currentExecResult;
091:
092:            JButton detailsButton;
093:
094:            /******************************************************************************/
095:            /** 							CONSTRUCTEUR								***/
096:            /******************************************************************************/
097:
098:            /**
099:             * Constructeur de la vue sur les ex?cutions de tests
100:             * @param name le label d'information sur l'ex?cution
101:             */
102:            public ExecutionResultView(String name,
103:                    ExecutionResult executionResult) {
104:
105:                super (SalomeTMFContext.getInstance().ptrFrame, true);
106:                testResultTableModel = new MyTableModel();
107:                testResultTable = new JTable();
108:                JLabel executionName = new JLabel(name);
109:                executionName.setFont(new Font(null, Font.BOLD, 18));
110:
111:                testResultTableModel.addColumnNameAndColumn(Language
112:                        .getInstance().getText("Famille"));
113:                testResultTableModel.addColumnNameAndColumn(Language
114:                        .getInstance().getText("Suite"));
115:                testResultTableModel.addColumnNameAndColumn(Language
116:                        .getInstance().getText("Test"));
117:                testResultTableModel.addColumnNameAndColumn(Language
118:                        .getInstance().getText("Résultats"));
119:
120:                sorter = new TableSorter(testResultTableModel);
121:                testResultTable.setModel(sorter);
122:                //testResultTable.setModel(testResultTableModel);
123:
124:                sorter.setTableHeader(testResultTable.getTableHeader());
125:
126:                testResultTable
127:                        .setPreferredScrollableViewportSize(new Dimension(600,
128:                                200));
129:                testResultTable
130:                        .setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
131:
132:                // Mapping entre objets graphiques et constantes
133:                SalomeTMFContext.getInstance().addToUIComponentsMap(
134:                        UICompCst.EXECUTION_RESULT_DETAILS_TESTS_TABLE,
135:                        testResultTable);
136:                // Activation des plugins associ?s
137:                PluginsTools
138:                        .activateAssociatedPlgs(UICompCst.EXECUTION_RESULT_DETAILS_TESTS_TABLE);
139:
140:                JScrollPane tablePane = new JScrollPane(testResultTable);
141:                tablePane.setBorder(BorderFactory.createRaisedBevelBorder());
142:
143:                rowSM = testResultTable.getSelectionModel();
144:                rowSM.addListSelectionListener(new ListSelectionListener() {
145:                    public void valueChanged(ListSelectionEvent e) {
146:                        if (e.getValueIsAdjusting())
147:                            return;
148:
149:                        int selectedRowIndex = testResultTable.getSelectedRow();
150:                        if (selectedRowIndex != -1
151:                                && testResultTableModel.getRowCount() > 0) {
152:                            Test test = DataModel.getCurrentProject()
153:                                    .getTestFromModel(
154:                                            (String) sorter.getValueAt(
155:                                                    selectedRowIndex, 0),
156:                                            (String) sorter.getValueAt(
157:                                                    selectedRowIndex, 1),
158:                                            (String) sorter.getValueAt(
159:                                                    selectedRowIndex, 2));
160:                            DataModel.setTestObservedInExecution(test);
161:                            DataModel
162:                                    .setCurrentExecutionTestResult(currentExecResult
163:                                            .getExecutionTestResultFromModel(test));
164:                            detailsButton.setEnabled(true);
165:                        } else {
166:                            detailsButton.setEnabled(false);
167:                        }
168:                    }
169:                });
170:
171:                // Gestion de la souris
172:                testResultTable
173:                        .addMouseListener(new ActionDetailsResultMouseListener());
174:                testResultTable
175:                        .addMouseListener(new AutomaticTestResultMouseListener());
176:
177:                JButton quitButton = new JButton(Language.getInstance()
178:                        .getText("Terminer"));
179:                quitButton.addActionListener(new ActionListener() {
180:                    public void actionPerformed(ActionEvent e) {
181:                        ExecutionResultView.this .dispose();
182:                    }
183:                });
184:
185:                detailsButton = new JButton(Language.getInstance().getText(
186:                        "Détails"));
187:                detailsButton.setEnabled(false);
188:                detailsButton.addActionListener(new ActionListener() {
189:                    public void actionPerformed(ActionEvent e) {
190:                        boolean attachUpdate = false;
191:                        boolean automatic = false;
192:                        ExecutionTestResult pExecutionTestResult = DataModel
193:                                .getCurrentExecutionTestResult();
194:                        HashMap oldAttachMap = pExecutionTestResult
195:                                .getCopyOfAttachmentMapFromModel();
196:
197:                        if (DataModel.getTestObservedInExecution() instanceof  ManualTest) {
198:                            Util
199:                                    .log("[ExecutionResultView->detailsButton] -> view manual test result");
200:                            new ActionDetailsView((ManualTest) DataModel
201:                                    .getTestObservedInExecution(), DataModel
202:                                    .getObservedExecution(), DataModel
203:                                    .getObservedExecutionResult(),
204:                                    pExecutionTestResult,
205:                                    ExecutionResultView.this );
206:                            //attachUpdate = false;
207:                        } else {
208:                            //HashMap oldAttachMap = (HashMap)DataModel.getCurrentExecutionTestResult().getAttachmentMapFromModel().clone();
209:                            //HashMap oldAttachMap = DataModel.getCurrentExecutionTestResult().getCopyOfAttachmentMapFromModel();
210:                            Util
211:                                    .log("[ExecutionResultView->detailsButton] -> view automatic test result");
212:                            //AttachmentViewWindow attachWindow = new AttachmentViewWindow(SalomeTMF.ptrSalomeTMF, EXECUTION_RESULT_TEST, DataModel.getCurrentExecutionTestResult(), DataModel.getObservedExecution(), DataModel.getObservedExecutionResult(), DataModel.getTestObservedInExecution());
213:                            AttachmentViewWindow attachWindow = new AttachmentViewWindow(
214:                                    SalomeTMFContext.getInstance().getBaseIHM(),
215:                                    EXECUTION_RESULT_TEST, DataModel
216:                                            .getCurrentExecutionTestResult());
217:                            automatic = true;
218:                            if (!attachWindow.cancelPerformed) {
219:                                attachUpdate = true;
220:                            }
221:                        }
222:                        if (attachUpdate && automatic) {
223:                            int transNumber = -1;
224:                            Util
225:                                    .log("[ExecutionResultView->detailsButton] -> valide Perfomed");
226:                            try {
227:                                Util
228:                                        .log("[ExecutionResultView] Api.INSERT_ATTACHMENT");
229:                                transNumber = Api.beginTransaction(10,
230:                                        ApiConstants.INSERT_ATTACHMENT);
231:
232:                                pExecutionTestResult
233:                                        .updateAttachement(oldAttachMap);
234:
235:                                Api.commitTrans(transNumber);
236:
237:                            } catch (Exception exception) {
238:                                Api.forceRollBackTrans(transNumber);
239:                                DataModel.getCurrentExecutionTestResult()
240:                                        .setAttachmentMapInModel(oldAttachMap);
241:                                exception.printStackTrace();
242:                                Tools.ihmExceptionView(exception);
243:                            }
244:                        } else if (automatic) {
245:                            Util
246:                                    .log("[ExecutionResultView->detailsButton] -> cancel Perfomed");
247:                            DataModel.getCurrentExecutionTestResult()
248:                                    .setAttachmentMapInModel(oldAttachMap);
249:                        }
250:
251:                    }
252:
253:                    //}
254:                });
255:
256:                JPanel upPart = new JPanel(new BorderLayout());
257:                upPart.add(executionName, BorderLayout.NORTH);
258:
259:                JPanel allView = new JPanel(new BorderLayout());
260:
261:                allView.add(upPart, BorderLayout.NORTH);
262:                allView.add(tablePane, BorderLayout.CENTER);
263:
264:                JPanel buttonPanel = new JPanel(new FlowLayout(
265:                        FlowLayout.CENTER));
266:                buttonPanel.add(detailsButton);
267:                buttonPanel.add(quitButton);
268:
269:                JPanel panel = new JPanel();
270:                panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
271:                panel.add(allView);
272:                panel.add(buttonPanel);
273:
274:                initTestResults(executionResult);
275:
276:                Container contentPaneFrame = this .getContentPane();
277:                contentPaneFrame.add(panel, BorderLayout.CENTER);
278:                //this.setLocation(400,300);
279:                this .setTitle(Language.getInstance().getText(
280:                        "Résultats_d'exécution"));
281:                /*this.pack();
282:                this.setLocationRelativeTo(this.getParent()); 
283:                this.setVisible(true);
284:                 */
285:                centerScreen();
286:            } // Fin du constructeur ExecutionResult/1
287:
288:            void centerScreen() {
289:                Dimension dim = getToolkit().getScreenSize();
290:                this .pack();
291:                Rectangle abounds = getBounds();
292:                setLocation((dim.width - abounds.width) / 2,
293:                        (dim.height - abounds.height) / 2);
294:                this .setVisible(true);
295:                requestFocus();
296:            }
297:
298:            /**
299:             *
300:             * @param executionResult
301:             */
302:            public void initTestResults(ExecutionResult executionResult) {
303:
304:                Test[] pTabTest = executionResult.getTestOrderedFromModel();
305:                for (int j = 0; j < pTabTest.length; j++) {
306:                    Test test = pTabTest[j];
307:                    ArrayList data = new ArrayList();
308:                    data.add(test.getTestListFromModel().getFamilyFromModel()
309:                            .toString());
310:                    data.add(test.getTestListFromModel().toString());
311:                    data.add(test.toString());
312:                    ImageIcon image = Tools.getActionStatusIcon(executionResult
313:                            .getTestResultStatusFromModel(test));
314:                    if (image == null) {
315:                        data.add(Tools.createAppletImageIcon(PATH_TO_GOON_ICON,
316:                                ""));
317:                    } else {
318:                        data.add(Tools.getActionStatusIcon(executionResult
319:                                .getTestResultStatusFromModel(test)));
320:
321:                    }
322:                    currentExecResult = executionResult;
323:                    testResultTableModel.addRow(data);
324:
325:                }
326:            } // Fin de la m?thode initTestResults/1
327:
328:        } // Fin de la classe ExecutionResult
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.