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

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


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2007 EDF / 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 Jérémie DEFAYE
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package salomeTMF_plug.pluginxlsxml.Export;
025:
026:        import java.awt.BorderLayout;
027:        import java.awt.Container;
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.IOException;
034:        import java.net.URL;
035:        import java.util.ArrayList;
036:        import java.util.Vector;
037:
038:        import javax.swing.JCheckBox;
039:        import javax.swing.BorderFactory;
040:        import javax.swing.Box;
041:        import javax.swing.BoxLayout;
042:        import javax.swing.JButton;
043:        import javax.swing.JDialog;
044:        import javax.swing.JFileChooser;
045:        import javax.swing.JLabel;
046:        import javax.swing.JOptionPane;
047:        import javax.swing.JPanel;
048:        import javax.swing.JProgressBar;
049:        import javax.swing.JTabbedPane;
050:        import javax.swing.JTextField;
051:        import javax.swing.tree.DefaultMutableTreeNode;
052:
053:        import org.dom4j.Document;
054:        import org.dom4j.DocumentException;
055:        import org.java.plugin.Extension;
056:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
057:        import org.objectweb.salome_tmf.ihm.main.datawrapper.DataModel;
058:        import org.objectweb.salome_tmf.ihm.models.ScriptFileFilter;
059:        import org.objectweb.salome_tmf.ihm.tools.Tools;
060:        import org.objectweb.salome_tmf.plugins.IPlugObject;
061:        import org.objectweb.salome_tmf.plugins.JPFManager;
062:        import org.objectweb.salome_tmf.plugins.core.XMLLoaderPlugin;
063:        import org.objectweb.salome_tmf.plugins.core.XMLPrinterPlugin;
064:
065:        import salomeTMF_plug.pluginxlsxml.Commun.TestPresencePlugin;
066:        import salomeTMF_plug.pluginxlsxml.language.Language;
067:        import salomeTMF_plug.requirements.ImportXMLReq;
068:        import salomeTMF_plug.requirements.ReqPlugin;
069:        import salomeTMF_plug.requirements.ihm.RequirementPanel;
070:
071:        import salomeTMF_plug.docXML.export.*;
072:
073:        /**
074:         * Open a dialog box for selecting a XlS file to export data
075:         * 
076:         * @author Jérémie DEFAYE
077:         */
078:        public class ExportXLSDialog extends JDialog {
079:
080:            // Salome GUI
081:            private IPlugObject pIhm = null;
082:
083:            private URL urlBase;
084:
085:            private String url_txt;
086:            private String fichierDeSortieXLS;
087:            private String xlsFile;
088:
089:            private JLabel sauvLabel;
090:            private JLabel choixExport;
091:
092:            private JTextField sauvTF;
093:
094:            private JButton sauvButton;
095:
096:            private JCheckBox exportTest;
097:            private JCheckBox exportExigence;
098:            private JCheckBox exportParametre;
099:            private JCheckBox exportEnvironnement;
100:            private JCheckBox exportCampagne;
101:            private JCheckBox exportExecutionCampagne;
102:            private JCheckBox exportAnomalies;
103:
104:            private File fichierDeSortieXML;
105:
106:            private Document doc;
107:
108:            private JProgressBar progress;
109:
110:            private JButton valider;
111:
112:            private JButton annuler;
113:
114:            private boolean isAnnule = false;
115:
116:            private boolean isSelectionExportTest = true;
117:
118:            private boolean isSelectionExportExigence = true;
119:
120:            private boolean isSelectionExportParametre = true;
121:
122:            private boolean isSelectionExportEnvironnement = true;
123:
124:            private boolean isSelectionExportCampagne = true;
125:
126:            private boolean isSelectionExportExecutionCampagne = true;
127:
128:            private boolean isSelectionExportAnomalies = true;
129:
130:            private boolean isInitSelection = false;
131:
132:            private ArrayList suiteSelectionList;
133:
134:            private ArrayList familySelectionList;
135:
136:            private ArrayList testSelectionList;
137:
138:            private DefaultMutableTreeNode chosenRoot;
139:
140:            /**
141:             * Get the File Separator (different between Unix and Windows)
142:             */
143:            private String fs = System.getProperties().getProperty(
144:                    "file.separator");
145:
146:            // Partie ImportXML
147:            private XMLPrinterPlugin pXMLPrinterPlugin;
148:
149:            private Vector listXMLPlugin = new Vector();
150:
151:            Vector panelsPluginsForImport = new Vector();
152:
153:            /**
154:             * Creates a new instance of ExportDialog
155:             * 
156:             * @param vt
157:             *            Interface Homme Machine
158:             */
159:            public ExportXLSDialog(IPlugObject vt) {
160:                super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
161:
162:                pIhm = vt;
163:                urlBase = SalomeTMFContext.getInstance().getUrlBase();
164:                String _urlBase = urlBase.toString();
165:                url_txt = _urlBase.substring(0, _urlBase.lastIndexOf("/"));
166:
167:                // Rajout SaloméV3
168:                Vector listExtXMLPlugin = pIhm.getXMLPrintersExtension();
169:                int size = listExtXMLPlugin.size();
170:                for (int i = 0; i < size; i++) {
171:                    Extension pXMLExt = (Extension) listExtXMLPlugin
172:                            .elementAt(i);
173:                    JPFManager pJPFManager = pIhm.getPluginManager();
174:                    try {
175:                        pXMLPrinterPlugin = (XMLPrinterPlugin) pJPFManager
176:                                .activateExtension(pXMLExt);
177:                        if (!listXMLPlugin.contains(pXMLPrinterPlugin)) {
178:                            listXMLPlugin.add(pXMLPrinterPlugin);
179:                        }
180:                        JPanel pPanel = pXMLPrinterPlugin
181:                                .getExportOptionPanel();
182:                        // if (pPanel != null &&
183:                        // !panelsPluginsForImport.contains(pPanel)){
184:                        // panelsPluginsForImport.add(pPanel);
185:                        // }
186:                    } catch (Exception e) {
187:
188:                    }
189:                }
190:                // Fin rajout
191:
192:                DataModel.reloadFromBase(false);
193:                /*	JOptionPane.showMessageDialog(ExportXLSDialog.this, Language
194:                			.getInstance().getText("l_export_ne_prend_pas_en_compte_les_paramètres_les_environnements_et_les_campagnes"), Language
195:                			.getInstance().getText("Information..."),
196:                			JOptionPane.INFORMATION_MESSAGE);
197:                 */
198:                sauvLabel = new JLabel(Language.getInstance().getText(
199:                        "Fichier_de_sauvegarde"));
200:                sauvTF = new JTextField(30);
201:                sauvButton = new JButton(Language.getInstance().getText(
202:                        "Choisir..."));
203:                sauvButton.addActionListener(new ActionListener() {
204:                    public void actionPerformed(ActionEvent e) {
205:                        JFileChooser fileChooser = new JFileChooser();
206:                        fileChooser
207:                                .addChoosableFileFilter(new ScriptFileFilter(
208:                                        Language.getInstance().getText(
209:                                                "Fichier_XLS_[*.xls]"), ".xls"));
210:                        int returnVal = fileChooser.showDialog(
211:                                ExportXLSDialog.this , Language.getInstance()
212:                                        .getText("Sélectionner"));
213:                        if (returnVal == JFileChooser.APPROVE_OPTION) {
214:                            xlsFile = fileChooser.getSelectedFile()
215:                                    .getAbsolutePath();
216:                            if (xlsFile.indexOf(".") != -1) {
217:                                if (!xlsFile
218:                                        .substring(xlsFile.lastIndexOf("."))
219:                                        .equals(".xls")) {
220:                                    xlsFile += ".xls";
221:                                }
222:                            } else {
223:                                xlsFile += ".xls";
224:                            }
225:                            sauvTF.setText(xlsFile);
226:                        }
227:                    }
228:                });
229:
230:                valider = new JButton(Language.getInstance().getText("OK"));
231:                valider.addActionListener(new ActionListener() {
232:                    public void actionPerformed(ActionEvent e) {
233:                        if ((isSelectionExportTest == false)
234:                                && (isSelectionExportExigence == false)
235:                                && (isSelectionExportParametre == false)
236:                                && (isSelectionExportEnvironnement == false)
237:                                && (isSelectionExportCampagne == false)
238:                                && (isSelectionExportExecutionCampagne == false)
239:                                && (isSelectionExportAnomalies == false)) {
240:                            JOptionPane
241:                                    .showMessageDialog(
242:                                            ExportXLSDialog.this ,
243:                                            Language
244:                                                    .getInstance()
245:                                                    .getText(
246:                                                            "Vous_devez_selectionner_un_element_a_exporter"),
247:                                            Language.getInstance().getText(
248:                                                    "Erreur_!"),
249:                                            JOptionPane.ERROR_MESSAGE);
250:
251:                        } else if (sauvTF.getText().equals("")) {
252:
253:                            JOptionPane
254:                                    .showMessageDialog(
255:                                            ExportXLSDialog.this ,
256:                                            Language
257:                                                    .getInstance()
258:                                                    .getText(
259:                                                            "Vous_devez_entrez_un_nom_de_fichier"),
260:                                            Language.getInstance().getText(
261:                                                    "Erreur_!"),
262:                                            JOptionPane.ERROR_MESSAGE);
263:
264:                        } else {
265:
266:                            Thread t = new Thread() {
267:                                public void run() {
268:                                    // Instanciation et lancement du traitement
269:                                    try {
270:                                        progress.setIndeterminate(true);
271:                                        sauvButton.setEnabled(false);
272:                                        valider.setEnabled(false);
273:                                        annuler.setEnabled(false);
274:                                        exportTest.setEnabled(false);
275:                                        exportExigence.setEnabled(false);
276:                                        exportParametre.setEnabled(false);
277:                                        exportEnvironnement.setEnabled(false);
278:                                        exportCampagne.setEnabled(false);
279:                                        exportExecutionCampagne
280:                                                .setEnabled(false);
281:                                        exportAnomalies.setEnabled(false);
282:                                        sauvTF.setEnabled(false);
283:
284:                                        export();
285:                                    } catch (Exception ex) {
286:                                        Tools.ihmExceptionView(ex);
287:                                    }
288:                                }
289:                            };
290:                            t.start();
291:
292:                        }
293:                    }
294:                });
295:
296:                annuler = new JButton(Language.getInstance().getText("Annuler"));
297:                annuler.addActionListener(new ActionListener() {
298:                    public void actionPerformed(ActionEvent e) {
299:                        ExportXLSDialog.this .dispose();
300:                    }
301:                });
302:
303:                // Gestion du choix d'export
304:                choixExport = new JLabel(Language.getInstance().getText(
305:                        "Exporter"));
306:                exportTest = new JCheckBox(Language.getInstance().getText(
307:                        "Tests"));
308:                exportTest.setSelected(true);
309:                exportTest.addActionListener(new ActionListener() {
310:                    public void actionPerformed(ActionEvent e) {
311:                        try {
312:                            if (!exportTest.isSelected()) {
313:                                isSelectionExportTest = false;
314:                            } else {
315:                                isSelectionExportTest = true;
316:                            }
317:                        } catch (Exception ex) {
318:                            Tools.ihmExceptionView(ex);
319:                        }
320:                    }
321:                });
322:
323:                exportExigence = new JCheckBox(Language.getInstance().getText(
324:                        "Exigences"));
325:                if (TestPresencePlugin.testDeLaPresenceDuPluginRequirement()) {
326:                    exportExigence.setSelected(true);
327:                    exportExigence.addActionListener(new ActionListener() {
328:                        public void actionPerformed(ActionEvent e) {
329:                            try {
330:                                if (!exportExigence.isSelected()) {
331:                                    isSelectionExportExigence = false;
332:                                } else {
333:                                    isSelectionExportExigence = true;
334:                                }
335:                            } catch (Exception ex) {
336:                                Tools.ihmExceptionView(ex);
337:                            }
338:                        }
339:                    });
340:                } else {
341:                    exportExigence.setSelected(false);
342:                    isSelectionExportExigence = false;
343:                }
344:
345:                exportParametre = new JCheckBox(Language.getInstance().getText(
346:                        "Parametres"));
347:                exportParametre.setSelected(true);
348:                exportParametre.addActionListener(new ActionListener() {
349:                    public void actionPerformed(ActionEvent e) {
350:                        try {
351:                            if (!exportParametre.isSelected()) {
352:                                isSelectionExportParametre = false;
353:                            } else {
354:                                isSelectionExportParametre = true;
355:                            }
356:                        } catch (Exception ex) {
357:                            Tools.ihmExceptionView(ex);
358:                        }
359:                    }
360:                });
361:
362:                exportEnvironnement = new JCheckBox(Language.getInstance()
363:                        .getText("Environnements"));
364:                exportEnvironnement.setSelected(true);
365:                exportEnvironnement.addActionListener(new ActionListener() {
366:                    public void actionPerformed(ActionEvent e) {
367:                        try {
368:                            if (!exportEnvironnement.isSelected()) {
369:                                isSelectionExportEnvironnement = false;
370:                            } else {
371:                                isSelectionExportEnvironnement = true;
372:                            }
373:                        } catch (Exception ex) {
374:                            Tools.ihmExceptionView(ex);
375:                        }
376:                    }
377:                });
378:
379:                exportCampagne = new JCheckBox(Language.getInstance().getText(
380:                        "Campagnes"));
381:                exportCampagne.setSelected(true);
382:                exportCampagne.addActionListener(new ActionListener() {
383:                    public void actionPerformed(ActionEvent e) {
384:                        try {
385:                            if (!exportCampagne.isSelected()) {
386:                                isSelectionExportCampagne = false;
387:                            } else {
388:                                isSelectionExportCampagne = true;
389:                            }
390:                        } catch (Exception ex) {
391:                            Tools.ihmExceptionView(ex);
392:                        }
393:                    }
394:                });
395:
396:                exportExecutionCampagne = new JCheckBox(Language.getInstance()
397:                        .getText("Execution_campagnes"));
398:                exportExecutionCampagne.setSelected(true);
399:                exportExecutionCampagne.addActionListener(new ActionListener() {
400:                    public void actionPerformed(ActionEvent e) {
401:                        try {
402:                            if (!exportExecutionCampagne.isSelected()) {
403:                                isSelectionExportExecutionCampagne = false;
404:                            } else {
405:                                isSelectionExportExecutionCampagne = true;
406:                            }
407:                        } catch (Exception ex) {
408:                            Tools.ihmExceptionView(ex);
409:                        }
410:                    }
411:                });
412:
413:                exportAnomalies = new JCheckBox(Language.getInstance().getText(
414:                        "Anomalies"));
415:                exportAnomalies.setSelected(true);
416:                exportAnomalies.addActionListener(new ActionListener() {
417:                    public void actionPerformed(ActionEvent e) {
418:                        try {
419:                            if (!exportAnomalies.isSelected()) {
420:                                isSelectionExportAnomalies = false;
421:                            } else {
422:                                isSelectionExportAnomalies = true;
423:                            }
424:                        } catch (Exception ex) {
425:                            Tools.ihmExceptionView(ex);
426:                        }
427:                    }
428:                });
429:
430:                JPanel importTestPanel = new JPanel();
431:                importTestPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
432:                importTestPanel.add(choixExport);
433:
434:                JPanel selectTestPanel = new JPanel();
435:                selectTestPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
436:                selectTestPanel.add(exportTest);
437:
438:                JPanel selectExigencePanel = new JPanel();
439:                selectExigencePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
440:                selectExigencePanel.add(exportExigence);
441:
442:                JPanel selectParametrePanel = new JPanel();
443:                selectParametrePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
444:                selectParametrePanel.add(exportParametre);
445:
446:                JPanel selectEnvironnementPanel = new JPanel();
447:                selectEnvironnementPanel.setLayout(new FlowLayout(
448:                        FlowLayout.LEFT));
449:                selectEnvironnementPanel.add(exportEnvironnement);
450:
451:                JPanel selectCampagnePanel = new JPanel();
452:                selectCampagnePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
453:                selectCampagnePanel.add(exportCampagne);
454:
455:                JPanel selectExecutionCampagnePanel = new JPanel();
456:                selectExecutionCampagnePanel.setLayout(new FlowLayout(
457:                        FlowLayout.LEFT));
458:                selectExecutionCampagnePanel.add(exportExecutionCampagne);
459:
460:                JPanel selectAnomaliesPanel = new JPanel();
461:                selectAnomaliesPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
462:                selectAnomaliesPanel.add(exportAnomalies);
463:
464:                JPanel selectTexteExportPanel = new JPanel();
465:                selectTexteExportPanel
466:                        .setLayout(new FlowLayout(FlowLayout.LEFT));
467:                selectTexteExportPanel.add(importTestPanel);
468:
469:                JPanel importPanel = new JPanel();
470:                importPanel.setLayout(new GridLayout(4, 2));
471:                if (TestPresencePlugin.testDeLaPresenceDuPluginRequirement()) {
472:                    importPanel.add(selectExigencePanel);
473:                } else {
474:                    isSelectionExportExigence = false;
475:                }
476:                importPanel.add(selectTestPanel);
477:                importPanel.add(selectParametrePanel);
478:                importPanel.add(selectEnvironnementPanel);
479:                importPanel.add(selectCampagnePanel);
480:                importPanel.add(selectExecutionCampagnePanel);
481:                importPanel.add(selectAnomaliesPanel);
482:
483:                JPanel selectPanel = new JPanel();
484:                selectPanel.setLayout(new BoxLayout(selectPanel,
485:                        BoxLayout.Y_AXIS));
486:                selectPanel.setBorder(BorderFactory.createTitledBorder(""));
487:                selectPanel.add(selectTexteExportPanel);
488:                selectPanel.add(importPanel);
489:
490:                // Gestion de la progressbar
491:                progress = new JProgressBar();
492:                JPanel progression = new JPanel(new FlowLayout(
493:                        FlowLayout.CENTER));
494:                progression.add(progress);
495:
496:                // Gestion des boutons
497:                JPanel sauvLabelPanel = new JPanel(new FlowLayout(
498:                        FlowLayout.LEFT));
499:                sauvLabelPanel.add(sauvLabel);
500:                JPanel sauvTFPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
501:                sauvTFPanel.add(sauvTF);
502:                JPanel sauvButtonPanel = new JPanel(new FlowLayout(
503:                        FlowLayout.LEFT));
504:                sauvButtonPanel.add(sauvButton);
505:
506:                JPanel sauvPanel = new JPanel();
507:                sauvPanel.setLayout(new BoxLayout(sauvPanel, BoxLayout.Y_AXIS));
508:                sauvPanel.setBorder(BorderFactory.createTitledBorder(""));
509:                sauvPanel.add(sauvLabelPanel);
510:                sauvPanel.add(sauvTFPanel);
511:                sauvPanel.add(sauvButtonPanel);
512:
513:                JPanel buttons = new JPanel();
514:                buttons.add(valider);
515:                buttons.add(annuler);
516:
517:                JPanel page = new JPanel();
518:                page.setLayout(new BoxLayout(page, BoxLayout.Y_AXIS));
519:                page.add(Box.createVerticalStrut(10));
520:                page.add(sauvPanel);
521:                page.add(Box.createVerticalStrut(10));
522:                page.add(selectTexteExportPanel);
523:                page.add(selectPanel);
524:                page.add(Box.createVerticalStrut(10));
525:                page.add(progression);
526:                page.add(buttons);
527:
528:                Container contentPaneFrame = this .getContentPane();
529:                contentPaneFrame.add(page, BorderLayout.CENTER);
530:
531:                setLocation(400, 100);
532:                setTitle(Language.getInstance().getText("Export_au_format_XLS"));
533:                pack();
534:                setVisible(true);
535:
536:            }
537:
538:            /**
539:             * Start exporting data process
540:             */
541:            public void export() {
542:                boolean ok = true;
543:                String fichierXML = null;
544:                setInitSelection(false);
545:                if (sauvTF.getText().equals("")) {
546:
547:                    JOptionPane.showMessageDialog(ExportXLSDialog.this ,
548:                            Language.getInstance().getText(
549:                                    "Vous_devez_entrez_un_nom_de_fichier"),
550:                            Language.getInstance().getText("Erreur_!"),
551:                            JOptionPane.ERROR_MESSAGE);
552:                    ok = false;
553:
554:                } else {
555:
556:                    String saveFileName = sauvTF.getText().trim();
557:                    fichierXML = createXmlFile(saveFileName);
558:                    CallPackageDocXML test = new CallPackageDocXML(pIhm,
559:                            fichierXML);
560:
561:                    try {
562:
563:                        FromXmlToExcel Transformation = new FromXmlToExcel(
564:                                fichierXML, isSelectionExportExigence,
565:                                isSelectionExportTest,
566:                                isSelectionExportParametre,
567:                                isSelectionExportEnvironnement,
568:                                isSelectionExportCampagne,
569:                                isSelectionExportExecutionCampagne,
570:                                isSelectionExportAnomalies);
571:                        isAnnule = Transformation.getWriteErrorXLS();
572:                        fichierDeSortieXLS = Transformation
573:                                .getfichierDeSortieXLS();
574:                    } catch (DocumentException ex) {
575:                        ex.printStackTrace();
576:                    } catch (Exception ex) {
577:                        ex.printStackTrace();
578:                    }
579:                }
580:
581:                // supprime fichier temporaire XML
582:                File file = new File(fichierXML);
583:                file.delete();
584:
585:                // Test si export echec
586:                File file2 = new File(fichierDeSortieXLS);
587:                if (!file2.canRead()) {
588:                    file2.delete();
589:                    progress.setIndeterminate(false);
590:                    JOptionPane.showMessageDialog(ExportXLSDialog.this ,
591:                            Language.getInstance().getText(
592:                                    "Erreur_Durant_Export."), Language
593:                                    .getInstance().getText("Erreur_!"),
594:                            JOptionPane.INFORMATION_MESSAGE);
595:                    ExportXLSDialog.this .dispose();
596:                }
597:
598:                if (ok && !isAnnule) {
599:                    progress.setIndeterminate(false);
600:                    JOptionPane.showMessageDialog(ExportXLSDialog.this ,
601:                            Language.getInstance().getText(
602:                                    "L'export_s'est_terminée_avec_succès."),
603:                            Language.getInstance().getText("Information..."),
604:                            JOptionPane.INFORMATION_MESSAGE);
605:                    ExportXLSDialog.this .dispose();
606:                } else {
607:                    JOptionPane.showMessageDialog(ExportXLSDialog.this ,
608:                            Language.getInstance().getText(
609:                                    "Erreur_Durant_Export."), Language
610:                                    .getInstance().getText("Erreur_!"),
611:                            JOptionPane.INFORMATION_MESSAGE);
612:                    ExportXLSDialog.this .dispose();
613:                }
614:            }
615:
616:            /**
617:             * Get chosenRoot
618:             * 
619:             * @return Returns the chosenRoot.
620:             */
621:            public DefaultMutableTreeNode getChosenRoot() {
622:                return chosenRoot;
623:            }
624:
625:            /**
626:             * Set chosenRoot
627:             * 
628:             * @param chosenRoot
629:             *            The chosenRoot to set.
630:             */
631:            public void setChosenRoot(DefaultMutableTreeNode chosenRoot) {
632:                this .chosenRoot = chosenRoot;
633:            }
634:
635:            /**
636:             * Get familySelectionList
637:             * 
638:             * @return Returns the familySelectionList.
639:             */
640:            public ArrayList getFamilySelectionList() {
641:                return familySelectionList;
642:            }
643:
644:            /**
645:             * Set familySelectionList
646:             * 
647:             * @param familySelectionList
648:             *            The familySelectionList to set.
649:             */
650:            public void setFamilySelectionList(ArrayList familySelectionList) {
651:                this .familySelectionList = familySelectionList;
652:            }
653:
654:            /**
655:             * Get suiteSelectionList
656:             * 
657:             * @return Returns the suiteSelectionList.
658:             */
659:            public ArrayList getSuiteSelectionList() {
660:                return suiteSelectionList;
661:            }
662:
663:            /**
664:             * Set suiteSelectionList
665:             * 
666:             * @param suiteSelectionList
667:             *            The suiteSelectionList to set.
668:             */
669:            public void setSuiteSelectionList(ArrayList suiteSelectionList) {
670:                this .suiteSelectionList = suiteSelectionList;
671:            }
672:
673:            /**
674:             * Get testSelectionList
675:             * 
676:             * @return Returns the testSelectionList.
677:             */
678:            public ArrayList getTestSelectionList() {
679:                return testSelectionList;
680:            }
681:
682:            /**
683:             * Set testSelectionList
684:             * 
685:             * @param testSelectionList
686:             *            The testSelectionList to set.
687:             */
688:            public void setTestSelectionList(ArrayList testSelectionList) {
689:                this .testSelectionList = testSelectionList;
690:            }
691:
692:            /**
693:             * Get isInitSelection
694:             * 
695:             * @return Returns the isInitSelection.
696:             */
697:            public boolean isInitSelection() {
698:                return isInitSelection;
699:            }
700:
701:            /**
702:             * Return true si case a cocher tests est sélectionnée
703:             * 
704:             * @return true
705:             */
706:            public boolean getTestSelection() {
707:                return false;
708:            }
709:
710:            /**
711:             * Return true si case a cocher Exigence est sélectionnée
712:             * 
713:             * @return isSelectionExportExigence
714:             */
715:            public boolean getExigenceSelection() {
716:                return isSelectionExportExigence;
717:            }
718:
719:            /**
720:             * Set isInitSelection
721:             * @param initSelection initSelection
722:             */
723:            public void setInitSelection(boolean initSelection) {
724:                this .isInitSelection = initSelection;
725:            }
726:
727:            /**
728:             * Creat a temporary XML file
729:             * 
730:             * @param nomFichierXml
731:             *            XLS file Name
732:             * @return XML file Name
733:             */
734:            public String createXmlFile(String nomFichierXml) {
735:
736:                // Crée nom Fichier XML a partir nom Excel
737:                nomFichierXml = nomFichierXml.substring(0, nomFichierXml
738:                        .lastIndexOf(".xls"))
739:                        + ".xml";
740:
741:                // Tente de créer le fichier XML
742:                fichierDeSortieXML = new File(nomFichierXml);
743:                int i = 0;
744:                while (fichierDeSortieXML.exists()) {
745:                    if (i == 0) {
746:                        System.out.println(Language.getInstance().getText(
747:                                "FileName_Already_Exists"));
748:                        nomFichierXml = nomFichierXml.substring(0,
749:                                nomFichierXml.lastIndexOf("."))
750:                                + Language.getInstance().getText("_")
751:                                + Integer.toString(i) + ".xml";
752:                    } else {
753:                        nomFichierXml = nomFichierXml.substring(0,
754:                                nomFichierXml.lastIndexOf(Language
755:                                        .getInstance().getText("_")))
756:                                + Language.getInstance().getText("_")
757:                                + Integer.toString(i) + ".xml";
758:                    }
759:
760:                    fichierDeSortieXML = new File(nomFichierXml);
761:                    i++;
762:                }
763:                System.out.println(Language.getInstance().getText(
764:                        "Fichier_Sortie_XML")
765:                        + fichierDeSortieXML.toString());
766:                try {
767:                    fichierDeSortieXML.createNewFile();
768:                } catch (IOException ex) {
769:                    System.out.println(Language.getInstance().getText(
770:                            "Erreur_Fichier_Sortie_XML_:")
771:                            + fichierDeSortieXML.toString());
772:                    ex.printStackTrace();
773:                }
774:                return fichierDeSortieXML.toString();
775:            }
776:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.