Source Code Cross Referenced for DefectViewPanel.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » mantis » 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.mantis 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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