Source Code Cross Referenced for AskNewExecution.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » ihm » main » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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


0001:        /*
0002:         * SalomeTMF is a Test Management Framework
0003:         * Copyright (C) 2005 France Telecom R&D
0004:         *
0005:         * This library is free software; you can redistribute it and/or
0006:         * modify it under the terms of the GNU Lesser General Public
0007:         * License as published by the Free Software Foundation; either
0008:         * version 2 of the License, or (at your option) any later version.
0009:         *
0010:         * This library is distributed in the hope that it will be useful,
0011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013:         * Lesser General Public License for more details.
0014:         *
0015:         * You should have received a copy of the GNU Lesser General Public
0016:         * License along with this library; if not, write to the Free Software
0017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0018:         *
0019:         * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
0020:         *
0021:         * Contact: mikael.marche@rd.francetelecom.com
0022:         */
0023:
0024:        package org.objectweb.salome_tmf.ihm.main;
0025:
0026:        import java.awt.Color;
0027:        import java.awt.Container;
0028:        import java.awt.Dimension;
0029:        import java.awt.FlowLayout;
0030:        import java.awt.GraphicsConfiguration;
0031:        import java.awt.GraphicsDevice;
0032:        import java.awt.GraphicsEnvironment;
0033:        import java.awt.Rectangle;
0034:        import java.awt.event.ActionEvent;
0035:        import java.awt.event.ActionListener;
0036:        import java.awt.event.WindowEvent;
0037:        import java.awt.event.WindowListener;
0038:        import java.io.File;
0039:        import java.sql.Date;
0040:        import java.util.ArrayList;
0041:        import java.util.Collection;
0042:        import java.util.Enumeration;
0043:        import java.util.GregorianCalendar;
0044:        import java.util.HashSet;
0045:        import java.util.Iterator;
0046:        import java.util.Set;
0047:        import java.util.StringTokenizer;
0048:        import java.util.Vector;
0049:
0050:        import javax.swing.BorderFactory;
0051:        import javax.swing.Box;
0052:        import javax.swing.BoxLayout;
0053:        import javax.swing.DefaultComboBoxModel;
0054:        import javax.swing.JButton;
0055:        import javax.swing.JComboBox;
0056:        import javax.swing.JDialog;
0057:        import javax.swing.JFileChooser;
0058:        import javax.swing.JLabel;
0059:        import javax.swing.JOptionPane;
0060:        import javax.swing.JPanel;
0061:        import javax.swing.JTabbedPane;
0062:        import javax.swing.JTextField;
0063:
0064:        import org.java.plugin.Extension;
0065:        import org.objectweb.salome_tmf.api.Api;
0066:        import org.objectweb.salome_tmf.api.ApiConstants;
0067:        import org.objectweb.salome_tmf.api.Permission;
0068:        import org.objectweb.salome_tmf.data.Campaign;
0069:        import org.objectweb.salome_tmf.data.DataConstants;
0070:        import org.objectweb.salome_tmf.data.DataLoader;
0071:        import org.objectweb.salome_tmf.data.DataSet;
0072:        import org.objectweb.salome_tmf.data.Environment;
0073:        import org.objectweb.salome_tmf.data.Execution;
0074:        import org.objectweb.salome_tmf.data.Parameter;
0075:        import org.objectweb.salome_tmf.data.Script;
0076:        import org.objectweb.salome_tmf.data.Test;
0077:        import org.objectweb.salome_tmf.ihm.languages.Language;
0078:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
0079:        import org.objectweb.salome_tmf.ihm.main.datawrapper.TestMethods;
0080:        import org.objectweb.salome_tmf.ihm.models.ScriptFileFilter;
0081:        import org.objectweb.salome_tmf.ihm.tools.Tools;
0082:
0083:        /**
0084:         * Classe qui définit la fenêtre permettant de créer une nouvelle exécution
0085:         * @author teaml039
0086:         * @version : 0.1
0087:         */
0088:        public class AskNewExecution extends JDialog implements  ApiConstants,
0089:                DataConstants, ActionListener {
0090:
0091:            /**
0092:             * Label pour récupérer le nom de l'exécution
0093:             */
0094:            JLabel executionName;
0095:
0096:            /**
0097:             * Champ pour récupérer le nom de l'exécution
0098:             */
0099:            JTextField executionNameTextField;
0100:
0101:            /**
0102:             * Label de la date de création
0103:             */
0104:            JLabel creationDate;
0105:
0106:            /**
0107:             * Modèle de données pour la liste déroulante des jeux de données
0108:             */
0109:            private DefaultComboBoxModel comboModelForDataSet;
0110:
0111:            /**
0112:             * Liste déroulante des jeux de données
0113:             */
0114:            JComboBox dataSetComboBox;
0115:
0116:            /**
0117:             * Bouton pour entrer un nouveau jeu de données
0118:             */
0119:            JButton newDataSetButton;
0120:
0121:            /**
0122:             * Label du script d'initialisation
0123:             */
0124:            JLabel initScriptLabel;
0125:
0126:            /**
0127:             * Label du script de restitution
0128:             */
0129:            JLabel restitutionScriptLabel;
0130:
0131:            /**
0132:             * Bouton pour ajouter un script d'initialisation
0133:             */
0134:            JButton addInitScriptButton;
0135:
0136:            /**
0137:             * Bouton pour supprimer un script d'initialisation
0138:             */
0139:            JButton removeInitScriptButton;
0140:
0141:            /**
0142:             * Bouton pour ajouter un script de restitution
0143:             */
0144:            JButton addRestitutionScriptButton;
0145:
0146:            /**
0147:             * Bouton pour supprimer un script de restitution
0148:             */
0149:            JButton removeRestitutionScriptButton;
0150:
0151:            /**
0152:             * Modèle de données de la liste déroulante des environnements
0153:             */
0154:            private DefaultComboBoxModel comboModelForEnvironment;
0155:
0156:            /**
0157:             * Liste déroulante des environnements
0158:             */
0159:            JComboBox environmentComboBox;
0160:
0161:            /**
0162:             * Bouton pour entrer un nouvel environnement
0163:             */
0164:            JButton newEnvironmentButton;
0165:
0166:            JButton validationButton;
0167:            JButton cancelButton;
0168:
0169:            /**
0170:             * Date de création
0171:             */
0172:            Date time;
0173:
0174:            /**
0175:             * Nouvelle exécution
0176:             */
0177:            Execution execution;
0178:
0179:            AttachmentView attachmentPanel;
0180:
0181:            Script initScript;
0182:
0183:            Script restitutionScript;
0184:
0185:            File initScriptFile;
0186:
0187:            File restitutionScriptFile;
0188:
0189:            String message;
0190:
0191:            static ScriptFileFilter[] tabPlugScriptFileFilter = null;
0192:            static JFileChooser fileChooser = new JFileChooser();
0193:            /**************************************************************************/
0194:            /**							CONSTRUCTEURS								***/
0195:            /**************************************************************************/
0196:            boolean initNewFile = false;
0197:            boolean restitutionNewFile = false;
0198:
0199:            /**
0200:             * Constructeur de la fenêtre
0201:             */
0202:            public AskNewExecution(Execution exec) {
0203:
0204:                super (SalomeTMFContext.getInstance().ptrFrame, true);
0205:
0206:                int t_x = 1024 - 100;
0207:                int t_y = 768 / 3 * 2 - 50;
0208:                int t_x2 = 1024;
0209:                int t_y2 = 768;
0210:                try {
0211:                    GraphicsEnvironment ge = GraphicsEnvironment
0212:                            .getLocalGraphicsEnvironment();
0213:                    GraphicsDevice[] gs = ge.getScreenDevices();
0214:                    GraphicsDevice gd = gs[0];
0215:                    GraphicsConfiguration[] gc = gd.getConfigurations();
0216:                    Rectangle r = gc[0].getBounds();
0217:                    t_x = r.width - 100;
0218:                    t_y = r.height / 3 * 2 - 50;
0219:                    t_x2 = r.width;
0220:                    t_y2 = r.height;
0221:                } catch (Exception E) {
0222:
0223:                }
0224:
0225:                executionName = new JLabel(Language.getInstance().getText(
0226:                        "Nom_de_l'exécution_:_"));
0227:                executionNameTextField = new JTextField(20);
0228:                creationDate = new JLabel();
0229:                comboModelForDataSet = new DefaultComboBoxModel();
0230:                dataSetComboBox = new JComboBox(comboModelForDataSet);
0231:                newDataSetButton = new JButton(Language.getInstance().getText(
0232:                        "Nouveau"));
0233:                initScriptLabel = new JLabel(Language.getInstance().getText(
0234:                        "Script_d'initialisation_:_"));
0235:                restitutionScriptLabel = new JLabel(Language.getInstance()
0236:                        .getText("Script_de_restitution_:_"));
0237:                addInitScriptButton = new JButton(Language.getInstance()
0238:                        .getText("Ajouter"));
0239:                removeInitScriptButton = new JButton(Language.getInstance()
0240:                        .getText("Supprimer"));
0241:                addRestitutionScriptButton = new JButton(Language.getInstance()
0242:                        .getText("Ajouter"));
0243:                removeRestitutionScriptButton = new JButton(Language
0244:                        .getInstance().getText("Supprimer"));
0245:                comboModelForEnvironment = new DefaultComboBoxModel();
0246:                newEnvironmentButton = new JButton(Language.getInstance()
0247:                        .getText("Nouveau"));
0248:                environmentComboBox = new JComboBox(comboModelForEnvironment);
0249:                JPanel namePanel = new JPanel();
0250:                namePanel.add(executionName);
0251:                namePanel.add(executionNameTextField);
0252:
0253:                if (exec != null) {
0254:                    time = exec.getCreationDateFromModel();
0255:                } else {
0256:                    time = new Date(GregorianCalendar.getInstance()
0257:                            .getTimeInMillis());
0258:                    creationDate.setText(Language.getInstance().getText(
0259:                            "Date_de_création_:_")
0260:                            + time);
0261:                }
0262:                // Jeu de données
0263:
0264:                JPanel comboDataSetPanel = new JPanel(new FlowLayout(
0265:                        FlowLayout.LEFT));
0266:                comboDataSetPanel.add(dataSetComboBox);
0267:
0268:                JPanel newDataSetButtonPanel = new JPanel(new FlowLayout(
0269:                        FlowLayout.LEFT));
0270:                newDataSetButtonPanel.add(newDataSetButton);
0271:
0272:                JPanel dataSetPanel = new JPanel();
0273:                dataSetPanel.setLayout(new BoxLayout(dataSetPanel,
0274:                        BoxLayout.Y_AXIS));
0275:                dataSetPanel.add(comboDataSetPanel);
0276:                dataSetPanel.add(Box.createRigidArea(new Dimension(1, 5)));
0277:                dataSetPanel.add(newDataSetButtonPanel);
0278:                dataSetPanel.setBorder(BorderFactory.createTitledBorder(
0279:                        BorderFactory.createLineBorder(Color.BLACK), Language
0280:                                .getInstance().getText("Jeu_de_données")));
0281:
0282:                // Scripts
0283:                addInitScriptButton.addActionListener(this );
0284:                addRestitutionScriptButton.addActionListener(this );
0285:                removeInitScriptButton.addActionListener(this );
0286:                removeRestitutionScriptButton.addActionListener(this );
0287:
0288:                JPanel initLabelPanel = new JPanel(new FlowLayout(
0289:                        FlowLayout.LEFT));
0290:                initLabelPanel.add(initScriptLabel);
0291:
0292:                JPanel initButtonPanel = new JPanel(new FlowLayout(
0293:                        FlowLayout.LEFT));
0294:                initButtonPanel.add(addInitScriptButton);
0295:                initButtonPanel.add(removeInitScriptButton);
0296:
0297:                JPanel restLabelPanel = new JPanel(new FlowLayout(
0298:                        FlowLayout.LEFT));
0299:                restLabelPanel.add(restitutionScriptLabel);
0300:
0301:                JPanel restButtonPanel = new JPanel(new FlowLayout(
0302:                        FlowLayout.LEFT));
0303:                restButtonPanel.add(addRestitutionScriptButton);
0304:                restButtonPanel.add(removeRestitutionScriptButton);
0305:
0306:                JPanel allScriptPanel = new JPanel();
0307:                allScriptPanel.setLayout(new BoxLayout(allScriptPanel,
0308:                        BoxLayout.Y_AXIS));
0309:                allScriptPanel.setBorder(BorderFactory.createTitledBorder(
0310:                        BorderFactory.createLineBorder(Color.BLACK), Language
0311:                                .getInstance().getText("Scripts")));
0312:                allScriptPanel.add(initLabelPanel);
0313:                allScriptPanel.add(initButtonPanel);
0314:                allScriptPanel.add(Box.createRigidArea(new Dimension(1, 10)));
0315:                allScriptPanel.add(restLabelPanel);
0316:                allScriptPanel.add(restButtonPanel);
0317:
0318:                newEnvironmentButton.setToolTipText(Language.getInstance()
0319:                        .getText("Nouvel_environnement"));
0320:                newEnvironmentButton.addActionListener(this );
0321:
0322:                newDataSetButton.setToolTipText(Language.getInstance().getText(
0323:                        "Nouveau_jeu_de_données"));
0324:                newDataSetButton.addActionListener(this );
0325:                // Context
0326:                JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
0327:                comboPanel.add(environmentComboBox);
0328:
0329:                JPanel contextButtonPanel = new JPanel(new FlowLayout(
0330:                        FlowLayout.LEFT));
0331:                contextButtonPanel.add(newEnvironmentButton);
0332:
0333:                JPanel contextPanel = new JPanel();
0334:                contextPanel.setLayout(new BoxLayout(contextPanel,
0335:                        BoxLayout.Y_AXIS));
0336:                contextPanel.add(comboPanel);
0337:                contextPanel.add(Box.createRigidArea(new Dimension(1, 5)));
0338:                contextPanel.add(contextButtonPanel);
0339:                contextPanel.setBorder(BorderFactory.createTitledBorder(
0340:                        BorderFactory.createLineBorder(Color.BLACK), Language
0341:                                .getInstance().getText("Environnement")));
0342:
0343:                // validation
0344:                validationButton = new JButton(Language.getInstance().getText(
0345:                        "Valider"));
0346:                validationButton.addActionListener(this );
0347:
0348:                cancelButton = new JButton(Language.getInstance().getText(
0349:                        "Annuler"));
0350:                cancelButton.addActionListener(this );
0351:
0352:                JPanel validationPanel = new JPanel(new FlowLayout(
0353:                        FlowLayout.CENTER));
0354:                validationPanel.add(validationButton);
0355:                validationPanel.add(cancelButton);
0356:
0357:                initData(exec);
0358:                DataModel.setObservedExecution(execution);
0359:                //attachmentPanel = new AttachmentView(DataModel.getApplet(), EXECUTION, EXECUTION, exec, SMALL_SIZE_FOR_ATTACH, null, null, null);
0360:                attachmentPanel = new AttachmentView(DataModel.getApplet(),
0361:                        EXECUTION, EXECUTION, execution, SMALL_SIZE_FOR_ATTACH,
0362:                        this );
0363:                attachmentPanel.setBorder(BorderFactory.createTitledBorder(
0364:                        BorderFactory.createLineBorder(Color.BLACK), Language
0365:                                .getInstance().getText("Attachements")));
0366:
0367:                /*
0368:                JPanel allPanel = new JPanel();
0369:                allPanel.setLayout(new BoxLayout(allPanel, BoxLayout.Y_AXIS));
0370:                allPanel.add(namePanel);
0371:                allPanel.add(creationDate);
0372:                allPanel.add(dataSetPanel);
0373:                allPanel.add(contextPanel);
0374:                allPanel.add(allScriptPanel);
0375:                allPanel.add(attachmentPanel);
0376:                allPanel.add(validationPanel);
0377:                 */
0378:                JTabbedPane pJTabbedPane = new JTabbedPane();
0379:                Container contentPaneFrame = this .getContentPane();
0380:                contentPaneFrame.setLayout(new BoxLayout(contentPaneFrame,
0381:                        BoxLayout.Y_AXIS));
0382:                contentPaneFrame.setSize(t_x, t_y);
0383:                JPanel allPanel = new JPanel();
0384:                allPanel.setLayout(new BoxLayout(allPanel, BoxLayout.Y_AXIS));
0385:                allPanel.add(namePanel);
0386:                allPanel.add(creationDate);
0387:                allPanel.add(dataSetPanel);
0388:                allPanel.add(contextPanel);
0389:                allPanel.add(allScriptPanel);
0390:
0391:                pJTabbedPane.add(Language.getInstance().getText("Exécution"),
0392:                        allPanel);
0393:                pJTabbedPane.add(
0394:                        Language.getInstance().getText("Attachements"),
0395:                        attachmentPanel);
0396:
0397:                contentPaneFrame.add(pJTabbedPane);
0398:                contentPaneFrame.add(validationPanel);
0399:
0400:                //initData(exec);
0401:                giveAccessToIhmExecutionView();
0402:                this .addWindowListener(new WindowListener() {
0403:                    public void windowClosing(WindowEvent e) {
0404:                        execution = null;
0405:                        DataModel.initAttachmentTable(DataModel
0406:                                .getCurrentCampaign()
0407:                                .getAttachmentMapFromModel().values());
0408:                    }
0409:
0410:                    public void windowDeiconified(WindowEvent e) {
0411:                    }
0412:
0413:                    public void windowOpened(WindowEvent e) {
0414:                    }
0415:
0416:                    public void windowActivated(WindowEvent e) {
0417:                    }
0418:
0419:                    public void windowDeactivated(WindowEvent e) {
0420:                    }
0421:
0422:                    public void windowClosed(WindowEvent e) {
0423:                    }
0424:
0425:                    public void windowIconified(WindowEvent e) {
0426:                    }
0427:                });
0428:
0429:                if (tabPlugScriptFileFilter == null) {
0430:                    initTabPlugScriptFileFilter();
0431:                }
0432:                // this.setLocation((t_x2 - t_x)/2,20);
0433:                //this.setLocation(300,20);
0434:                if (exec != null) {
0435:                    this .setTitle(Language.getInstance().getText(
0436:                            "Modifier_l'exécution"));
0437:                } else {
0438:                    this .setTitle(Language.getInstance().getText(
0439:                            "Nouvelle_exécution"));
0440:                }
0441:                /*this.pack();
0442:                this.setLocationRelativeTo(this.getParent()); 
0443:                this.setVisible(true);**/
0444:                centerScreen();
0445:
0446:            } // Fin du constructeur AskNewExecution/0
0447:
0448:            void centerScreen() {
0449:                Dimension dim = getToolkit().getScreenSize();
0450:                this .pack();
0451:                Rectangle abounds = getBounds();
0452:                setLocation((dim.width - abounds.width) / 2,
0453:                        (dim.height - abounds.height) / 2);
0454:                this .setVisible(true);
0455:                requestFocus();
0456:            }
0457:
0458:            /******************************************************************************/
0459:            /** 							ACCESSEURS ET MUTATEURS						***/
0460:            /******************************************************************************/
0461:
0462:            /**
0463:             * Retourne l'exécution créée
0464:             * @return l'exécution créée
0465:             */
0466:            public Execution getExecution() {
0467:                return execution;
0468:            } // Fin de la méthode getExecution/0
0469:
0470:            private void initTabPlugScriptFileFilter() {
0471:                if (SalomeTMFContext.getInstance().associatedScriptEngine
0472:                        .size() == 0) {
0473:                    removeInitScriptButton.setEnabled(false);
0474:                    addInitScriptButton.setEnabled(false);
0475:                    addRestitutionScriptButton.setEnabled(false);
0476:                    removeRestitutionScriptButton.setEnabled(false);
0477:                    fileChooser = null;
0478:                    return;
0479:                }
0480:
0481:                tabPlugScriptFileFilter = new ScriptFileFilter[SalomeTMFContext
0482:                        .getInstance().associatedScriptEngine.size()];
0483:                Enumeration e = SalomeTMFContext.getInstance().associatedScriptEngine
0484:                        .keys();
0485:                int i = 0;
0486:                while (e.hasMoreElements()) {
0487:                    Extension ScriptExt = (Extension) e.nextElement();
0488:                    String extID = ScriptExt.getId();
0489:                    String extList = (String) SalomeTMFContext.getInstance().associatedScriptEngine
0490:                            .get(ScriptExt);
0491:                    StringTokenizer st = new StringTokenizer(extList, ",");
0492:                    String[] tabExt = new String[st.countTokens()];
0493:                    //System.out.println("Add extension " + extID + ", with filter :" + extList);
0494:                    int j = 0;
0495:                    while (st.hasMoreTokens()) {
0496:                        tabExt[j] = st.nextToken();
0497:                        j++;
0498:                    }
0499:                    tabPlugScriptFileFilter[i] = new ScriptFileFilter(extID,
0500:                            tabExt);
0501:                    i++;
0502:                }
0503:                int tabFilterSize = tabPlugScriptFileFilter.length;
0504:                for (i = 0; i < tabFilterSize; i++) {
0505:                    fileChooser
0506:                            .addChoosableFileFilter(tabPlugScriptFileFilter[i]);
0507:                }
0508:                fileChooser.setAcceptAllFileFilterUsed(false);
0509:            }
0510:
0511:            /**
0512:             *
0513:             *
0514:             */
0515:            public void initData(Execution exec) {
0516:                DataModel.getAttachmentTableModel().clearTable();
0517:                comboModelForDataSet.addElement(DataLoader.getEmptyDataSet());
0518:                for (int i = 0; i < DataModel.getCurrentCampaign()
0519:                        .getDataSetListFromModel().size(); i++) {
0520:                    comboModelForDataSet.addElement(DataModel
0521:                            .getCurrentCampaign().getDataSetListFromModel()
0522:                            .get(i));
0523:                }
0524:                //comboModelForEnvironment.addElement(TestData.getEmptyEnvironment());
0525:                for (int j = 0; j < DataModel.getCurrentProject()
0526:                        .getEnvironmentListFromModel().size(); j++) {
0527:                    comboModelForEnvironment.addElement(DataModel
0528:                            .getCurrentProject().getEnvironmentListFromModel()
0529:                            .get(j));
0530:                }
0531:                if (exec != null) {
0532:                    execution = exec;
0533:
0534:                    executionNameTextField.setText(exec.getNameFromModel());
0535:
0536:                    if (exec.getDataSetFromModel() != null) {
0537:                        comboModelForDataSet.setSelectedItem(exec
0538:                                .getDataSetFromModel());
0539:                    }
0540:
0541:                    comboModelForEnvironment.setSelectedItem(exec
0542:                            .getEnvironmentFromModel());
0543:
0544:                    if (exec.getExecutionResultListFromModel().size() != 0) {
0545:                        dataSetComboBox.setEnabled(false);
0546:                        newDataSetButton.setEnabled(false);
0547:                        environmentComboBox.setEnabled(false);
0548:                        newEnvironmentButton.setEnabled(false);
0549:                        addInitScriptButton.setEnabled(false);
0550:                        removeInitScriptButton.setEnabled(false);
0551:                        addRestitutionScriptButton.setEnabled(false);
0552:                        removeRestitutionScriptButton.setEnabled(false);
0553:                    }
0554:
0555:                    if (exec.getPreScriptFromModel() != null) {
0556:                        initScriptLabel.setText(Language.getInstance().getText(
0557:                                "Script_d'initialisation_:_")
0558:                                + exec.getPreScriptFromModel()
0559:                                        .getNameFromModel());
0560:                        initScript = exec.getPreScriptFromModel();
0561:
0562:                    }
0563:
0564:                    if (exec.getPostScriptFromModel() != null) {
0565:                        restitutionScriptLabel.setText(Language.getInstance()
0566:                                .getText("Script_de_restitution_:_")
0567:                                + exec.getPostScriptFromModel()
0568:                                        .getNameFromModel());
0569:                        restitutionScript = exec.getPostScriptFromModel();
0570:                    }
0571:
0572:                    Collection col = exec.getAttachmentMapFromModel().values();
0573:                    DataModel.initAttachmentTable(col);
0574:
0575:                } else {
0576:                    execution = new Execution("", "");
0577:                    int i = DataModel.getExecutionTableModel().getRowCount();
0578:                    Campaign camp = DataModel.getCurrentCampaign();
0579:                    while (camp.getExecutionListFromModel().contains(
0580:                            camp.getExecutionFromModel("Exec" + i))) {
0581:                        i++;
0582:                    }
0583:                    executionNameTextField.setText("Exec" + i);
0584:                }
0585:            } // Fin de la méthode initData/0
0586:
0587:            /**
0588:             * Liste les parametres du jeux de données valué par l'eNvironnement
0589:             * @param dataSet
0590:             * @param env
0591:             * @return
0592:             */
0593:            private Vector parameterConflict(DataSet dataSet, Environment env) {
0594:                //String result = "";
0595:                Vector result = new Vector();
0596:                if (dataSet != null && env != null) {
0597:                    Set keysSet = dataSet.getParametersHashMapFromModel()
0598:                            .keySet();
0599:                    for (Iterator iter = keysSet.iterator(); iter.hasNext();) {
0600:                        String paramName = (String) iter.next();
0601:                        Parameter param = DataModel.getCurrentProject()
0602:                                .getParameterFromModel(paramName);
0603:                        if (env.containsParameterInModel(param)) {
0604:                            //result = result + " " + param.getNameFromModel() +"\n";
0605:                            result.add(param);
0606:                        }
0607:                    }
0608:                }
0609:                return result;
0610:            }
0611:
0612:            /**
0613:             * @return
0614:             */
0615:            public File getInitScriptFile() {
0616:                return initScriptFile;
0617:            }
0618:
0619:            /**
0620:             * @return
0621:             */
0622:            public File getRestitutionScriptFile() {
0623:                return restitutionScriptFile;
0624:            }
0625:
0626:            private DataSet createDataSetFromCampaign(HashSet setOfParam,
0627:                    Environment env, ArrayList notValuedParamList) {
0628:                DataSet dataSet = new DataSet("", "");
0629:
0630:                for (Iterator iter = setOfParam.iterator(); iter.hasNext();) {
0631:                    Parameter param = (Parameter) iter.next();
0632:                    if (env.getParameterFromModel(param.getNameFromModel()) != null) {
0633:                        //dataSet.addParameterValueInModel(param.getNameFromModel(), env.getParameterValueFromModel(param));
0634:                        if (Api.isDYNAMIC_VALUE_DATASET()) {
0635:                            dataSet.addParameterValueInModel(param
0636:                                    .getNameFromModel(),
0637:                                    DataConstants.PARAM_VALUE_FROM_ENV);
0638:                        } else {
0639:                            dataSet.addParameterValueInModel(param
0640:                                    .getNameFromModel(), env
0641:                                    .getParameterValueFromModel(param));
0642:                        }
0643:                    } else {
0644:                        dataSet.addParameterValueInModel(param
0645:                                .getNameFromModel(), "");
0646:                        notValuedParamList.add(param);
0647:                        message = message + "* " + param.getNameFromModel()
0648:                                + "\n";
0649:                    }
0650:                }
0651:                int i = 0;
0652:                String name = "dataSet_" + i;
0653:                while (DataModel.getCurrentCampaign().getDataSetFromModel(name) != null
0654:                        || DataSet.isInBase(DataModel.getCurrentCampaign(),
0655:                                name)) {
0656:                    i++;
0657:                    name = "dataSet_" + i;
0658:                }
0659:                dataSet.updateInModel(name, Language.getInstance().getText(
0660:                        "Jeu_de_données_généré_automatiquement."));
0661:                //DataModel.getCurrentCampaign().addDataSetInModel(dataSet);
0662:                ArrayList dataView = new ArrayList();
0663:                dataView.add(dataSet.getNameFromModel());
0664:                dataView.add(dataSet.getDescriptionFromModel());
0665:                DataModel.getDataSetTableModel().addRow(dataView);
0666:                int transNumber = -1;
0667:                try {
0668:                    // BdD
0669:                    transNumber = Api.beginTransaction(11,
0670:                            ApiConstants.INSERT_DATA_SET);
0671:                    //dataSet.add2DB( DataModel.getCurrentCampaign());
0672:                    //dataSet.addToBddAndModel( DataModel.getCurrentCampaign());
0673:                    DataModel.getCurrentCampaign().addDataSetInDBAndModel(
0674:                            dataSet);
0675:                    Set keysSet = dataSet.getParametersHashMapFromModel()
0676:                            .keySet();
0677:                    for (Iterator iter = keysSet.iterator(); iter.hasNext();) {
0678:                        String paramName = (String) iter.next();
0679:                        String value = dataSet
0680:                                .getParameterValueFromModel(paramName);
0681:                        if (value == null)
0682:                            value = "";
0683:                        //dataSet.addParamValue2DB(value, ProjectData.getCurrentProject().getParameter(paramName));
0684:                        //dataSet.addParamValueToBddAndModel(value, DataModel.getCurrentProject().getParameterFromModel(paramName));
0685:                        dataSet.addParamValueToDBAndModel(value, DataModel
0686:                                .getCurrentProject().getParameterFromModel(
0687:                                        paramName));
0688:                    }
0689:                    Api.commitTrans(transNumber);
0690:
0691:                    return dataSet;
0692:                } catch (Exception exception) {
0693:                    Api.forceRollBackTrans(transNumber);
0694:                    Tools.ihmExceptionView(exception);
0695:                }
0696:
0697:                return null;
0698:            }
0699:
0700:            private void createAndQuit() {
0701:                if (environmentComboBox.getSelectedItem() != null) {
0702:                    //String conflicts = parameterConflict((DataSet)dataSetComboBox.getSelectedItem(), (Environment)environmentComboBox.getSelectedItem());
0703:                    DataSet ptrDataSet = (DataSet) dataSetComboBox
0704:                            .getSelectedItem();
0705:                    Environment ptrEnv = (Environment) environmentComboBox
0706:                            .getSelectedItem();
0707:                    Vector conflicts = parameterConflict(ptrDataSet, ptrEnv);
0708:                    int conflictsSize = conflicts.size();
0709:                    //if (conflicts.length() > 0) {
0710:                    if (conflictsSize > 0) {
0711:                        String reste = "";
0712:
0713:                        for (int i = 0; i < conflictsSize; i++) {
0714:                            Parameter ptrParam = (Parameter) conflicts
0715:                                    .elementAt(i);
0716:                            String valueDataSet = ptrDataSet
0717:                                    .getParameterValueFromModel(
0718:                                            ptrParam.getNameFromModel()).trim();
0719:                            String valueEnv = ptrEnv
0720:                                    .getParameterValueFromModel(ptrParam)
0721:                                    .trim();
0722:                            if (valueDataSet.equals("") && !valueEnv.equals("")) {
0723:                                //Question
0724:                                //ptrDataSet.addParameterValueInModel(ptrParam.getNameFromModel(),valueEnv);
0725:                            } else if (!valueDataSet
0726:                                    .equals(DataConstants.PARAM_VALUE_FROM_ENV)) {
0727:                                reste += ptrParam.getNameFromModel() + " ";
0728:                            }
0729:
0730:                        }
0731:
0732:                        if (!reste.equals("")) {
0733:                            JOptionPane
0734:                                    .showMessageDialog(
0735:                                            AskNewExecution.this ,
0736:                                            Language
0737:                                                    .getInstance()
0738:                                                    .getText(
0739:                                                            "Lors_de_l'exécution,_les_valeurs_des_paramètres_:\n")
0740:                                                    + reste
0741:                                                    + Language
0742:                                                            .getInstance()
0743:                                                            .getText(
0744:                                                                    "_seront_celles_du_jeu_de_données."),
0745:                                            Language.getInstance().getText(
0746:                                                    "Attention_!"),
0747:                                            JOptionPane.WARNING_MESSAGE);
0748:                        }
0749:                    }
0750:                    DataModel.getCurrentCampaign().updateExecutionInModel(
0751:                            execution); //A verifier pourquoi ?????
0752:                    //execution.setCampagne(DataModel.getCurrentCampaign());
0753:                    execution.updateNameInModel(executionNameTextField
0754:                            .getText().trim());
0755:                    execution.setCreationDateInModel(time);
0756:
0757:                    HashSet setOfParam = new HashSet();
0758:                    // Récupération de tous les paramètres de la campagne
0759:                    for (int i = 0; i < DataModel.getCurrentCampaign()
0760:                            .getTestListFromModel().size(); i++) {
0761:                        Test test = (Test) DataModel.getCurrentCampaign()
0762:                                .getTestListFromModel().get(i);
0763:                        for (int j = 0; j < test.getParameterListFromModel()
0764:                                .size(); j++) {
0765:                            setOfParam.add(test.getParameterListFromModel()
0766:                                    .get(j));
0767:                        }
0768:                    }
0769:                    ArrayList notValuedParamList = new ArrayList();
0770:                    message = "";
0771:                    if (ptrDataSet.getNameFromModel().equals(
0772:                            ApiConstants.EMPTY_NAME)) {
0773:                        if (!setOfParam.isEmpty()) {
0774:                            execution
0775:                                    .updateDatasetInModel(createDataSetFromCampaign(
0776:                                            setOfParam, ptrEnv,
0777:                                            notValuedParamList));
0778:                        } else {
0779:                            execution.updateDatasetInModel(ptrDataSet);
0780:                        }
0781:                    } else {
0782:                        message = TestMethods.notValuedParamListCreation(
0783:                                setOfParam, ptrEnv, ptrDataSet,
0784:                                notValuedParamList);
0785:                        execution.updateDatasetInModel(ptrDataSet);
0786:                    }
0787:                    if (notValuedParamList.size() > 0) {
0788:                        JOptionPane
0789:                                .showMessageDialog(
0790:                                        AskNewExecution.this ,
0791:                                        Language
0792:                                                .getInstance()
0793:                                                .getText(
0794:                                                        "Attention_!\nLes_paramètres_suivants_:\n")
0795:                                                + message
0796:                                                + Language
0797:                                                        .getInstance()
0798:                                                        .getText(
0799:                                                                "ne_sont_pas_valués."),
0800:                                        Language.getInstance().getText(
0801:                                                "Attention_!"),
0802:                                        JOptionPane.INFORMATION_MESSAGE);
0803:                    }
0804:
0805:                    execution.updateEnvInModel(ptrEnv);
0806:                    //execution.setInitScript(initScript);
0807:                    //execution.setPostScript(restitutionScript);
0808:                    execution.addPreScriptInModel(initScript);
0809:                    execution.addPostScriptInModel(restitutionScript);
0810:                    //execution.getAttachmentMapFromModel().clear();
0811:                    /*Collection values = attachmentPanel.getAttachmentMap().values();
0812:                    for (Iterator iter = values.iterator(); iter.hasNext();) {
0813:                        execution.addAttachementInModel((Attachment)iter.next());
0814:                    }*/
0815:                    DataModel.initAttachmentTable(DataModel
0816:                            .getCurrentCampaign().getAttachmentMapFromModel()
0817:                            .values());
0818:                    AskNewExecution.this .dispose();
0819:                } else {
0820:                    JOptionPane
0821:                            .showMessageDialog(
0822:                                    AskNewExecution.this ,
0823:                                    Language
0824:                                            .getInstance()
0825:                                            .getText(
0826:                                                    "Une_exécution_doit_obligatoirement_avoir_un_environnement_!"),
0827:                                    Language.getInstance().getText("Erreur_!"),
0828:                                    JOptionPane.ERROR_MESSAGE);
0829:                }
0830:            }
0831:
0832:            public void giveAccessToIhmExecutionView() {
0833:                if (!Permission.canDeleteCamp()) {
0834:                    removeRestitutionScriptButton.setEnabled(false);
0835:                    removeInitScriptButton.setEnabled(false);
0836:                }
0837:                if (!Permission.canCreateCamp()) {
0838:                    addInitScriptButton.setEnabled(false);
0839:                    addRestitutionScriptButton.setEnabled(false);
0840:                }
0841:                if (!Permission.canUpdateCamp()) {
0842:
0843:                }
0844:
0845:            }
0846:
0847:            public void actionPerformed(ActionEvent e) {
0848:                Object source = e.getSource();
0849:                if (source.equals(addInitScriptButton)) {
0850:                    addInitScriptPerformed(e);
0851:                } else if (source.equals(addRestitutionScriptButton)) {
0852:                    addRestitutionScriptPerformed(e);
0853:                } else if (source.equals(removeInitScriptButton)) {
0854:                    removeInitScriptPerformed(e);
0855:                } else if (source.equals(removeRestitutionScriptButton)) {
0856:                    removeRestitutionScriptPerformed(e);
0857:                } else if (source.equals(newEnvironmentButton)) {
0858:                    newEnvironmentPerformed(e);
0859:                } else if (source.equals(newDataSetButton)) {
0860:                    newDataSetPerformed(e);
0861:                } else if (source.equals(validationButton)) {
0862:                    validationPerformed(e);
0863:                } else if (source.equals(cancelButton)) {
0864:                    cancelPerformed(e);
0865:                }
0866:            }
0867:
0868:            public void addInitScriptPerformed(ActionEvent e) {
0869:                if (fileChooser == null) {
0870:                    removeInitScriptButton.setEnabled(false);
0871:                    addInitScriptButton.setEnabled(false);
0872:                    return;
0873:                }
0874:                fileChooser.setApproveButtonText(Language.getInstance()
0875:                        .getText("Valider"));
0876:                int returnVal = fileChooser
0877:                        .showOpenDialog(AskNewExecution.this );
0878:                if (returnVal == JFileChooser.APPROVE_OPTION) {
0879:                    ScriptFileFilter filter = (ScriptFileFilter) fileChooser
0880:                            .getFileFilter();
0881:                    String scriptPlugIns = filter.getDescription();
0882:                    initScriptFile = fileChooser.getSelectedFile();
0883:                    try {
0884:                        if (!initScriptFile.exists()) {
0885:                            initScriptFile.createNewFile();
0886:                            initNewFile = true;
0887:                        }
0888:                    } catch (Exception ex) {
0889:                        return;
0890:                    }
0891:                    initScript = new Script(initScriptFile.getName(), "");
0892:                    initScript.setLocalisation((initScriptFile
0893:                            .getAbsolutePath()));
0894:                    initScript.setScriptExtensionInModel(scriptPlugIns);
0895:                    initScript.updatePlugArgInModel("");
0896:                    initScript.setTypeInModel(PRE_SCRIPT);
0897:                    initScriptLabel.setText(Language.getInstance().getText(
0898:                            "Script_d'initialisation_:_")
0899:                            + initScriptFile.getName());
0900:                }
0901:            }
0902:
0903:            public void addRestitutionScriptPerformed(ActionEvent e) {
0904:                if (fileChooser == null) {
0905:                    addRestitutionScriptButton.setEnabled(false);
0906:                    removeRestitutionScriptButton.setEnabled(false);
0907:                    return;
0908:                }
0909:                fileChooser.setApproveButtonText(Language.getInstance()
0910:                        .getText("Valider"));
0911:                int returnVal = fileChooser
0912:                        .showOpenDialog(AskNewExecution.this );
0913:                if (returnVal == JFileChooser.APPROVE_OPTION) {
0914:                    ScriptFileFilter filter = (ScriptFileFilter) fileChooser
0915:                            .getFileFilter();
0916:                    String scriptPlugIns = filter.getDescription();
0917:                    restitutionScriptFile = fileChooser.getSelectedFile();
0918:                    try {
0919:                        if (!restitutionScriptFile.exists()) {
0920:                            restitutionScriptFile.createNewFile();
0921:                            restitutionNewFile = true;
0922:                        }
0923:                    } catch (Exception ex) {
0924:                        return;
0925:                    }
0926:                    restitutionScript = new Script(restitutionScriptFile
0927:                            .getName(), "");
0928:                    restitutionScript.setLocalisation(restitutionScriptFile
0929:                            .getAbsolutePath());
0930:                    restitutionScript.setScriptExtensionInModel(scriptPlugIns);
0931:                    restitutionScript.updatePlugArgInModel("");
0932:                    restitutionScript.setTypeInModel(POST_SCRIPT);
0933:                    restitutionScriptLabel.setText(Language.getInstance()
0934:                            .getText("Script_de_restitution_:_")
0935:                            + restitutionScriptFile.getName());
0936:                }
0937:            }
0938:
0939:            public void removeInitScriptPerformed(ActionEvent e) {
0940:                if (initScript != null) {
0941:                    int choice = -1;
0942:                    Object[] options = { Language.getInstance().getText("Oui"),
0943:                            Language.getInstance().getText("Non") };
0944:                    choice = SalomeTMFContext.getInstance().askQuestion(
0945:                            Language.getInstance().getText(
0946:                                    "Supprimer_le_fichier_de_script")
0947:                                    + " : "
0948:                                    + initScript.getNameFromModel()
0949:                                    + " ?",
0950:                            Language.getInstance().getText("Attention_!"),
0951:                            JOptionPane.WARNING_MESSAGE, options);
0952:                    if (choice != JOptionPane.YES_OPTION) {
0953:                        return;
0954:                    }
0955:                    initScriptLabel.setText(Language.getInstance().getText(
0956:                            "Script_d'initialisation_:_"));
0957:                    initScript = null;
0958:                }
0959:
0960:            }
0961:
0962:            public void removeRestitutionScriptPerformed(ActionEvent e) {
0963:                if (restitutionScript != null) {
0964:                    int choice = -1;
0965:                    Object[] options = { Language.getInstance().getText("Oui"),
0966:                            Language.getInstance().getText("Non") };
0967:                    choice = SalomeTMFContext.getInstance().askQuestion(
0968:                            Language.getInstance().getText(
0969:                                    "Supprimer_le_fichier_de_script")
0970:                                    + " : "
0971:                                    + restitutionScript.getNameFromModel()
0972:                                    + " ?",
0973:                            Language.getInstance().getText("Attention_!"),
0974:                            JOptionPane.WARNING_MESSAGE, options);
0975:                    if (choice != JOptionPane.YES_OPTION) {
0976:                        return;
0977:                    }
0978:                    restitutionScriptLabel.setText(Language.getInstance()
0979:                            .getText("Script_de_restitution_:_"));
0980:                    restitutionScript = null;
0981:                }
0982:
0983:            }
0984:
0985:            public void newEnvironmentPerformed(ActionEvent e) {
0986:                AskNewEnvironment askNewEnvironment = new AskNewEnvironment();
0987:                if (askNewEnvironment.getEnvironment() != null) {
0988:                    int transNumber = -1;
0989:                    try {
0990:                        Environment env = askNewEnvironment.getEnvironment();
0991:
0992:                        // BdD
0993:                        transNumber = Api.beginTransaction(11,
0994:                                ApiConstants.INSERT_ENVIRONMENT);
0995:                        //env.add2DB();
0996:                        DataModel.getCurrentProject()
0997:                                .addEnvironmentInDBAndModel(env);
0998:                        Set keysSet = askNewEnvironment.getEnvironment()
0999:                                .getParametersHashTableFromModel().keySet();
1000:                        for (Iterator iter = keysSet.iterator(); iter.hasNext();) {
1001:                            Parameter param = (Parameter) iter.next();
1002:                            //env.addParamValue2DB(param);
1003:                            env.addParamValueInDBAndModel(param, env
1004:                                    .getParameterValueFromModel(param));
1005:                        }
1006:                        if (askNewEnvironment.getScriptFile() != null) {
1007:                            //env.addScript2BddAndModel(env.getInitScriptFromModel(),askNewEnvironment.getScriptFile());
1008:                            env.addScriptInDBAndModel(env
1009:                                    .getInitScriptFromModel(),
1010:                                    askNewEnvironment.getScriptFile());
1011:                        }
1012:                        Api.commitTrans(transNumber);
1013:                        transNumber = -1;
1014:                        // IHM
1015:                        comboModelForEnvironment.addElement(askNewEnvironment
1016:                                .getEnvironment());
1017:                        ArrayList data = new ArrayList();
1018:                        data.add(askNewEnvironment.getEnvironment()
1019:                                .getNameFromModel());
1020:                        String initScriptName = "";
1021:                        if (askNewEnvironment.getEnvironment()
1022:                                .getInitScriptFromModel() != null) {
1023:                            initScriptName = askNewEnvironment.getEnvironment()
1024:                                    .getInitScriptFromModel()
1025:                                    .getNameFromModel();
1026:                        }
1027:                        data.add(initScriptName);
1028:                        data.add(askNewEnvironment.getEnvironment()
1029:                                .getParametersHashTableFromModel());
1030:                        data.add(askNewEnvironment.getEnvironment()
1031:                                .getDescriptionFromModel());
1032:                        DataModel.getEnvironmentTableModel().addRow(data);
1033:                        //ProjectData.getCurrentProject().addEnvironment(askNewEnvironment.getEnvironment());
1034:                        environmentComboBox.setSelectedItem(askNewEnvironment
1035:                                .getEnvironment());
1036:
1037:                    } catch (Exception exception) {
1038:                        Api.forceRollBackTrans(transNumber);
1039:                        Tools.ihmExceptionView(exception);
1040:                    }
1041:                }
1042:            }
1043:
1044:            public void newDataSetPerformed(ActionEvent e) {
1045:                AskNewDataSet askNewDataSet = new AskNewDataSet();
1046:                if (askNewDataSet.getDataSet() != null) {
1047:                    int transNumber = -1;
1048:                    try {
1049:                        DataSet dataSet = askNewDataSet.getDataSet();
1050:                        // BdD
1051:                        transNumber = Api.beginTransaction(11,
1052:                                ApiConstants.INSERT_ENVIRONMENT);
1053:                        //dataSet.add2DB(DataModel.getCurrentCampaign());
1054:                        //dataSet.addToBddAndModel(DataModel.getCurrentCampaign());
1055:                        DataModel.getCurrentCampaign().addDataSetInDBAndModel(
1056:                                dataSet);
1057:                        Set keysSet = askNewDataSet.getDataSet()
1058:                                .getParametersHashMapFromModel().keySet();
1059:                        for (Iterator iter = keysSet.iterator(); iter.hasNext();) {
1060:                            String paramName = (String) iter.next();
1061:                            String value = askNewDataSet.getDataSet()
1062:                                    .getParameterValueFromModel(paramName);
1063:                            if (value == null)
1064:                                value = "";
1065:                            //dataSet.addParamValue2DB(value, ProjectData.getCurrentProject().getParameter(paramName));
1066:                            dataSet.addParamValueToDBAndModel(value, DataModel
1067:                                    .getCurrentProject().getParameterFromModel(
1068:                                            paramName));
1069:                        }
1070:                        Api.commitTrans(transNumber);
1071:                        transNumber = -1;
1072:                        // IHM
1073:                        ArrayList data = new ArrayList();
1074:                        data.add(dataSet.getNameFromModel());
1075:                        data.add(dataSet.getDescriptionFromModel());
1076:                        DataModel.getDataSetTableModel().addRow(data);
1077:                        //DataModel.getCurrentCampaign().addDataSet(dataSet);
1078:                        comboModelForDataSet.addElement(dataSet);
1079:                        dataSetComboBox.setSelectedItem(dataSet);
1080:                    } catch (Exception exception) {
1081:                        Api.forceRollBackTrans(transNumber);
1082:                        Tools.ihmExceptionView(exception);
1083:                    }
1084:                }
1085:            }
1086:
1087:            public void validationPerformed(ActionEvent e) {
1088:                if (executionNameTextField.getText() != null
1089:                        && !executionNameTextField.getText().trim().equals("")) {
1090:                    if (!DataModel.getCurrentCampaign()
1091:                            .containsExecutionInModel(
1092:                                    executionNameTextField.getText().trim())
1093:                            && !Execution.isInBase(DataModel
1094:                                    .getCurrentCampaign(),
1095:                                    executionNameTextField.getText().trim())) {
1096:                        createAndQuit();
1097:                    } else if (DataModel.getCurrentCampaign()
1098:                            .getExecutionFromModel(
1099:                                    executionNameTextField.getText().trim()) != null
1100:                            && DataModel.getCurrentCampaign()
1101:                                    .getExecutionFromModel(
1102:                                            executionNameTextField.getText()
1103:                                                    .trim()).equals(execution)) {
1104:                        createAndQuit();
1105:                    } else {
1106:                        JOptionPane
1107:                                .showMessageDialog(
1108:                                        AskNewExecution.this ,
1109:                                        Language
1110:                                                .getInstance()
1111:                                                .getText(
1112:                                                        "Ce_nom_d'exécution_existe_déjà_pour_cette_campagne_!"),
1113:                                        Language.getInstance().getText(
1114:                                                "Erreur_!"),
1115:                                        JOptionPane.ERROR_MESSAGE);
1116:                    }
1117:                } else {
1118:                    JOptionPane
1119:                            .showMessageDialog(
1120:                                    AskNewExecution.this ,
1121:                                    Language
1122:                                            .getInstance()
1123:                                            .getText(
1124:                                                    "Il_faut_obligatoirement_donner_un_nom_à_l'exécution_!"),
1125:                                    Language.getInstance().getText(
1126:                                            "Attention_!"),
1127:                                    JOptionPane.WARNING_MESSAGE);
1128:                }
1129:            }
1130:
1131:            public void cancelPerformed(ActionEvent e) {
1132:                DataModel.initAttachmentTable(DataModel.getCurrentCampaign()
1133:                        .getAttachmentMapFromModel().values());
1134:                execution = null;
1135:                if (initNewFile)
1136:                    initScriptFile.delete();
1137:
1138:                if (restitutionNewFile)
1139:                    restitutionScriptFile.delete();
1140:
1141:                AskNewExecution.this .dispose();
1142:            }
1143:
1144:        } // Fin de la classe AskNewExecution
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.