Source Code Cross Referenced for AutomaticTestScriptView.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » ihm » 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 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Fayçal SOUGRATI, Vincent Pautret, Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package org.objectweb.salome_tmf.ihm;
025:
026:        import java.awt.BorderLayout;
027:        import java.awt.Cursor;
028:        import java.awt.FlowLayout;
029:        import java.awt.GridLayout;
030:        import java.awt.event.ActionEvent;
031:        import java.awt.event.ActionListener;
032:        import java.io.File;
033:        import java.io.FileNotFoundException;
034:        import java.sql.Date;
035:        import java.util.Hashtable;
036:
037:        import javax.swing.BorderFactory;
038:        import javax.swing.BoxLayout;
039:        import javax.swing.JButton;
040:        import javax.swing.JLabel;
041:        import javax.swing.JMenu;
042:        import javax.swing.JMenuBar;
043:        import javax.swing.JMenuItem;
044:        import javax.swing.JOptionPane;
045:        import javax.swing.JPanel;
046:
047:        import org.java.plugin.Extension;
048:        import org.objectweb.salome_tmf.api.Api;
049:        import org.objectweb.salome_tmf.api.ApiConstants;
050:        import org.objectweb.salome_tmf.api.api2ihm.AdminProject;
051:        import org.objectweb.salome_tmf.data.AutomaticTest;
052:        import org.objectweb.salome_tmf.data.ConnectionData;
053:        import org.objectweb.salome_tmf.data.ProjectData;
054:        import org.objectweb.salome_tmf.data.Script;
055:        import org.objectweb.salome_tmf.ihm.datawrapper.DataModel;
056:        import org.objectweb.salome_tmf.ihm.languages.Language;
057:        import org.objectweb.salome_tmf.ihm.tools.Tools;
058:        import org.objectweb.salome_tmf.plugins.core.TestDriver;
059:
060:        //to remove
061:        //import bsh.EvalError;
062:        //import salome.com.AutomaticTestApi;
063:        /**
064:         * @author teaml039
065:         * @version : 0.1
066:         */
067:        public class AutomaticTestScriptView extends JPanel implements 
068:                ApiConstants, ActionListener {
069:
070:            static JLabel tscName;
071:            static JLabel plugArgLabel;
072:
073:            static JLabel extensionLabel;
074:
075:            //AutomaticTestApi automaticTestApi;
076:
077:            //Script script;
078:
079:            String extension;
080:
081:            String plugArg;
082:
083:            //static JButton plugInfoButton;
084:
085:            //static JButton modifyPlugArgButton;
086:
087:            static JButton openFile;
088:
089:            static JButton delFile;
090:
091:            //static JButton modifyScriptButton;
092:
093:            //static JButton commitButton;
094:
095:            static JMenuBar scriptMenuBar;
096:            static JMenu scriptMenu;
097:            static JMenuItem modifyScriptItem;
098:            static JMenuItem actualItem;
099:            static JMenuItem setUpEngineItem;
100:            static JMenuItem aboutItem;
101:
102:            static AutomaticTest pTest = null;
103:            TestDriver driver = null;
104:            File file;
105:
106:            /**
107:             *
108:             *
109:             */
110:            public AutomaticTestScriptView() {
111:                pTest = null;
112:                //script = new Script();
113:
114:                tscName = new JLabel(Language.getInstance().getText(
115:                        "Nom_du_script_:"));
116:                plugArgLabel = new JLabel(Language.getInstance().getText(
117:                        "Arguments_du_driver_:"));
118:                extensionLabel = new JLabel(Language.getInstance().getText(
119:                        "extension_:"));
120:
121:                openFile = new JButton(Language.getInstance()
122:                        .getText("Ajouter"));
123:                openFile.setToolTipText(Language.getInstance().getText(
124:                        "Ajouter_un_fichier"));
125:                openFile.addActionListener(this );
126:
127:                delFile = new JButton(Language.getInstance().getText(
128:                        "Supprimer"));
129:                delFile.setToolTipText(Language.getInstance().getText(
130:                        "Supprimer_le_fichier_de_script"));
131:                delFile.setEnabled(false);
132:                delFile.addActionListener(this );
133:
134:                scriptMenu = new JMenu(Language.getInstance().getText("Script"));
135:                modifyScriptItem = new JMenuItem(Language.getInstance()
136:                        .getText("Modifier_le_Script"));
137:                modifyScriptItem.addActionListener(this );
138:                modifyScriptItem.setEnabled(false);
139:
140:                actualItem = new JMenuItem(Language.getInstance().getText(
141:                        "Actualiser_le_Script"));
142:                actualItem.addActionListener(this );
143:                actualItem.setEnabled(false);
144:
145:                setUpEngineItem = new JMenuItem(Language.getInstance().getText(
146:                        "SetUp_Driver"));
147:                setUpEngineItem.addActionListener(this );
148:                setUpEngineItem.setEnabled(false);
149:
150:                aboutItem = new JMenuItem(Language.getInstance().getText(
151:                        "A_propos_du_driver"));
152:                aboutItem.addActionListener(this );
153:                aboutItem.setEnabled(true);
154:
155:                scriptMenu.add(modifyScriptItem);
156:                scriptMenu.add(actualItem);
157:                scriptMenu.add(setUpEngineItem);
158:                scriptMenu.add(aboutItem);
159:
160:                scriptMenuBar = new JMenuBar();
161:                scriptMenuBar.add(scriptMenu);
162:
163:                //JPanel allButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
164:                JPanel allButtons = new JPanel(new GridLayout(1, 3));
165:                allButtons.add(openFile);
166:                allButtons.add(delFile);
167:                allButtons.add(scriptMenuBar);
168:
169:                allButtons.setBorder(BorderFactory.createRaisedBevelBorder());
170:
171:                // Mapping entre composants graphiques et constantes
172:                SalomeTMF.addToUIComponentsMap(
173:                        UICompCst.AUTOMATED_TEST_SCRIPT_BUTTONS_PANEL,
174:                        allButtons);
175:                // Add this component as static component
176:                UICompCst.staticUIComps
177:                        .add(UICompCst.AUTOMATED_TEST_SCRIPT_BUTTONS_PANEL);
178:
179:                JPanel extensionPanel = new JPanel(new FlowLayout(
180:                        FlowLayout.LEFT));
181:                extensionPanel.add(extensionLabel);
182:
183:                // Mapping entre composants graphiques et constantes
184:                SalomeTMF.addToUIComponentsMap(
185:                        UICompCst.AUTOMATED_TEST_SCRIPT_EXTENSION_PANEL,
186:                        extensionPanel);
187:                // Add this component as static component
188:                UICompCst.staticUIComps
189:                        .add(UICompCst.AUTOMATED_TEST_SCRIPT_EXTENSION_PANEL);
190:
191:                JPanel classPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
192:                classPanel.add(plugArgLabel);
193:
194:                // Mapping entre composants graphiques et constantes
195:                SalomeTMF.addToUIComponentsMap(
196:                        UICompCst.AUTOMATED_TEST_SCRIPT_CLASSNAME_PANEL,
197:                        classPanel);
198:                // Add this component as static component
199:                UICompCst.staticUIComps
200:                        .add(UICompCst.AUTOMATED_TEST_SCRIPT_CLASSNAME_PANEL);
201:
202:                JPanel fileNamePanel = new JPanel(new FlowLayout(
203:                        FlowLayout.LEFT));
204:                fileNamePanel.add(tscName);
205:
206:                // Mapping entre objets graphiques et constantes
207:                SalomeTMF.addToUIComponentsMap(
208:                        UICompCst.AUTOMATED_TEST_SCRIPT_FILENAME_PANEL,
209:                        fileNamePanel);
210:                // Add this component as static component
211:                UICompCst.staticUIComps
212:                        .add(UICompCst.AUTOMATED_TEST_SCRIPT_FILENAME_PANEL);
213:
214:                JPanel globalPanel = new JPanel();
215:                globalPanel.setLayout(new BoxLayout(globalPanel,
216:                        BoxLayout.Y_AXIS));
217:                globalPanel.add(fileNamePanel, BorderLayout.NORTH);
218:                globalPanel.add(classPanel);
219:                globalPanel.add(extensionPanel);
220:
221:                JPanel hh = new JPanel(new BorderLayout());
222:                hh.add(globalPanel, BorderLayout.NORTH);
223:
224:                this .setLayout(new BorderLayout());
225:                this .add(allButtons, BorderLayout.NORTH);
226:                this .add(hh, BorderLayout.CENTER);
227:                //requestFocus();
228:                //System.out.println("Automatic test is focusable : "  + isFocusable());
229:                //this.addFocusListener(this);
230:                //this.addFocusListener(new PanelfocusAdapter());
231:            } // Fin du constructeur
232:
233:            /**
234:             * @return
235:             */
236:            public static JLabel getTscName() {
237:                return tscName;
238:            }
239:
240:            /**
241:             * @param label
242:             */
243:            public static void setTscName(JLabel label) {
244:                tscName = label;
245:            }
246:
247:            /**
248:             * @return
249:             */
250:            public static JLabel getPlugArgLabel() {
251:                return plugArgLabel;
252:            }
253:
254:            /**
255:             * @return
256:             */
257:            public static JLabel getExtensionLabel() {
258:                return extensionLabel;
259:            }
260:
261:            public static void giveAccessToIhmScriptView() {
262:                if (!AdminProject.canCreateTest()) {
263:                    openFile.setEnabled(false);
264:                }
265:                if (!AdminProject.canDeleteTest()) {
266:                    delFile.setEnabled(false);
267:                }
268:                if (!AdminProject.canUpdateTest()) {
269:                    //plugInfoButton.setEnabled(false);
270:                    /*modifyPlugArgButton.setEnabled(false);
271:                    modifyScriptButton.setEnabled(false);
272:                    commitButton.setEnabled(false);
273:                     */
274:                    modifyScriptItem.setEnabled(false);
275:                    aboutItem.setEnabled(false);
276:                    setUpEngineItem.setEnabled(false);
277:                }
278:            }
279:
280:            /**
281:             * @return
282:             */
283:            public static JButton getDelFile() {
284:                return delFile;
285:            }
286:
287:            /**
288:             * @return
289:             */
290:            /*public static JButton getModifyPlugArgButton2() {
291:                    //return modifyPlugArgButton;
292:                return null;
293:            }
294:             */
295:
296:            /* Invoked when test is selected in the treewiew*/
297:            public static void setTest(AutomaticTest test) {
298:                pTest = test;
299:                if (test.getScript() != null) {
300:                    tscName.setText(Language.getInstance().getText(
301:                            "Nom_du_script_:_")
302:                            + test.getScript().getName());
303:                    if (AdminProject.canUpdateTest()) {
304:                        /*  modifyScriptButton.setEnabled(true);
305:                          modifyPlugArgButton.setEnabled(true);
306:                         */
307:                        setUpEngineItem.setEnabled(true);
308:                        modifyScriptItem.setEnabled(true);
309:                    }
310:
311:                    if (AdminProject.canDeleteTest()) {
312:                        delFile.setEnabled(true);
313:
314:                        setUpEngineItem.setEnabled(true);
315:                        modifyScriptItem.setEnabled(true);
316:                    }
317:                    if (test.getScript().getScriptExtension() == null) {
318:                        extensionLabel.setText(Language.getInstance().getText(
319:                                "Extension_:_"));
320:                    } else {
321:                        extensionLabel.setText(Tools.createHtmlString(Language
322:                                .getInstance().getText("Extension_:_")
323:                                + test.getScript().getScriptExtension(), 100));
324:                    }
325:                    if (test.getScript().getPlugArg() != null) {
326:                        plugArgLabel.setText(Language.getInstance().getText(
327:                                "Arguments_du_driver_:_")
328:                                + test.getScript().getPlugArg());
329:                    } else {
330:                        plugArgLabel.setText(Language.getInstance().getText(
331:                                "Arguments_du_driver_:_"));
332:                    }
333:                } else {
334:                    tscName.setText(Language.getInstance().getText(
335:                            "Nom_du_script_:_"));
336:                    extensionLabel.setText(Language.getInstance().getText(
337:                            "Extension_:_"));
338:                    plugArgLabel.setText(Language.getInstance().getText(
339:                            "Arguments_du_driver_:_"));
340:                    delFile.setEnabled(false);
341:
342:                    modifyScriptItem.setEnabled(false);
343:                    setUpEngineItem.setEnabled(false);
344:                }
345:            }
346:
347:            public void actionPerformed(ActionEvent e) {
348:                //pTest = (AutomaticTest) DataModel.getCurrentTest();
349:                Object source = e.getSource();
350:                if (pTest == null) {
351:                    JOptionPane
352:                            .showMessageDialog(
353:                                    AutomaticTestScriptView.this ,
354:                                    Language
355:                                            .getInstance()
356:                                            .getText(
357:                                                    "Impossible_de_trouver_le_test_correspond_dans_le_plan_de_test"),
358:                                    Language.getInstance().getText("Erreur_!"),
359:                                    JOptionPane.ERROR_MESSAGE);
360:                    return;
361:                }
362:                driver = pTest.ActivateExtention(
363:                        (Extension) SalomeTMF.associatedExtension.get(pTest
364:                                .getExtension()), SalomeTMF.urlSalome,
365:                        SalomeTMF.jpf);
366:                if (driver == null
367:                        && (!(source.equals(delFile)) || !(source
368:                                .equals(openFile)))) {
369:                    JOptionPane
370:                            .showMessageDialog(
371:                                    AutomaticTestScriptView.this ,
372:                                    Language
373:                                            .getInstance()
374:                                            .getText(
375:                                                    "Impossible_d'activer_le_plugin_d'exécution_de_tests_")
376:                                            + pTest.getExtension(), Language
377:                                            .getInstance().getText("Erreur_!"),
378:                                    JOptionPane.ERROR_MESSAGE);
379:                    return;
380:                }
381:
382:                if (source.equals(openFile)) {
383:                    onpenFilePerformed(e);
384:                } else if (source.equals(delFile)) {
385:                    delFilePerformed(e);
386:                } else if (source.equals(modifyScriptItem)) {
387:                    modifyPerformed(e);
388:                } else if (source.equals(actualItem)) {
389:                    commitPerformed(e);
390:                } else if (source.equals(setUpEngineItem)) {
391:                    modifyArgPerformed(e);
392:                } else if (source.equals(aboutItem)) {
393:                    plugInfoPerformed(e);
394:                }
395:
396:            }
397:
398:            private void onpenFilePerformed(ActionEvent e) {
399:                File file = driver.choiceTest(pTest);
400:                Script script = null;
401:                boolean update = false;
402:                if (pTest.getScript() != null) {
403:                    script = pTest.getScript();
404:                    update = true;
405:                } else {
406:                    script = new Script();
407:                }
408:                if (file != null) {
409:
410:                    tscName.setText(Language.getInstance().getText(
411:                            "Nom_du_script_:_")
412:                            + file.getName());
413:                    script.setName(file.getName());
414:                    script.setLocalisation(file.getAbsolutePath());
415:                    script.setType(TEST_SCRIPT);
416:                    script.setScriptExtension(pTest.getExtension());
417:                    //String[] fileNamePart = file.getName().split("[.]");
418:                    if (!update)
419:                        plugArg = driver.getDefaultTestDiverAgument();
420:
421:                    script.setPlugArg(plugArg);
422:
423:                    try {
424:                        if (!file.exists()) {
425:                            file.createNewFile();
426:                        }
427:                        if (update) {
428:                            Api
429:                                    .log("[AutomaticTestView:onpenFilePerformed] : is update");
430:                            script.updateNameInDB(file.getName());
431:                            script.updateContentInDB(file.getAbsolutePath());
432:                            script
433:                                    .updateDateInDB(new Date(file
434:                                            .lastModified()));
435:                            script.updateLengthInDB(file.length());
436:                        } else {
437:                            ((AutomaticTest) DataModel.getCurrentTest())
438:                                    .addScriptInBddAndModel(script, file);
439:                        }
440:                        //((AutomaticTest)DataModel.getCurrentTest()).setScript(script);
441:                        plugArgLabel.setText(Language.getInstance().getText(
442:                                "Arguments_du_driver_:_")
443:                                + plugArg);
444:
445:                        if (plugArg == null || plugArg.equals("")) {
446:                            setUpEngineItem.setEnabled(false);
447:                        } else {
448:                            setUpEngineItem.setEnabled(true);
449:                        }
450:                        delFile.setEnabled(true);
451:                        modifyScriptItem.setEnabled(true);
452:                    } catch (Exception exception) {
453:                        Tools.ihmExceptionView(exception.toString());
454:                    }
455:                }
456:
457:            }
458:
459:            private void delFilePerformed(ActionEvent e) {
460:                driver.onDeleteTestScript(pTest);
461:                Script script = pTest.getScript();
462:                if (script == null)
463:                    return;
464:                try {
465:                    // BdD
466:                    ((AutomaticTest) pTest).deleteScriptInBddAndModel();
467:                    //((AutomaticTest)DataModel.getCurrentTest()).deleteScriptFromDB(script.getName());
468:
469:                    // IHM
470:                    //pTest.setScript(null);
471:                    tscName.setText(Language.getInstance().getText(
472:                            "Nom_du_script_:_"));
473:                    plugArgLabel.setText(Language.getInstance().getText(
474:                            "Arguments_du_driver_:"));
475:                    extensionLabel.setText(Language.getInstance().getText(
476:                            "extension_:_"));
477:                    modifyScriptItem.setEnabled(false);
478:                    actualItem.setEnabled(false);
479:                    setUpEngineItem.setEnabled(true);
480:                } catch (Exception exception) {
481:                    Tools.ihmExceptionView(exception.toString());
482:                }
483:            }
484:
485:            private void modifyPerformed(ActionEvent e) {
486:                try {
487:                    Cursor c = new Cursor(Cursor.WAIT_CURSOR);
488:                    AutomaticTestScriptView.this .setCursor(c);
489:                    Hashtable param = new Hashtable();
490:                    String plugSeting = "";
491:                    param.put("salome_projectName", ProjectData
492:                            .getCurrentProject().getName());
493:                    param.put("salome_ProjectObject", ProjectData
494:                            .getCurrentProject());
495:                    param.put("salome_debug", new Boolean(true));
496:                    param.put("salome_CampagneName", "");
497:                    param.put("salome_ExecName", ""); // Add MM
498:                    param.put("salome_environmentName", "");
499:                    param.put("salome_TestName", DataModel.getCurrentTest()
500:                            .getName());
501:                    param.put("salome_SuiteTestName", DataModel
502:                            .getCurrentTest().getTestList().getName());
503:                    param.put("salome_FamilyName", DataModel.getCurrentTest()
504:                            .getTestList().getFamily().getName());
505:                    param.put("testLog", "");
506:                    param.put("Verdict", "");
507:
508:                    plugSeting = pTest.getScript().getPlugArg();
509:
510:                    if (ConnectionData.isConnected()) {
511:                        //file = ConnectionData.getSuiteTestSelect().getScriptOfTest(DataModel.getCurrentTest().getTestList().getFamily().getName(), DataModel.getCurrentTest().getTestList().getName(), DataModel.getCurrentTest().getName(), ((AutomaticTest)DataModel.getCurrentTest()).getScript().getName());
512:                        file = ((AutomaticTest) DataModel.getCurrentTest())
513:                                .getTestScriptFromDB(((AutomaticTest) DataModel
514:                                        .getCurrentTest()).getScript()
515:                                        .getName());
516:                        driver.editTest(Tools
517:                                .speedpurge(file.getAbsolutePath()), pTest,
518:                                param, plugSeting);
519:                    } else {
520:                        Script script = pTest.getScript();
521:                        if (script != null)
522:                            driver.editTest(Tools.speedpurge(script.getName()),
523:                                    pTest, param, plugSeting);
524:                    }
525:                    actualItem.setEnabled(true);
526:                } catch (Exception ex) {
527:                    JOptionPane
528:                            .showMessageDialog(
529:                                    AutomaticTestScriptView.this ,
530:                                    Language
531:                                            .getInstance()
532:                                            .getText(
533:                                                    "Erreur_pour_lancer_l'éditeur_de_script_:_\n")
534:                                            + ex.getMessage(), Language
535:                                            .getInstance().getText("Erreur_!"),
536:                                    JOptionPane.ERROR_MESSAGE);
537:
538:                    ex.printStackTrace();
539:                    //return;
540:                }
541:
542:                try {
543:                    Cursor c = new Cursor(Cursor.DEFAULT_CURSOR);
544:                    AutomaticTestScriptView.this .setCursor(c);
545:                } catch (Exception ee) {
546:                    ee.printStackTrace();
547:                }
548:                //commitButton.setEnabled(true);
549:
550:            }
551:
552:            private void commitPerformed(ActionEvent e) {
553:                if (ConnectionData.isConnected()) {
554:                    Date date = new Date(file.lastModified());
555:                    try {
556:
557:                        Script script = ((AutomaticTest) DataModel
558:                                .getCurrentTest()).getScript();
559:                        script.updateContentInDB(file.getAbsolutePath());
560:                        script.updateDateInDB(date);
561:                        script.updateLengthInDB(file.length());
562:
563:                        JOptionPane
564:                                .showMessageDialog(
565:                                        AutomaticTestScriptView.this ,
566:                                        Language
567:                                                .getInstance()
568:                                                .getText(
569:                                                        "Le_fichier_a_été_correctement_archivé."),
570:                                        Language.getInstance().getText(
571:                                                "Info..."),
572:                                        JOptionPane.INFORMATION_MESSAGE);
573:                        actualItem.setEnabled(false);
574:
575:                    } catch (FileNotFoundException fe) {
576:                        JOptionPane
577:                                .showMessageDialog(
578:                                        AutomaticTestScriptView.this ,
579:                                        Language
580:                                                .getInstance()
581:                                                .getText(
582:                                                        "Impossible_de_trouver_le_fichier!\n_Vous_devez_l'importer_en_cliquant_sur_le_bouton_\"Modifier\""),
583:                                        Language.getInstance().getText(
584:                                                "Erreur_!"),
585:                                        JOptionPane.ERROR_MESSAGE);
586:                    } catch (Exception exception) {
587:                        Tools.ihmExceptionView(exception.toString());
588:                    }
589:                }
590:            }
591:
592:            public void modifyArgPerformed(ActionEvent e) {
593:                Script script = pTest.getScript();
594:                String newArg = driver.modifyTestDiverAgument(script
595:                        .getPlugArg());
596:
597:                if (newArg != null && !newArg.equals("")) {
598:
599:                    try {
600:                        script.updatePlugArgInDB(newArg);
601:                        script.setPlugArg(newArg);
602:                        plugArgLabel.setText(Language.getInstance().getText(
603:                                "Arguments_du_driver_:_")
604:                                + newArg);
605:
606:                    } catch (Exception exception) {
607:                        Tools.ihmExceptionView(exception.toString());
608:                    }
609:                }
610:            }
611:
612:            public void plugInfoPerformed(ActionEvent e) {
613:                driver.getHelp();
614:            }
615:
616:        } // Fin de la classe AutomaticTestScriptView
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.