Source Code Cross Referenced for AskNewBugDefaultPanel.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:        package org.objectweb.salome_tmf.ihm.main;
0002:
0003:        import java.awt.BorderLayout;
0004:        import java.awt.Dimension;
0005:        import java.awt.FlowLayout;
0006:        import java.awt.Frame;
0007:        import java.awt.GridLayout;
0008:        import java.awt.event.ActionEvent;
0009:        import java.awt.event.ActionListener;
0010:        import java.io.Reader;
0011:        import java.io.StringReader;
0012:        import java.util.Iterator;
0013:        import java.util.Set;
0014:        import java.util.Vector;
0015:
0016:        import javax.swing.BoxLayout;
0017:        import javax.swing.DefaultComboBoxModel;
0018:        import javax.swing.JButton;
0019:        import javax.swing.JComboBox;
0020:        import javax.swing.JLabel;
0021:        import javax.swing.JOptionPane;
0022:        import javax.swing.JPanel;
0023:        import javax.swing.JScrollPane;
0024:        import javax.swing.JTextArea;
0025:        import javax.swing.JTextField;
0026:        import javax.swing.text.Document;
0027:        import javax.swing.text.EditorKit;
0028:        import javax.swing.text.html.HTMLEditorKit;
0029:
0030:        import org.objectweb.salome_tmf.data.Attachment;
0031:        import org.objectweb.salome_tmf.data.DataConstants;
0032:        import org.objectweb.salome_tmf.data.DataSet;
0033:        import org.objectweb.salome_tmf.data.Environment;
0034:        import org.objectweb.salome_tmf.data.Execution;
0035:        import org.objectweb.salome_tmf.data.ExecutionResult;
0036:        import org.objectweb.salome_tmf.data.ExecutionTestResult;
0037:        import org.objectweb.salome_tmf.data.Test;
0038:        import org.objectweb.salome_tmf.ihm.languages.Language;
0039:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
0040:        import org.objectweb.salome_tmf.ihm.main.plugins.PluginsTools;
0041:        import org.objectweb.salome_tmf.ihm.tools.Tools;
0042:        import org.objectweb.salome_tmf.plugins.core.BugTracker;
0043:
0044:        public class AskNewBugDefaultPanel extends JPanel implements 
0045:                ActionListener {
0046:            /**
0047:             * Label de l'utilisateur
0048:             */
0049:            JLabel userNameLabel;
0050:
0051:            /**
0052:             * Label pour la plateforme
0053:             */
0054:            JLabel platformLabel;
0055:
0056:            /**
0057:             * Label pour l'OS
0058:             */
0059:            JLabel osLabel;
0060:
0061:            /**
0062:             * Label pour les priorités
0063:             */
0064:            JLabel priorityLabel;
0065:
0066:            /**
0067:             * Label pour l'importance
0068:             */
0069:            JLabel severityLabel;
0070:
0071:            /**
0072:             * Label pour le produit
0073:             */
0074:            JLabel productLabel;
0075:
0076:            /**
0077:             * Label pour le destinataire
0078:             */
0079:            JLabel assignedToLabel;
0080:
0081:            /**
0082:             * Label pour l'url
0083:             */
0084:            JLabel urlLabel;
0085:
0086:            /**
0087:             * Label pour le résumé
0088:             */
0089:            JLabel summaryLabel;
0090:
0091:            /**
0092:             * Label pour la description
0093:             */
0094:            JLabel descriptionLabel;
0095:
0096:            /**
0097:             * Label pour le status
0098:             */
0099:            JLabel statusLabel;
0100:
0101:            /**
0102:             * Label pour la reproductibilité
0103:             */
0104:            JLabel reproducibilityLabel;
0105:            /**
0106:             * Label pour la résolution
0107:             */
0108:            JLabel resolutionLabel;
0109:
0110:            /**
0111:             * Modèle pour la comboBox de la plateforme 
0112:             */
0113:            DefaultComboBoxModel assignedToComboBoxModel;
0114:
0115:            /**
0116:             * Modèle pour la comboBox de la plateforme 
0117:             */
0118:            DefaultComboBoxModel platformComboBoxModel;
0119:
0120:            /**
0121:             * Modèle pour la comboBox des priorités
0122:             */
0123:            DefaultComboBoxModel priorityComboBoxModel;
0124:
0125:            /**
0126:             * Modèle pour la comboBox de l'OS
0127:             */
0128:            DefaultComboBoxModel osComboBoxModel;
0129:
0130:            /**
0131:             * Modèle pour la comboBox de l'importance
0132:             */
0133:            DefaultComboBoxModel severityComboBoxModel;
0134:
0135:            /**
0136:             * Modèle pour la comboBox de status
0137:             */
0138:            DefaultComboBoxModel statusComboBoxModel;
0139:
0140:            /**
0141:             * Modèle pour la comboBox de reproducibility
0142:             */
0143:            DefaultComboBoxModel reproducibilityComboBoxModel;
0144:
0145:            /**
0146:             * Modèle pour la comboBox de resolution
0147:             */
0148:            DefaultComboBoxModel resolutionComboBoxModel;
0149:
0150:            /**
0151:             * Bouton d'envoi
0152:             */
0153:            JButton commitButton;
0154:
0155:            /**
0156:             * Bouton de modification
0157:             */
0158:            JButton modifyButton;
0159:
0160:            /**
0161:             * Bouton de Visualisation
0162:             */
0163:            JButton viewButton;
0164:
0165:            /**
0166:             * Bouton d'annulation
0167:             */
0168:            JButton cancelButton;
0169:
0170:            /**
0171:             * Champ texte pour le destinataire 
0172:             */
0173:            JTextField assignedToTextField;
0174:
0175:            /**
0176:             * Champ texte pour l'url
0177:             */
0178:            JTextField urlTextField;
0179:
0180:            /**
0181:             * Champ texte pour le résumé
0182:             */
0183:            JTextField summaryTextField;
0184:
0185:            /**
0186:             * Champ texte pour la description 
0187:             */
0188:            JTextArea descriptionArea;
0189:
0190:            /**
0191:             * La liste des plateformes 
0192:             */
0193:            JComboBox platformComboBox;
0194:
0195:            /**
0196:             * La liste des OS
0197:             */
0198:            JComboBox osComboBox;
0199:
0200:            /**
0201:             * La liste des priorités
0202:             */
0203:            JComboBox priorityComboBox;
0204:
0205:            /**
0206:             * La liste des importances
0207:             */
0208:            JComboBox severityComboBox;
0209:
0210:            /**
0211:             * La liste des destinataires
0212:             */
0213:            JComboBox assignedToComboBox;
0214:
0215:            /**
0216:             * La liste des status
0217:             */
0218:            JComboBox statusToComboBox;
0219:
0220:            /**
0221:             * La liste des reproductibilités
0222:             */
0223:            JComboBox reproducibilityComboBox;
0224:
0225:            /**
0226:             * La liste des resolutions
0227:             */
0228:            JComboBox resolutionComboBox;
0229:
0230:            /**
0231:             * Le résultat d'exécution concerné
0232:             */
0233:            ExecutionResult execResult;
0234:
0235:            /**
0236:             * L'environnement concerné
0237:             */
0238:            Environment environment;
0239:
0240:            /**
0241:             * Test courant
0242:             */
0243:            Test currentTest;
0244:
0245:            Execution exec;
0246:
0247:            ExecutionTestResult executionTestResult;
0248:
0249:            BugTracker bugTracker;
0250:
0251:            /* Add for modify functionnality */
0252:            Attachment theBug;
0253:            String strEnvironement;
0254:
0255:            boolean autofill = true;
0256:            IBugJDialog pAskNewBug;
0257:
0258:            public AskNewBugDefaultPanel(IBugJDialog pAskNewBug,
0259:                    BugTracker bugTrack, boolean _autofill, String actionName,
0260:                    String actionDesc, String actionAwatedRes,
0261:                    String actionEffectiveRes) {
0262:                super (new BorderLayout());
0263:                // Init des composants de la fenêtre
0264:                autofill = _autofill;
0265:                this .bugTracker = bugTrack;
0266:                this .pAskNewBug = pAskNewBug;
0267:
0268:                execResult = DataModel.getObservedExecutionResult();
0269:                executionTestResult = DataModel.getCurrentExecutionTestResult();
0270:
0271:                if (DataModel.getObservedExecution() == null) {
0272:                    environment = null;
0273:                } else {
0274:                    environment = DataModel.getObservedExecution()
0275:                            .getEnvironmentFromModel();
0276:                }
0277:
0278:                if (DataModel.getCurrentExecutionTestResult() == null) {
0279:                    currentTest = null;
0280:                } else {
0281:                    currentTest = DataModel.getCurrentExecutionTestResult()
0282:                            .getTestFromModel();
0283:                }
0284:
0285:                exec = DataModel.getObservedExecution();
0286:
0287:                initComponent();
0288:
0289:                if (environment != null) {
0290:                    productLabel.setText(productLabel.getText()
0291:                            + environment.getNameFromModel());
0292:                } else {
0293:                    productLabel.setText(Language.getInstance().getText(
0294:                            "Produit_:_Salome"));
0295:                }
0296:
0297:                userNameLabel.setText(userNameLabel.getText() + " : "
0298:                        + DataModel.getCurrentUser().getEmailFromModel());
0299:
0300:                // OS, priorities, plateforms and severities
0301:                Vector osNames = bugTracker.getBugOSList();
0302:                if (osNames != null) {
0303:                    for (int i = 0; i < osNames.size(); i++) {
0304:                        osComboBoxModel.addElement(osNames.elementAt(i));
0305:                    }
0306:                }
0307:
0308:                Vector prioritiesNames = bugTracker.getBugPriorityList();
0309:                if (prioritiesNames != null) {
0310:                    for (int i = 0; i < prioritiesNames.size(); i++) {
0311:                        priorityComboBoxModel.addElement(prioritiesNames
0312:                                .elementAt(i));
0313:                    }
0314:                }
0315:
0316:                Vector platformsNames = bugTracker.getBugPlateformList();
0317:                if (platformsNames != null) {
0318:                    for (int i = 0; i < platformsNames.size(); i++) {
0319:                        platformComboBoxModel.addElement(platformsNames
0320:                                .elementAt(i));
0321:                    }
0322:                }
0323:
0324:                Vector severityNames = bugTracker.getBugSeverityList();
0325:                if (severityNames != null) {
0326:                    for (int i = 0; i < severityNames.size(); i++) {
0327:                        severityComboBoxModel.addElement(severityNames
0328:                                .elementAt(i));
0329:                    }
0330:                }
0331:
0332:                Vector assignedToVector = bugTracker.getBugTrackerAllUsers();
0333:                if (assignedToVector != null) {
0334:                    for (int i = 0; i < assignedToVector.size(); i++) {
0335:                        assignedToComboBoxModel.addElement(assignedToVector
0336:                                .get(i));
0337:                    }
0338:                }
0339:
0340:                platformComboBox = new JComboBox(platformComboBoxModel);
0341:                platformComboBox.setEditable(bugTrack.isEditablePlateForme());
0342:                osComboBox = new JComboBox(osComboBoxModel);
0343:                osComboBox.setEditable(bugTrack.isEditableOS());
0344:
0345:                priorityComboBox = new JComboBox(priorityComboBoxModel);
0346:                severityComboBox = new JComboBox(severityComboBoxModel);
0347:                assignedToComboBox = new JComboBox(assignedToComboBoxModel);
0348:
0349:                assignedToTextField = new JTextField(50);
0350:                urlTextField = new JTextField(50);
0351:                summaryTextField = new JTextField(50);
0352:
0353:                Test testInExec = PluginsTools
0354:                        .getTestForCurrentTestExecResult();
0355:                String bugDescription = "";
0356:
0357:                // Convert HTML description to text for a test
0358:                String testHtmlDesc = testInExec.getDescriptionFromModel();
0359:                String testTextDesc = "";
0360:
0361:                EditorKit kit = new HTMLEditorKit();
0362:                Document doc = kit.createDefaultDocument();
0363:                // The Document class does not yet handle charset's properly.
0364:                doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
0365:                try {
0366:                    // Create a reader on the HTML content.
0367:                    Reader rd = new StringReader(testHtmlDesc);
0368:                    // Parse the HTML.
0369:                    kit.read(rd, doc, 0);
0370:                    testTextDesc = doc.getText(0, doc.getLength());
0371:                } catch (Exception e) {
0372:                    e.printStackTrace();
0373:                }
0374:
0375:                if (autofill) {
0376:                    bugDescription = bugDescription
0377:                            + Language.getInstance().getText("-_Campagne_=_")
0378:                            + PluginsTools.getCurrentCampExecution()
0379:                                    .getCampagneFromModel().getNameFromModel()
0380:                            + "\n"
0381:                            + Language.getInstance().getText("-_Execution_=_")
0382:                            + PluginsTools.getCurrentCampExecution()
0383:                                    .getNameFromModel()
0384:                            + "\n"
0385:                            + Language.getInstance().getText(
0386:                                    "-_Test_:_[famille_=_")
0387:                            + testInExec.getTestListFromModel()
0388:                                    .getFamilyFromModel().getNameFromModel()
0389:                            + Language.getInstance().getText("_,suite_=_")
0390:                            + testInExec.getTestListFromModel()
0391:                                    .getNameFromModel()
0392:                            + Language.getInstance().getText("_,test_=_")
0393:                            + testInExec.getNameFromModel()
0394:                            + "]"
0395:                            + "\n"
0396:                            + Language.getInstance().getText(
0397:                                    "-_Description_du_test_:_") + testTextDesc
0398:                            + "\n";
0399:
0400:                    DataSet dataSet = PluginsTools.getCurrentCampExecution()
0401:                            .getDataSetFromModel();
0402:                    String dataSetStr = "\n- "
0403:                            + Language.getInstance().getText("Jeu_de_données")
0404:                            + " : " + dataSet.getNameFromModel() + "\n";
0405:                    Set dataSetKeysSet = dataSet
0406:                            .getParametersHashMapFromModel().keySet();
0407:                    Environment env = PluginsTools.getCurrentCampExecution()
0408:                            .getEnvironmentFromModel();
0409:                    if (!dataSetKeysSet.isEmpty()) {
0410:                        for (Iterator iter = dataSetKeysSet.iterator(); iter
0411:                                .hasNext();) {
0412:                            String paramName = ((String) iter.next()).trim();
0413:                            String value = dataSet.getParameterValueFromModel(
0414:                                    paramName).trim();
0415:                            if (value != null && !value.equals("")) {
0416:                                if (value
0417:                                        .startsWith(DataConstants.PARAM_VALUE_FROM_ENV)) {
0418:                                    if (env != null) {
0419:                                        value = env
0420:                                                .getParameterValue(paramName);
0421:                                    }
0422:                                }
0423:                                dataSetStr += "\t" + paramName + " = " + value
0424:                                        + "\n";
0425:                            }
0426:
0427:                        }
0428:                        bugDescription += dataSetStr + "\n";
0429:                    }
0430:                }
0431:                if (actionName != null) {
0432:                    bugDescription += Language.getInstance().getText("-Action")
0433:                            + actionName
0434:                            + "\n"
0435:                            + Language.getInstance().getText("-Action_desc")
0436:                            + actionDesc
0437:                            + "\n"
0438:                            + Language.getInstance().getText(
0439:                                    "-Action_res_attendu")
0440:                            + actionAwatedRes
0441:                            + "\n"
0442:                            + Language.getInstance().getText(
0443:                                    "-Action_res_effectif")
0444:                            + actionEffectiveRes;
0445:                }
0446:
0447:                String bugAdditionalDesc = bugTracker.getAdditionalBugDesc();
0448:                if ((bugAdditionalDesc != null) && (bugAdditionalDesc != "")) {
0449:                    bugDescription += bugAdditionalDesc;
0450:                }
0451:
0452:                descriptionArea = new JTextArea(bugDescription);
0453:
0454:                JScrollPane descriptionScrollPane = new JScrollPane(
0455:                        descriptionArea);
0456:                descriptionScrollPane.setPreferredSize(new Dimension(500, 200));
0457:
0458:                commitButton = new JButton(Language.getInstance().getText(
0459:                        "Envoyer"));
0460:                commitButton.addActionListener(this );
0461:
0462:                modifyButton = new JButton(Language.getInstance().getText(
0463:                        "Modifier"));
0464:                viewButton = new JButton(Language.getInstance().getText(
0465:                        "Visualiser"));
0466:                cancelButton = new JButton(Language.getInstance().getText(
0467:                        "Annuler"));
0468:                cancelButton.addActionListener(this );
0469:
0470:                JPanel firstLinePanel = new JPanel(new FlowLayout(
0471:                        FlowLayout.LEFT));
0472:                firstLinePanel.add(productLabel);
0473:                //firstLinePanel.add(Box.createRigidArea(new Dimension(350,1)));
0474:                JPanel firstLinePanel2 = new JPanel(new FlowLayout(
0475:                        FlowLayout.LEFT));
0476:                firstLinePanel2.add(userNameLabel);
0477:
0478:                JPanel secondLinePanel1 = new JPanel(new FlowLayout(
0479:                        FlowLayout.LEFT));
0480:                secondLinePanel1.add(platformLabel);
0481:                secondLinePanel1.add(platformComboBox);
0482:                //secondLinePanel.add(Box.createRigidArea(new Dimension(180,0)));
0483:                JPanel secondLinePanel2 = new JPanel(new FlowLayout(
0484:                        FlowLayout.LEFT));
0485:                secondLinePanel2.add(osLabel);
0486:                secondLinePanel2.add(osComboBox);
0487:
0488:                JPanel thirdLinePanel1 = new JPanel(new FlowLayout(
0489:                        FlowLayout.LEFT));
0490:                thirdLinePanel1.add(priorityLabel);
0491:                thirdLinePanel1.add(priorityComboBox);
0492:                //thirdLinePanel.add(Box.createRigidArea(new Dimension(180,0)));
0493:                JPanel thirdLinePanel2 = new JPanel(new FlowLayout(
0494:                        FlowLayout.LEFT));
0495:                thirdLinePanel2.add(severityLabel);
0496:                thirdLinePanel2.add(severityComboBox);
0497:
0498:                JPanel gridPanel = new JPanel(new GridLayout(3, 2));
0499:                gridPanel.add(firstLinePanel);
0500:                gridPanel.add(firstLinePanel2);
0501:                gridPanel.add(secondLinePanel1);
0502:                gridPanel.add(secondLinePanel2);
0503:                gridPanel.add(thirdLinePanel2);
0504:                gridPanel.add(thirdLinePanel1);
0505:
0506:                JPanel fourthLinePanel = new JPanel(new FlowLayout(
0507:                        FlowLayout.LEFT));
0508:                fourthLinePanel.add(assignedToLabel);
0509:                fourthLinePanel.add(assignedToComboBox);
0510:
0511:                JPanel fourthLinePanel2 = null;
0512:
0513:                JPanel fifthLinePanel = new JPanel(new FlowLayout(
0514:                        FlowLayout.LEFT));
0515:                fifthLinePanel.add(urlLabel);
0516:                fifthLinePanel.add(urlTextField);
0517:
0518:                JPanel sixthLinePanel = new JPanel(new FlowLayout(
0519:                        FlowLayout.LEFT));
0520:                sixthLinePanel.add(summaryLabel);
0521:                sixthLinePanel.add(summaryTextField);
0522:
0523:                JPanel seventhLinePanel = new JPanel(new FlowLayout(
0524:                        FlowLayout.LEFT));
0525:                seventhLinePanel.add(descriptionLabel);
0526:                seventhLinePanel.add(descriptionScrollPane);
0527:
0528:                JPanel heightLinePanel = new JPanel(new FlowLayout(
0529:                        FlowLayout.CENTER));
0530:                heightLinePanel.add(commitButton);
0531:                heightLinePanel.add(cancelButton);
0532:
0533:                JPanel mainPanel = new JPanel();
0534:                mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
0535:                //mainPanel.add(firstLinePanel);
0536:
0537:                //mainPanel.add(secondLinePanel);
0538:                //mainPanel.add(thirdLinePanel);
0539:                mainPanel.add(gridPanel);
0540:                mainPanel.add(fourthLinePanel);
0541:
0542:                // Adding bug reproducibility if the bugtracker allows it
0543:                Vector reproducibilityNames = null;
0544:                if (bugTracker.isUsesBugReproducibily()) {
0545:                    reproducibilityLabel = new JLabel(Language.getInstance()
0546:                            .getText("reproducibility"));
0547:                    reproducibilityComboBoxModel = new DefaultComboBoxModel();
0548:
0549:                    reproducibilityNames = bugTracker
0550:                            .getBugTrackerReproductibilityList();
0551:                    if (reproducibilityNames != null) {
0552:                        for (int i = 0; i < reproducibilityNames.size(); i++) {
0553:                            reproducibilityComboBoxModel
0554:                                    .addElement(reproducibilityNames.get(i));
0555:                        }
0556:                        reproducibilityComboBox = new JComboBox(
0557:                                reproducibilityComboBoxModel);
0558:                    }
0559:
0560:                    fourthLinePanel2 = new JPanel(new FlowLayout(
0561:                            FlowLayout.LEFT));
0562:                    fourthLinePanel2.add(reproducibilityLabel);
0563:                    fourthLinePanel2.add(reproducibilityComboBox);
0564:                    mainPanel.add(fourthLinePanel2);
0565:                }
0566:
0567:                mainPanel.add(fifthLinePanel);
0568:                mainPanel.add(sixthLinePanel);
0569:                mainPanel.add(seventhLinePanel);
0570:                mainPanel.add(heightLinePanel);
0571:
0572:                add(mainPanel, BorderLayout.CENTER);
0573:
0574:            } // Fin du constructeur
0575:
0576:            void initComponent() {
0577:                userNameLabel = new JLabel(Language.getInstance().getText(
0578:                        "Utilisateurs"));
0579:                platformLabel = new JLabel(Language.getInstance().getText(
0580:                        "Plateforme_:_"));
0581:
0582:                productLabel = new JLabel(Language.getInstance().getText(
0583:                        "Bug_Environnement"));
0584:                osLabel = new JLabel(Language.getInstance().getText("OS_:"));
0585:                priorityLabel = new JLabel(Language.getInstance().getText(
0586:                        "Priorité_:_"));
0587:                severityLabel = new JLabel(Language.getInstance().getText(
0588:                        "Importance_:_"));
0589:                assignedToLabel = new JLabel(Language.getInstance().getText(
0590:                        "Destinataire_:_"));
0591:                urlLabel = new JLabel(Language.getInstance().getText(
0592:                        "URL_:____________"));
0593:                summaryLabel = new JLabel(Language.getInstance().getText(
0594:                        "Résumé_:______"));
0595:                descriptionLabel = new JLabel(Language.getInstance().getText(
0596:                        "Description_:_"));
0597:                statusLabel = new JLabel(Language.getInstance().getText(
0598:                        "Statut")
0599:                        + " : ");
0600:
0601:                platformComboBoxModel = new DefaultComboBoxModel();
0602:                priorityComboBoxModel = new DefaultComboBoxModel();
0603:                osComboBoxModel = new DefaultComboBoxModel();
0604:                severityComboBoxModel = new DefaultComboBoxModel();
0605:                assignedToComboBoxModel = new DefaultComboBoxModel();
0606:                statusComboBoxModel = new DefaultComboBoxModel();
0607:
0608:            }
0609:
0610:            /**
0611:             * Constructeur de la fenêtre pour montrer un bug 
0612:             */
0613:            public AskNewBugDefaultPanel(IBugJDialog pAskNewBug,
0614:                    BugTracker bugTrack, boolean editable, Attachment _theBug,
0615:                    String environement, String user, String plateforme,
0616:                    String os, String priority, String severity, String status,
0617:                    String reproducibility, String resolution,
0618:                    String recipient, String url, String resume,
0619:                    String description) {
0620:
0621:                // Init des composants de la fenêtre
0622:                super (new BorderLayout());
0623:
0624:                this .bugTracker = bugTrack;
0625:                this .pAskNewBug = pAskNewBug;
0626:                theBug = _theBug;
0627:                strEnvironement = environement;
0628:                initComponent();
0629:
0630:                productLabel.setText(productLabel.getText() + environement);
0631:                userNameLabel.setText(userNameLabel.getText() + " : " + user);
0632:
0633:                // OS, priorities, plateforms and severities
0634:                Vector osNames = bugTracker.getBugOSList();
0635:                Object selectedItem = null;
0636:                if (osNames != null && editable) {
0637:                    for (int i = 0; i < osNames.size(); i++) {
0638:                        if (osNames.elementAt(i).equals(os)) {
0639:                            selectedItem = osNames.elementAt(i);
0640:                        }
0641:                        osComboBoxModel.addElement(osNames.elementAt(i));
0642:                    }
0643:                } else {
0644:                    osComboBoxModel.addElement(os);
0645:                    selectedItem = os;
0646:                }
0647:
0648:                if (selectedItem != null) {
0649:                    osComboBoxModel.setSelectedItem(selectedItem);
0650:                }
0651:                selectedItem = null;
0652:
0653:                Vector prioritiesNames = bugTracker.getBugPriorityList();
0654:                if (prioritiesNames != null && editable) {
0655:                    for (int i = 0; i < prioritiesNames.size(); i++) {
0656:                        if (prioritiesNames.elementAt(i).equals(priority)) {
0657:                            selectedItem = prioritiesNames.elementAt(i);
0658:                        }
0659:                        priorityComboBoxModel.addElement(prioritiesNames
0660:                                .elementAt(i));
0661:                    }
0662:                } else {
0663:                    priorityComboBoxModel.addElement(priority);
0664:                    selectedItem = priority;
0665:                }
0666:
0667:                if (selectedItem != null) {
0668:                    priorityComboBoxModel.setSelectedItem(selectedItem);
0669:                }
0670:                selectedItem = null;
0671:
0672:                Vector platformsNames = bugTracker.getBugPlateformList();
0673:                if (platformsNames != null && editable) {
0674:                    for (int i = 0; i < platformsNames.size(); i++) {
0675:                        if (platformsNames.elementAt(i).equals(plateforme)) {
0676:                            selectedItem = platformsNames.elementAt(i);
0677:                        }
0678:                        platformComboBoxModel.addElement(platformsNames
0679:                                .elementAt(i));
0680:                    }
0681:                } else {
0682:                    platformComboBoxModel.addElement(plateforme);
0683:                    selectedItem = plateforme;
0684:                }
0685:                if (selectedItem != null) {
0686:                    platformComboBoxModel.setSelectedItem(selectedItem);
0687:                }
0688:                selectedItem = null;
0689:
0690:                Vector severityNames = bugTracker.getBugSeverityList();
0691:                if (severityNames != null && editable) {
0692:                    for (int i = 0; i < severityNames.size(); i++) {
0693:                        if (severityNames.elementAt(i).equals(severity)) {
0694:                            selectedItem = severityNames.elementAt(i);
0695:                        }
0696:                        severityComboBoxModel.addElement(severityNames
0697:                                .elementAt(i));
0698:                    }
0699:                } else {
0700:                    severityComboBoxModel.addElement(severity);
0701:                    selectedItem = severity;
0702:                }
0703:                if (selectedItem != null) {
0704:                    severityComboBoxModel.setSelectedItem(selectedItem);
0705:                }
0706:                selectedItem = null;
0707:
0708:                Vector assignedToVector = bugTracker.getBugTrackerAllUsers();
0709:                if (assignedToVector != null && editable) {
0710:                    for (int i = 0; i < assignedToVector.size(); i++) {
0711:                        if (assignedToVector.get(i).equals(recipient)) {
0712:                            selectedItem = assignedToVector.get(i);
0713:                        }
0714:                        assignedToComboBoxModel.addElement(assignedToVector
0715:                                .get(i));
0716:                    }
0717:                } else {
0718:                    assignedToComboBoxModel.addElement(recipient);
0719:                    selectedItem = recipient;
0720:                }
0721:                if (selectedItem != null) {
0722:                    assignedToComboBoxModel.setSelectedItem(selectedItem);
0723:                }
0724:                selectedItem = null;
0725:
0726:                Vector statusToVector = bugTracker.getBugTrackerStatusList();
0727:                if (statusToVector != null && editable) {
0728:                    for (int i = 0; i < statusToVector.size(); i++) {
0729:                        if (statusToVector.get(i).equals(status)) {
0730:                            selectedItem = statusToVector.get(i);
0731:                        }
0732:                        statusComboBoxModel.addElement(statusToVector.get(i));
0733:                    }
0734:                } else {
0735:                    statusComboBoxModel.addElement(status);
0736:                    selectedItem = status;
0737:                }
0738:                if (selectedItem != null) {
0739:                    statusComboBoxModel.setSelectedItem(selectedItem);
0740:                }
0741:                selectedItem = null;
0742:
0743:                platformComboBox = new JComboBox(platformComboBoxModel);
0744:                platformComboBox.setEditable(bugTrack.isEditablePlateForme()
0745:                        && editable);
0746:                osComboBox = new JComboBox(osComboBoxModel);
0747:                osComboBox.setEditable(bugTrack.isEditableOS() && editable);
0748:
0749:                priorityComboBox = new JComboBox(priorityComboBoxModel);
0750:                severityComboBox = new JComboBox(severityComboBoxModel);
0751:                assignedToComboBox = new JComboBox(assignedToComboBoxModel);
0752:                statusToComboBox = new JComboBox(statusComboBoxModel);
0753:
0754:                assignedToTextField = new JTextField(50);
0755:                assignedToTextField.setEditable(editable);
0756:
0757:                urlTextField = new JTextField(50);
0758:                urlTextField.setText(url);
0759:                urlTextField.setEditable(editable);
0760:
0761:                summaryTextField = new JTextField(50);
0762:                summaryTextField.setText(resume);
0763:                summaryTextField.setEditable(editable);
0764:
0765:                descriptionArea = new JTextArea(description);
0766:                descriptionArea.setEditable(editable);
0767:
0768:                JScrollPane descriptionScrollPane = new JScrollPane(
0769:                        descriptionArea);
0770:                descriptionScrollPane.setPreferredSize(new Dimension(500, 200));
0771:
0772:                commitButton = new JButton(Language.getInstance().getText(
0773:                        "Modifier"));
0774:                //commitButton.addActionListener(this);
0775:
0776:                modifyButton = new JButton(Language.getInstance().getText(
0777:                        "Modifier"));
0778:                modifyButton.addActionListener(this );
0779:                viewButton = new JButton(Language.getInstance().getText(
0780:                        "Visualiser")
0781:                        + " " + bugTrack.getBugTrackerName());
0782:                viewButton.addActionListener(this );
0783:
0784:                cancelButton = new JButton(Language.getInstance().getText(
0785:                        "Annuler"));
0786:                cancelButton.addActionListener(this );
0787:
0788:                JPanel firstLinePanel = new JPanel(new FlowLayout(
0789:                        FlowLayout.LEFT));
0790:                firstLinePanel.add(productLabel);
0791:                //firstLinePanel.add(Box.createRigidArea(new Dimension(350,1)));
0792:                JPanel firstLinePanel2 = new JPanel(new FlowLayout(
0793:                        FlowLayout.LEFT));
0794:                firstLinePanel2.add(userNameLabel);
0795:
0796:                JPanel secondLinePanel1 = new JPanel(new FlowLayout(
0797:                        FlowLayout.LEFT));
0798:                secondLinePanel1.add(platformLabel);
0799:                secondLinePanel1.add(platformComboBox);
0800:                //secondLinePanel.add(Box.createRigidArea(new Dimension(180,0)));
0801:                JPanel secondLinePanel2 = new JPanel(new FlowLayout(
0802:                        FlowLayout.LEFT));
0803:                secondLinePanel2.add(osLabel);
0804:                secondLinePanel2.add(osComboBox);
0805:
0806:                JPanel thirdLinePanel1 = new JPanel(new FlowLayout(
0807:                        FlowLayout.LEFT));
0808:                thirdLinePanel1.add(priorityLabel);
0809:                thirdLinePanel1.add(priorityComboBox);
0810:                //thirdLinePanel.add(Box.createRigidArea(new Dimension(180,0)));
0811:                JPanel thirdLinePanel2 = new JPanel(new FlowLayout(
0812:                        FlowLayout.LEFT));
0813:                thirdLinePanel2.add(severityLabel);
0814:                thirdLinePanel2.add(severityComboBox);
0815:
0816:                JPanel fourthLinePanel1 = new JPanel(new FlowLayout(
0817:                        FlowLayout.LEFT));
0818:                fourthLinePanel1.add(statusLabel);
0819:                fourthLinePanel1.add(statusToComboBox);
0820:
0821:                JPanel fourthLinePanel2 = new JPanel(new FlowLayout(
0822:                        FlowLayout.LEFT));
0823:                fourthLinePanel2.add(assignedToLabel);
0824:                fourthLinePanel2.add(assignedToComboBox);
0825:
0826:                JPanel gridPanel = new JPanel(new GridLayout(4, 2));
0827:                gridPanel.add(firstLinePanel);
0828:                gridPanel.add(firstLinePanel2);
0829:                gridPanel.add(secondLinePanel1);
0830:                gridPanel.add(secondLinePanel2);
0831:                gridPanel.add(thirdLinePanel2);
0832:                gridPanel.add(thirdLinePanel1);
0833:                gridPanel.add(fourthLinePanel1);
0834:                gridPanel.add(fourthLinePanel2);
0835:
0836:                // Adding bug reproducibility if the bug tracker allows it
0837:                JPanel gridPanel2 = null;
0838:                JPanel reproducibilityPanel = null;
0839:                Vector reproducibilityNames = null;
0840:                if (bugTracker.isUsesBugReproducibily()) {
0841:                    gridPanel2 = new JPanel(new GridLayout(1, 2));
0842:                    reproducibilityLabel = new JLabel(Language.getInstance()
0843:                            .getText("reproducibility"));
0844:                    reproducibilityComboBoxModel = new DefaultComboBoxModel();
0845:
0846:                    reproducibilityNames = bugTracker
0847:                            .getBugTrackerReproductibilityList();
0848:                    if (reproducibilityNames != null) {
0849:                        for (int i = 0; i < reproducibilityNames.size(); i++) {
0850:                            if (reproducibilityNames.elementAt(i).equals(
0851:                                    reproducibility)) {
0852:                                selectedItem = reproducibilityNames
0853:                                        .elementAt(i);
0854:                            }
0855:                            reproducibilityComboBoxModel
0856:                                    .addElement(reproducibilityNames.get(i));
0857:                        }
0858:                    } else {
0859:                        reproducibilityComboBoxModel
0860:                                .addElement(reproducibility);
0861:                        selectedItem = reproducibility;
0862:                    }
0863:
0864:                    if (selectedItem != null) {
0865:                        reproducibilityComboBoxModel
0866:                                .setSelectedItem(selectedItem);
0867:                    }
0868:
0869:                    selectedItem = null;
0870:                    reproducibilityComboBox = new JComboBox(
0871:                            reproducibilityComboBoxModel);
0872:                    reproducibilityPanel = new JPanel(new FlowLayout(
0873:                            FlowLayout.LEFT));
0874:                    reproducibilityPanel.add(reproducibilityLabel);
0875:                    reproducibilityPanel.add(reproducibilityComboBox);
0876:                    gridPanel2.add(reproducibilityPanel);
0877:                }
0878:
0879:                // Adding bug resolution if the begtrcker allows it
0880:                JPanel resolutionPanel = null;
0881:                Vector resolutionNames = null;
0882:                if (bugTracker.isUsesBugResolution()) {
0883:                    resolutionLabel = new JLabel(Language.getInstance()
0884:                            .getText("resolution"));
0885:                    resolutionComboBoxModel = new DefaultComboBoxModel();
0886:
0887:                    resolutionNames = bugTracker.getBugTrackerResolutionList();
0888:                    if (resolutionNames != null) {
0889:                        for (int i = 0; i < resolutionNames.size(); i++) {
0890:                            if (resolutionNames.elementAt(i).equals(resolution)) {
0891:                                selectedItem = resolutionNames.elementAt(i);
0892:                            }
0893:                            resolutionComboBoxModel.addElement(resolutionNames
0894:                                    .get(i));
0895:                        }
0896:                    } else {
0897:                        resolutionComboBoxModel.addElement(resolution);
0898:                        selectedItem = resolution;
0899:                    }
0900:
0901:                    if (selectedItem != null) {
0902:                        resolutionComboBoxModel.setSelectedItem(selectedItem);
0903:                    }
0904:
0905:                    selectedItem = null;
0906:                    resolutionComboBox = new JComboBox(resolutionComboBoxModel);
0907:                    resolutionPanel = new JPanel(
0908:                            new FlowLayout(FlowLayout.LEFT));
0909:                    resolutionPanel.add(resolutionLabel);
0910:                    resolutionPanel.add(resolutionComboBox);
0911:                    if (gridPanel2 == null) {
0912:                        gridPanel2 = resolutionPanel;
0913:                    } else {
0914:                        gridPanel2.add(resolutionPanel);
0915:                    }
0916:                }
0917:
0918:                JPanel fifthLinePanel = new JPanel(new FlowLayout(
0919:                        FlowLayout.LEFT));
0920:                fifthLinePanel.add(urlLabel);
0921:                fifthLinePanel.add(urlTextField);
0922:
0923:                JPanel sixthLinePanel = new JPanel(new FlowLayout(
0924:                        FlowLayout.LEFT));
0925:                sixthLinePanel.add(summaryLabel);
0926:                sixthLinePanel.add(summaryTextField);
0927:
0928:                JPanel seventhLinePanel = new JPanel(new FlowLayout(
0929:                        FlowLayout.LEFT));
0930:                seventhLinePanel.add(descriptionLabel);
0931:                seventhLinePanel.add(descriptionScrollPane);
0932:
0933:                JPanel heightLinePanel = new JPanel(new FlowLayout(
0934:                        FlowLayout.CENTER));
0935:
0936:                heightLinePanel.add(cancelButton);
0937:                if (editable) {
0938:                    heightLinePanel.add(modifyButton);
0939:                }
0940:                heightLinePanel.add(viewButton);
0941:                JPanel mainPanel = new JPanel();
0942:                mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
0943:                //mainPanel.add(firstLinePanel);
0944:
0945:                //mainPanel.add(secondLinePanel);
0946:                //mainPanel.add(thirdLinePanel);
0947:                mainPanel.add(gridPanel);
0948:                if (gridPanel2 != null) {
0949:                    mainPanel.add(gridPanel2);
0950:                }
0951:                mainPanel.add(fifthLinePanel);
0952:                mainPanel.add(sixthLinePanel);
0953:                mainPanel.add(seventhLinePanel);
0954:                mainPanel.add(heightLinePanel);
0955:
0956:                add(mainPanel, BorderLayout.CENTER);
0957:
0958:            } // Fin du constructeur
0959:
0960:            public void actionPerformed(ActionEvent e) {
0961:                if (e.getSource().equals(cancelButton)) {
0962:                    cancelPerformed(e);
0963:                } else if (e.getSource().equals(commitButton)) {
0964:                    commitPerformed(e);
0965:                } else if (e.getSource().equals(modifyButton)) {
0966:                    modifyPerformed(e);
0967:                } else if (e.getSource().equals(viewButton)) {
0968:                    viewPerformed(e);
0969:                }
0970:            }
0971:
0972:            void viewPerformed(ActionEvent e) {
0973:                pAskNewBug.onViewPerformed();
0974:                bugTracker.showBugInBugTracker(theBug);
0975:            }
0976:
0977:            void modifyPerformed(ActionEvent e) {
0978:
0979:                String summary = summaryTextField.getText().trim();
0980:                if ((summary == null) || (summary.equals(""))) {
0981:                    JOptionPane.showMessageDialog(new Frame(), Language
0982:                            .getInstance().getText("Must_fill_summary"),
0983:                            Language.getInstance().getText("Erreur_!"),
0984:                            JOptionPane.ERROR_MESSAGE);
0985:                    return;
0986:                }
0987:
0988:                String long_desc = descriptionArea.getText();
0989:                String assigned_to = (String) assignedToComboBox
0990:                        .getSelectedItem();
0991:                String url_attach = urlTextField.getText().trim();
0992:                String bug_severity = (String) severityComboBox
0993:                        .getSelectedItem();
0994:                String bug_satus = (String) statusToComboBox.getSelectedItem();
0995:                String short_desc = summaryTextField.getText();
0996:                String bug_OS = ((String) osComboBox.getSelectedItem()).trim();
0997:                String bug_priority = (String) priorityComboBox
0998:                        .getSelectedItem();
0999:                String bug_platform = ((String) platformComboBox
1000:                        .getSelectedItem()).trim();
1001:                String bug_env = strEnvironement;
1002:                String bug_reproducibility = null;
1003:                String bug_resolution = null;
1004:                if ((bugTracker.isUsesBugReproducibily())
1005:                        && (bugTracker.getBugTrackerReproductibilityList() != null)) {
1006:                    bug_reproducibility = ((String) reproducibilityComboBox
1007:                            .getSelectedItem()).trim();
1008:                }
1009:                if ((bugTracker.isUsesBugResolution())
1010:                        && (bugTracker.getBugTrackerResolutionList() != null)) {
1011:                    bug_resolution = ((String) resolutionComboBox
1012:                            .getSelectedItem()).trim();
1013:                }
1014:
1015:                //TODO
1016:                try {
1017:                    bugTracker.modifyBug(theBug, long_desc, assigned_to,
1018:                            url_attach, bug_severity, bug_satus, short_desc,
1019:                            bug_OS, bug_priority, bug_platform, bug_env,
1020:                            bug_reproducibility, bug_resolution);
1021:                    pAskNewBug.onModifyPerformed();
1022:                } catch (Exception E) {
1023:                    pAskNewBug.onModifyPerformed();
1024:                    Tools.ihmExceptionView(E);
1025:                    E.printStackTrace();
1026:                }
1027:
1028:            }
1029:
1030:            void cancelPerformed(ActionEvent e) {
1031:                pAskNewBug.onCancelPerformed();
1032:            }
1033:
1034:            void commitPerformed(ActionEvent e) {
1035:                String summary = summaryTextField.getText().trim();
1036:                if ((summary == null) || (summary.equals(""))) {
1037:                    JOptionPane.showMessageDialog(new Frame(), Language
1038:                            .getInstance().getText("Must_fill_summary"),
1039:                            Language.getInstance().getText("Erreur_!"),
1040:                            JOptionPane.ERROR_MESSAGE);
1041:                    return;
1042:                }
1043:
1044:                Attachment bugURL = null;
1045:                // Adding the bug
1046:                try {
1047:                    String id = "["
1048:                            + currentTest.getTestListFromModel()
1049:                                    .getFamilyFromModel().getNameFromModel()
1050:                            + "."
1051:                            + currentTest.getTestListFromModel()
1052:                                    .getNameFromModel() + "." + currentTest
1053:                            + " | "
1054:                            + DataModel.getCurrentCampaign().getNameFromModel()
1055:                            + "." + exec + "]";
1056:                    String long_desc = descriptionArea.getText();
1057:                    long_desc = id + "\n" + long_desc;
1058:
1059:                    String bug_reproducibility = null;
1060:                    if ((bugTracker.isUsesBugReproducibily())
1061:                            && (bugTracker.getBugTrackerReproductibilityList() != null)) {
1062:                        bug_reproducibility = ((String) reproducibilityComboBox
1063:                                .getSelectedItem()).trim();
1064:                    }
1065:
1066:                    //TODO
1067:                    bugURL = bugTracker.addBug(long_desc,
1068:                            (String) assignedToComboBox.getSelectedItem(),
1069:                            urlTextField.getText().trim(),
1070:                            (String) severityComboBox.getSelectedItem(),
1071:                            summaryTextField.getText(), (String) osComboBox
1072:                                    .getSelectedItem(),
1073:                            (String) priorityComboBox.getSelectedItem(),
1074:                            (String) platformComboBox.getSelectedItem(),
1075:                            bug_reproducibility, DataModel
1076:                                    .getObservedExecution(), DataModel
1077:                                    .getObservedExecutionResult(), currentTest);
1078:                } catch (Exception E) {
1079:                    E.printStackTrace();
1080:                }
1081:
1082:                pAskNewBug.onCommitPerformed(bugURL);
1083:            }
1084:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.