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

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


001:
002:        /*
003:         * SalomeTMF is a Test Management Framework
004:         * Copyright (C) 2005 France Telecom R&D
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2 of the License, or (at your option) any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019:         *
020:         * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
021:         *
022:         * Contact: mikael.marche@rd.francetelecom.com
023:         */
024:
025:        package salomeTMF_plug.bugzilla;
026:
027:        import java.awt.BorderLayout;
028:        import java.awt.Container;
029:        import java.awt.Dimension;
030:        import java.awt.FlowLayout;
031:        import java.awt.GridLayout;
032:        import java.awt.event.ActionEvent;
033:        import java.awt.event.ActionListener;
034:        import java.net.MalformedURLException;
035:        import java.net.URL;
036:        import java.util.ArrayList;
037:        import java.util.Properties;
038:        import java.util.StringTokenizer;
039:        import java.util.Vector;
040:
041:        import javax.swing.BoxLayout;
042:        import javax.swing.DefaultComboBoxModel;
043:        import javax.swing.JButton;
044:        import javax.swing.JComboBox;
045:        import javax.swing.JDialog;
046:        import javax.swing.JFrame;
047:        import javax.swing.JLabel;
048:        import javax.swing.JOptionPane;
049:        import javax.swing.JPanel;
050:        import javax.swing.JScrollPane;
051:        import javax.swing.JTextArea;
052:        import javax.swing.JTextField;
053:
054:        import org.objectweb.salome_tmf.data.ConnectionData;
055:        import org.objectweb.salome_tmf.data.Environment;
056:        import org.objectweb.salome_tmf.data.Execution;
057:        import org.objectweb.salome_tmf.data.ExecutionResult;
058:        import org.objectweb.salome_tmf.data.ExecutionTestResult;
059:        import org.objectweb.salome_tmf.data.ProjectData;
060:        import org.objectweb.salome_tmf.data.Test;
061:        import org.objectweb.salome_tmf.data.UrlAttachment;
062:        import org.objectweb.salome_tmf.ihm.datawrapper.DataModel;
063:
064:        import salomeTMF_plug.bugzilla.languages.Language;
065:
066:        /**
067:         * Classe qui définit la fenêtre pour envoyer des bugs sur bugzilla.
068:         * @author teaml039
069:         */
070:        public class BugZillaView extends JDialog {
071:
072:            /**
073:             * Label de l'utilisateur
074:             */
075:            JLabel userNameLabel;
076:
077:            /**
078:             * Label pour la plateforme
079:             */
080:            JLabel platformLabel;
081:
082:            /**
083:             * Label pour l'OS
084:             */
085:            JLabel osLabel;
086:
087:            /**
088:             * Label pour les priorités
089:             */
090:            JLabel priorityLabel;
091:
092:            /**
093:             * Label pour l'importance
094:             */
095:            JLabel severityLabel;
096:
097:            /**
098:             * Label pour le produit
099:             */
100:            JLabel productLabel;
101:
102:            /**
103:             * Label pour le destinataire
104:             */
105:            JLabel assignedToLabel;
106:
107:            /**
108:             * Label pour l'url
109:             */
110:            JLabel urlLabel;
111:
112:            /**
113:             * Label pour le résumé
114:             */
115:            JLabel summaryLabel;
116:
117:            /**
118:             * Label pour la description
119:             */
120:            JLabel descriptionLabel;
121:
122:            /**
123:             * Modèle pour la comboBox de la plateforme 
124:             */
125:            DefaultComboBoxModel assignedToComboBoxModel;
126:
127:            /**
128:             * Modèle pour la comboBox de la plateforme 
129:             */
130:            DefaultComboBoxModel platformComboBoxModel;
131:
132:            /**
133:             * Modèle pour la comboBox des priorités
134:             */
135:            DefaultComboBoxModel priorityComboBoxModel;
136:
137:            /**
138:             * Modèle pour la comboBox de l'OS
139:             */
140:            DefaultComboBoxModel osComboBoxModel;
141:
142:            /**
143:             * Modèle pour la comboBox de l'importance
144:             */
145:            DefaultComboBoxModel severityComboBoxModel;
146:
147:            /**
148:             * Bouton d'envoi
149:             */
150:            JButton commitButton;
151:
152:            /**
153:             * Bouton d'annulation
154:             */
155:            JButton cancelButton;
156:
157:            /**
158:             * Champ texte pour le destinataire 
159:             */
160:            JTextField assignedToTextField;
161:
162:            /**
163:             * Champ texte pour l'url
164:             */
165:            JTextField urlTextField;
166:
167:            /**
168:             * Champ texte pour le résumé
169:             */
170:            JTextField summaryTextField;
171:
172:            /**
173:             * Champ texte pour la description 
174:             */
175:            JTextArea descriptionArea;
176:
177:            /**
178:             * La liste des plateformes 
179:             */
180:            JComboBox platformComboBox;
181:
182:            /**
183:             * La liste des OS
184:             */
185:            JComboBox osComboBox;
186:
187:            /**
188:             * La liste des priorités
189:             */
190:            JComboBox priorityComboBox;
191:
192:            /**
193:             * La liste des importances
194:             */
195:            JComboBox severityComboBox;
196:
197:            /**
198:             * La liste des destinataires
199:             */
200:            JComboBox assignedToComboBox;
201:
202:            /**
203:             * Le résultat d'exécution concerné
204:             */
205:            ExecutionResult execResult;
206:
207:            /**
208:             * L'environnement concerné
209:             */
210:            Environment environment;
211:
212:            /**
213:             * Test courant
214:             */
215:            Test currentTest;
216:
217:            Execution exec;
218:
219:            ExecutionTestResult executionTestResult;
220:
221:            ArrayList bugList;
222:
223:            /**************************************************************************/
224:            /**							CONSTRUCTEUR								***/
225:            /**************************************************************************/
226:
227:            /**
228:             * Constructeur de la fenêtre pour bugzilla
229:             */
230:            public BugZillaView(Properties cfg_prop, String bugDescription,
231:                    ExecutionResult executionResult, Environment env,
232:                    Test test, Execution execution,
233:                    ExecutionTestResult execTestResult) {
234:
235:                // Init des composants de la fenêtre
236:                super (new JFrame(), true);
237:                userNameLabel = new JLabel(Language.getInstance().getText(
238:                        "Utilisateur_:_"));
239:                platformLabel = new JLabel(Language.getInstance().getText(
240:                        "Plateforme_:_"));
241:                productLabel = new JLabel(Language.getInstance().getText(
242:                        "Produit_:_Salome"));
243:                osLabel = new JLabel(Language.getInstance().getText("OS_:"));
244:                priorityLabel = new JLabel(Language.getInstance().getText(
245:                        "Priorité_:_"));
246:                severityLabel = new JLabel(Language.getInstance().getText(
247:                        "Importance_:_"));
248:                assignedToLabel = new JLabel(Language.getInstance().getText(
249:                        "Destinataire_:_"));
250:                urlLabel = new JLabel(Language.getInstance().getText(
251:                        "URL_:____________"));
252:                summaryLabel = new JLabel(Language.getInstance().getText(
253:                        "Résumé_:______"));
254:                descriptionLabel = new JLabel(Language.getInstance().getText(
255:                        "Description_:_"));
256:
257:                platformComboBoxModel = new DefaultComboBoxModel();
258:                priorityComboBoxModel = new DefaultComboBoxModel();
259:                osComboBoxModel = new DefaultComboBoxModel();
260:                severityComboBoxModel = new DefaultComboBoxModel();
261:                assignedToComboBoxModel = new DefaultComboBoxModel();
262:
263:                // OS, priorities, plateforms and severities for bugzilla bugs are listed in the
264:                // config file
265:                StringTokenizer osNames = new StringTokenizer(cfg_prop
266:                        .getProperty("OS"), ",", false);
267:                for (; osNames.hasMoreTokens();) {
268:                    osComboBoxModel.addElement(osNames.nextToken().trim());
269:                }
270:
271:                StringTokenizer prioritiesNames = new StringTokenizer(cfg_prop
272:                        .getProperty("Priorities"), ",", false);
273:                for (; prioritiesNames.hasMoreTokens();) {
274:                    priorityComboBoxModel.addElement(prioritiesNames
275:                            .nextToken().trim());
276:                }
277:
278:                StringTokenizer platformsNames = new StringTokenizer(cfg_prop
279:                        .getProperty("Plateforms"), ",", false);
280:                for (; platformsNames.hasMoreTokens();) {
281:                    platformComboBoxModel.addElement(platformsNames.nextToken()
282:                            .trim());
283:                }
284:
285:                StringTokenizer severityNames = new StringTokenizer(cfg_prop
286:                        .getProperty("Severities"), ",", false);
287:                for (; severityNames.hasMoreTokens();) {
288:                    severityComboBoxModel.addElement(severityNames.nextToken()
289:                            .trim());
290:                }
291:
292:                platformComboBox = new JComboBox(platformComboBoxModel);
293:                osComboBox = new JComboBox(osComboBoxModel);
294:                priorityComboBox = new JComboBox(priorityComboBoxModel);
295:                severityComboBox = new JComboBox(severityComboBoxModel);
296:                assignedToComboBox = new JComboBox(assignedToComboBoxModel);
297:
298:                assignedToTextField = new JTextField(50);
299:                urlTextField = new JTextField(50);
300:                summaryTextField = new JTextField(50);
301:                descriptionArea = new JTextArea(bugDescription);
302:
303:                JScrollPane descriptionScrollPane = new JScrollPane(
304:                        descriptionArea);
305:                descriptionScrollPane.setPreferredSize(new Dimension(500, 200));
306:
307:                commitButton = new JButton(Language.getInstance().getText(
308:                        "Envoyer"));
309:                commitButton.addActionListener(new ActionListener() {
310:                    public void actionPerformed(ActionEvent e) {
311:                        // le champ destinataire est obligatoire
312:                        // on ajoute le bug et récupère l'url pour l'attacher au résultat d'éxécution
313:                        String url = BugzillaPlugin
314:                                .addBug((String) assignedToComboBox
315:                                        .getSelectedItem(), urlTextField
316:                                        .getText().trim(),
317:                                        (String) severityComboBox
318:                                                .getSelectedItem(),
319:                                        summaryTextField.getText(),
320:                                        (String) osComboBox.getSelectedItem(),
321:                                        (String) priorityComboBox
322:                                                .getSelectedItem(),
323:                                        (String) platformComboBox
324:                                                .getSelectedItem(), environment
325:                                                .getName(), descriptionArea
326:                                                .getText(),
327:                                        DataModel.getCurrentCampaign()
328:                                                .getName(), currentTest
329:                                                .getTestList().getFamily()
330:                                                .getName(), currentTest
331:                                                .getTestList().getName(),
332:                                        currentTest.getName(), exec.getName());
333:                        if (!url.equals("")) {
334:                            UrlAttachment urlAttachment = new UrlAttachment();
335:                            urlAttachment.setName(url);
336:                            if (executionTestResult != null) {
337:                                DataModel.getCurrentExecutionTestResult()
338:                                        .getAttachmentMap().put(
339:                                                urlAttachment.getName(),
340:                                                urlAttachment);
341:                                bugList.add(urlAttachment);
342:                                ArrayList rowData = new ArrayList();
343:                                rowData.add(urlAttachment.getName());
344:                                DataModel.getAttachmentTableModel().addRow(
345:                                        rowData);
346:                            } else {
347:                                execResult.getAttachmentMap().put(
348:                                        urlAttachment.getName(), urlAttachment);
349:                            }
350:
351:                            try {
352:                                URL newUrl = new URL(url);
353:                                DataModel.getApplet().getAppletContext()
354:                                        .showDocument(newUrl, "_blank");
355:                            } catch (MalformedURLException me) {
356:                                JOptionPane.showMessageDialog(
357:                                        BugZillaView.this , Language
358:                                                .getInstance().getText(
359:                                                        "URL_incorrecte_!"),
360:                                        Language.getInstance().getText(
361:                                                "Erreur_!"),
362:                                        JOptionPane.ERROR_MESSAGE);
363:                                me.printStackTrace();
364:                            }
365:
366:                            BugZillaView.this .dispose();
367:                        }
368:                    }
369:                });
370:
371:                cancelButton = new JButton(Language.getInstance().getText(
372:                        "Annuler"));
373:                cancelButton.addActionListener(new ActionListener() {
374:                    public void actionPerformed(ActionEvent e) {
375:                        BugZillaView.this .dispose();
376:                    }
377:                });
378:
379:                JPanel firstLinePanel = new JPanel(new FlowLayout(
380:                        FlowLayout.LEFT));
381:                firstLinePanel.add(productLabel);
382:                //firstLinePanel.add(Box.createRigidArea(new Dimension(350,1)));
383:                JPanel firstLinePanel2 = new JPanel(new FlowLayout(
384:                        FlowLayout.LEFT));
385:                firstLinePanel2.add(userNameLabel);
386:
387:                JPanel secondLinePanel1 = new JPanel(new FlowLayout(
388:                        FlowLayout.LEFT));
389:                secondLinePanel1.add(platformLabel);
390:                secondLinePanel1.add(platformComboBox);
391:                //secondLinePanel.add(Box.createRigidArea(new Dimension(180,0)));
392:                JPanel secondLinePanel2 = new JPanel(new FlowLayout(
393:                        FlowLayout.LEFT));
394:                secondLinePanel2.add(osLabel);
395:                secondLinePanel2.add(osComboBox);
396:
397:                JPanel thirdLinePanel1 = new JPanel(new FlowLayout(
398:                        FlowLayout.LEFT));
399:                thirdLinePanel1.add(priorityLabel);
400:                thirdLinePanel1.add(priorityComboBox);
401:                //thirdLinePanel.add(Box.createRigidArea(new Dimension(180,0)));
402:                JPanel thirdLinePanel2 = new JPanel(new FlowLayout(
403:                        FlowLayout.LEFT));
404:                thirdLinePanel2.add(severityLabel);
405:                thirdLinePanel2.add(severityComboBox);
406:
407:                JPanel gridPanel = new JPanel(new GridLayout(3, 2));
408:                gridPanel.add(firstLinePanel);
409:                gridPanel.add(firstLinePanel2);
410:                gridPanel.add(secondLinePanel1);
411:                gridPanel.add(secondLinePanel2);
412:                gridPanel.add(thirdLinePanel1);
413:                gridPanel.add(thirdLinePanel2);
414:
415:                JPanel fourthLinePanel = new JPanel(new FlowLayout(
416:                        FlowLayout.LEFT));
417:                fourthLinePanel.add(assignedToLabel);
418:                fourthLinePanel.add(assignedToComboBox);
419:
420:                JPanel fifthLinePanel = new JPanel(new FlowLayout(
421:                        FlowLayout.LEFT));
422:                fifthLinePanel.add(urlLabel);
423:                fifthLinePanel.add(urlTextField);
424:
425:                JPanel sixthLinePanel = new JPanel(new FlowLayout(
426:                        FlowLayout.LEFT));
427:                sixthLinePanel.add(summaryLabel);
428:                sixthLinePanel.add(summaryTextField);
429:
430:                JPanel seventhLinePanel = new JPanel(new FlowLayout(
431:                        FlowLayout.LEFT));
432:                seventhLinePanel.add(descriptionLabel);
433:                seventhLinePanel.add(descriptionScrollPane);
434:
435:                JPanel heightLinePanel = new JPanel(new FlowLayout(
436:                        FlowLayout.CENTER));
437:                heightLinePanel.add(commitButton);
438:                heightLinePanel.add(cancelButton);
439:
440:                JPanel mainPanel = new JPanel();
441:                mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
442:                //mainPanel.add(firstLinePanel);
443:
444:                //mainPanel.add(secondLinePanel);
445:                //mainPanel.add(thirdLinePanel);
446:                mainPanel.add(gridPanel);
447:                mainPanel.add(fourthLinePanel);
448:                mainPanel.add(fifthLinePanel);
449:                mainPanel.add(sixthLinePanel);
450:                mainPanel.add(seventhLinePanel);
451:                mainPanel.add(heightLinePanel);
452:
453:                Container contentPaneFrame = this .getContentPane();
454:                contentPaneFrame.add(mainPanel, BorderLayout.CENTER);
455:
456:                initData(executionResult, env, test, execution, execTestResult);
457:
458:                this .setLocation(300, 120);
459:                this .setTitle(Language.getInstance().getText(
460:                        "Ajouter_un_bug_dans_Bugzilla"));
461:                this .pack();
462:                this .setVisible(true);
463:
464:            } // Fin du constructeur
465:
466:            /**************************************************************************/
467:            /**							METHODES PUBLIQUES							***/
468:            /**************************************************************************/
469:
470:            /**
471:             * Méthode d'initialisation
472:             */
473:            private void initData(ExecutionResult executionResult,
474:                    Environment env, Test test, Execution execution,
475:                    ExecutionTestResult execTestResult) {
476:                execResult = executionResult;
477:                executionTestResult = execTestResult;
478:                environment = env;
479:                userNameLabel.setText(Language.getInstance().getText(
480:                        "Utilisateur_:_")
481:                        + ProjectData.getCurrentUser().getEmail());
482:                currentTest = test;
483:                exec = execution;
484:                if (ConnectionData.isConnected()) {
485:                    Vector assignedToVector = BugzillaPlugin.selectAllLogin();
486:                    if (assignedToVector != null) {
487:                        for (int i = 0; i < assignedToVector.size(); i++) {
488:                            assignedToComboBoxModel.addElement(assignedToVector
489:                                    .get(i));
490:                        }
491:                    }
492:
493:                }
494:                bugList = new ArrayList();
495:            } // Fin de la méthode initData/2
496:
497:            /**
498:             * @return
499:             */
500:            public ArrayList getBugList() {
501:                return bugList;
502:            }
503:
504:        } // Fin de la classe BugZillaView
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.