Source Code Cross Referenced for ImportDialog2.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » docXML » importxml » 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.docXML.importxml 
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 Aurore PENAULT
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:        package salomeTMF_plug.docXML.importxml;
024:
025:        import java.awt.BorderLayout;
026:        import java.awt.Container;
027:        import java.awt.Dimension;
028:        import java.awt.FlowLayout;
029:        import java.awt.Font;
030:        import java.awt.Rectangle;
031:        import java.awt.event.ActionEvent;
032:        import java.awt.event.ActionListener;
033:        import java.io.File;
034:        import java.io.FileInputStream;
035:        import java.util.ArrayList;
036:        import java.util.Vector;
037:
038:        import javax.swing.BorderFactory;
039:        import javax.swing.Box;
040:        import javax.swing.BoxLayout;
041:        import javax.swing.ButtonGroup;
042:        import javax.swing.JButton;
043:        import javax.swing.JCheckBox;
044:        import javax.swing.JDialog;
045:        import javax.swing.JFileChooser;
046:        import javax.swing.JLabel;
047:        import javax.swing.JOptionPane;
048:        import javax.swing.JPanel;
049:        import javax.swing.JProgressBar;
050:        import javax.swing.JRadioButton;
051:        import javax.swing.JTextField;
052:        import javax.swing.border.TitledBorder;
053:        import javax.swing.tree.DefaultMutableTreeNode;
054:
055:        import org.dom4j.Document;
056:        import org.dom4j.io.SAXReader;
057:        import org.java.plugin.Extension;
058:        import org.objectweb.salome_tmf.data.Family;
059:        import org.objectweb.salome_tmf.data.Test;
060:        import org.objectweb.salome_tmf.data.TestList;
061:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
062:        import org.objectweb.salome_tmf.ihm.models.ScriptFileFilter;
063:        import org.objectweb.salome_tmf.ihm.tools.Tools;
064:        import org.objectweb.salome_tmf.plugins.IPlugObject;
065:        import org.objectweb.salome_tmf.plugins.JPFManager;
066:        import org.objectweb.salome_tmf.plugins.core.XMLPrinterPlugin;
067:
068:        import salomeTMF_plug.docXML.common.ImportTestChooser2;
069:        import salomeTMF_plug.docXML.languages.Language;
070:
071:        /**
072:         * To import data from XML file
073:         * @author vapu8214
074:         * @since JDK5.0
075:         */
076:        public class ImportDialog2 extends JDialog {
077:
078:            protected IPlugObject pIPlugObject;
079:            private Vector<JPanel> panelsPluginsForImport = new Vector<JPanel>();
080:
081:            private ArrayList<Family> familySelectionList;
082:            private ArrayList<TestList> suiteSelectionList;
083:            private ArrayList<Test> testSelectionList;
084:            private boolean initSelection = false;
085:            private DefaultMutableTreeNode chosenRoot;
086:
087:            private JLabel sauvLabel;
088:            private JTextField sauvTF;
089:            private JButton sauvButton;
090:
091:            private JCheckBox importCampBox;
092:            private JButton testSelection;
093:            private JLabel tousTests;
094:
095:            private JCheckBox suppr;
096:            private JLabel conflitLabel;
097:            private JRadioButton keepOriginal;
098:            private JRadioButton keepOriginalAndImport;
099:            private JRadioButton keepOriginalAndUpdate;
100:            private JRadioButton updateOriginal;
101:            private JRadioButton eraseOriginalAndImport;
102:
103:            private JButton valider;
104:            private JButton annuler;
105:
106:            private JProgressBar progress;
107:
108:            private String xmlFile;
109:            private String errorMessage = "";
110:            private boolean selectionDesTests = false;
111:            private ImportXML2 traitement;
112:
113:            /** 
114:             * Creates a new instance of ImportDialog2 
115:             */
116:            public ImportDialog2(IPlugObject iPlugObject) throws Exception {
117:                super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
118:                this .pIPlugObject = iPlugObject;
119:                createComponents();
120:            }
121:
122:            /**
123:             * Create components of the dialog box
124:             */
125:            private void createComponents() {
126:
127:                Vector<Extension> listExtXMLPlugin = pIPlugObject
128:                        .getXMLPrintersExtension();
129:                for (Extension pXMLExt : listExtXMLPlugin) {
130:                    JPFManager pJPFManager = pIPlugObject.getPluginManager();
131:                    try {
132:                        XMLPrinterPlugin pXMLPrinterPlugin = (XMLPrinterPlugin) pJPFManager
133:                                .activateExtension(pXMLExt);
134:                        JPanel pPanel = pXMLPrinterPlugin
135:                                .getImportOptionPanel();
136:                        if (pPanel != null
137:                                && !panelsPluginsForImport.contains(pPanel)) {
138:                            panelsPluginsForImport.add(pPanel);
139:                        }
140:                    } catch (Exception e) {
141:                    }
142:                }
143:
144:                familySelectionList = new ArrayList<Family>();
145:                suiteSelectionList = new ArrayList<TestList>();
146:                testSelectionList = new ArrayList<Test>();
147:
148:                sauvLabel = new JLabel(Language.getInstance().getText(
149:                        "Fichier_XML_:"));
150:                sauvTF = new JTextField(50);
151:                sauvButton = new JButton(Language.getInstance().getText(
152:                        "Choisir..."));
153:                sauvButton.addActionListener(new ActionListener() {
154:                    public void actionPerformed(ActionEvent e) {
155:                        try {
156:                            JFileChooser fileChooser = new JFileChooser();
157:                            fileChooser
158:                                    .addChoosableFileFilter(new ScriptFileFilter(
159:                                            Language.getInstance().getText(
160:                                                    "Fichier_XML_[*.xml]"),
161:                                            ".xml"));
162:                            int returnVal = fileChooser.showDialog(
163:                                    ImportDialog2.this , Language.getInstance()
164:                                            .getText("Sélectionner"));
165:                            if (returnVal == JFileChooser.APPROVE_OPTION) {
166:                                xmlFile = fileChooser.getSelectedFile()
167:                                        .getAbsolutePath();
168:                                if (xmlFile.indexOf(".") != -1) {
169:                                    if (!xmlFile.substring(
170:                                            xmlFile.lastIndexOf(".")).equals(
171:                                            ".xml")) {
172:                                        xmlFile += ".xml";
173:                                    }
174:                                } else {
175:                                    xmlFile += ".xml";
176:                                }
177:                                sauvTF.setText(xmlFile);
178:                            }
179:                        } catch (Exception ex) {
180:                            Tools.ihmExceptionView(ex);
181:                        }
182:                    }
183:                });
184:
185:                importCampBox = new JCheckBox(Language.getInstance().getText(
186:                        "Importer_les_campagnes"));
187:                importCampBox.addActionListener(new ActionListener() {
188:                    public void actionPerformed(ActionEvent e) {
189:                        try {
190:                            if (importCampBox.isSelected()) {
191:                                testSelection.setEnabled(false);
192:                                keepOriginalAndUpdate.setEnabled(false);
193:                                updateOriginal.setEnabled(false);
194:                                eraseOriginalAndImport.setEnabled(false);
195:                                if (!keepOriginal.isSelected()
196:                                        && !keepOriginalAndImport.isSelected()) {
197:                                    keepOriginal.setSelected(true);
198:                                }
199:                            } else {
200:                                testSelection.setEnabled(true);
201:                                keepOriginalAndUpdate.setEnabled(true);
202:                                updateOriginal.setEnabled(true);
203:                                eraseOriginalAndImport.setEnabled(true);
204:                            }
205:                        } catch (Exception ex) {
206:                            Tools.ihmExceptionView(ex);
207:                        }
208:                    }
209:                });
210:                importCampBox.setSelected(false);
211:
212:                testSelection = new JButton(Language.getInstance().getText(
213:                        "Sélection_des_tests..."));
214:                testSelection.addActionListener(new ActionListener() {
215:                    public void actionPerformed(ActionEvent e) {
216:                        if (xmlFile == null || xmlFile.equals("")) {
217:                            JOptionPane
218:                                    .showMessageDialog(
219:                                            ImportDialog2.this ,
220:                                            Language
221:                                                    .getInstance()
222:                                                    .getText(
223:                                                            "Avant_de_sélectionner_les_tests_à_importer,_veuillez_indiquer_le_fichier_XML_à_utiliser"),
224:                                            Language.getInstance().getText(
225:                                                    "Erreur_!"),
226:                                            JOptionPane.ERROR_MESSAGE);
227:                        } else {
228:                            Document doc = null;
229:                            try {
230:                                doc = xmlParser(xmlFile);
231:                            } catch (Exception ex) {
232:                                ex.printStackTrace();
233:                                errorMessage += Language
234:                                        .getInstance()
235:                                        .getText(
236:                                                "Problème_lors_de_l'import_des_données_du_document_XML");
237:                                showErrorMessage();
238:                            }
239:                            try {
240:                                if (initSelection) {
241:                                    new ImportTestChooser2(ImportDialog2.this ,
242:                                            doc, true);
243:                                } else {
244:                                    new ImportTestChooser2(ImportDialog2.this ,
245:                                            doc, false);
246:                                }
247:                            } catch (Exception ex) {
248:                                ex.printStackTrace();
249:                                errorMessage += Language
250:                                        .getInstance()
251:                                        .getText(
252:                                                "Probleme_lors_de_la_selection_des_tests");
253:                                showErrorMessage();
254:                            }
255:                        }
256:                    }
257:                });
258:                tousTests = new JLabel(Language.getInstance().getText(
259:                        "(Par_défaut,_tous_les_tests_sont_importés)"));
260:                tousTests.setFont(new Font(null, Font.ITALIC, 12));
261:
262:                suppr = new JCheckBox(
263:                        Language
264:                                .getInstance()
265:                                .getText(
266:                                        "Supprimer_les_éléments_qui_ne_sont_pas_dans_le_document_XML"));
267:                conflitLabel = new JLabel(Language.getInstance().getText(
268:                        "En_cas_de_conflit_:_"));
269:                keepOriginal = new JRadioButton(Language.getInstance().getText(
270:                        "Conserver_l_original"));
271:                keepOriginalAndImport = new JRadioButton(
272:                        Language
273:                                .getInstance()
274:                                .getText(
275:                                        "Garder_une_copie_et_importer_le_nouvel_element"));
276:                keepOriginalAndUpdate = new JRadioButton(
277:                        Language
278:                                .getInstance()
279:                                .getText(
280:                                        "Garder_un_copie_et_mettre_a_jour_une_copie_de_l_original_avec_l_element_importe"));
281:                updateOriginal = new JRadioButton(
282:                        Language
283:                                .getInstance()
284:                                .getText(
285:                                        "Mettre_a_jour_l_original_avec_l_element_importe"));
286:                eraseOriginalAndImport = new JRadioButton(Language
287:                        .getInstance().getText(
288:                                "Remplacer_l_original_par_l_element_importe"));
289:                keepOriginal.setSelected(true);
290:
291:                ButtonGroup conflictGroup = new ButtonGroup();
292:                conflictGroup.add(keepOriginal);
293:                conflictGroup.add(keepOriginalAndImport);
294:                conflictGroup.add(keepOriginalAndUpdate);
295:                conflictGroup.add(updateOriginal);
296:                conflictGroup.add(eraseOriginalAndImport);
297:
298:                valider = new JButton(Language.getInstance().getText("OK"));
299:                valider.addActionListener(new ActionListener() {
300:                    public void actionPerformed(ActionEvent e) {
301:                        if (xmlFile == null || xmlFile.equals("")) {
302:                            JOptionPane
303:                                    .showMessageDialog(
304:                                            ImportDialog2.this ,
305:                                            Language
306:                                                    .getInstance()
307:                                                    .getText(
308:                                                            "Vous_devez_entrer_un_nom_de_fichier_pour_le_document_d'import"),
309:                                            Language.getInstance().getText(
310:                                                    "Erreur_!"),
311:                                            JOptionPane.ERROR_MESSAGE);
312:                        } else {
313:                            Thread t = new Thread() {
314:                                public void run() {
315:                                    try {
316:                                        String dirXml = xmlFile
317:                                                .substring(
318:                                                        0,
319:                                                        xmlFile
320:                                                                .lastIndexOf(File.separator));
321:                                        if (sauvTF.getText().equals("")) {
322:                                            JOptionPane
323:                                                    .showMessageDialog(
324:                                                            ImportDialog2.this ,
325:                                                            Language
326:                                                                    .getInstance()
327:                                                                    .getText(
328:                                                                            "Vous_devez_entrez_un_nom_de_fichier_pour_le_document_généré"),
329:                                                            Language
330:                                                                    .getInstance()
331:                                                                    .getText(
332:                                                                            "Erreur_!"),
333:                                                            JOptionPane.ERROR_MESSAGE);
334:                                        } else {
335:                                            progress.setIndeterminate(true);
336:                                            try {
337:                                                traitement = new ImportXML2(
338:                                                        ImportDialog2.this ,
339:                                                        xmlParser(xmlFile),
340:                                                        familySelectionList,
341:                                                        suiteSelectionList,
342:                                                        testSelectionList,
343:                                                        null, pIPlugObject);
344:                                            } catch (Exception e) {
345:                                                e.printStackTrace();
346:                                                errorMessage += Language
347:                                                        .getInstance()
348:                                                        .getText(
349:                                                                "Problème_lors_de_l'import_des_données_du_document_XML");
350:                                                showErrorMessage();
351:                                                traitement.setAnnule(true);
352:                                            }
353:                                            traitement
354:                                                    .setImportCampaign(importCampBox
355:                                                            .isSelected());
356:                                            traitement.setDirXml(dirXml);
357:                                            traitement
358:                                                    .setInitSelection(isInitSelection());
359:                                            traitement.importInProject();
360:                                            if (!traitement.isAnnule()) {
361:                                                if (errorMessage.equals("")) {
362:                                                    progress.setVisible(false);
363:                                                    JOptionPane
364:                                                            .showMessageDialog(
365:                                                                    ImportDialog2.this ,
366:                                                                    Language
367:                                                                            .getInstance()
368:                                                                            .getText(
369:                                                                                    "L'import_s'est_terminée_avec_succès."),
370:                                                                    Language
371:                                                                            .getInstance()
372:                                                                            .getText(
373:                                                                                    "Information..."),
374:                                                                    JOptionPane.INFORMATION_MESSAGE);
375:                                                    ImportDialog2.this 
376:                                                            .dispose();
377:                                                } else {
378:                                                    progress.setVisible(false);
379:                                                    JOptionPane
380:                                                            .showMessageDialog(
381:                                                                    ImportDialog2.this ,
382:                                                                    errorMessage,
383:                                                                    Language
384:                                                                            .getInstance()
385:                                                                            .getText(
386:                                                                                    "Erreur..."),
387:                                                                    JOptionPane.ERROR_MESSAGE);
388:                                                    ImportDialog2.this 
389:                                                            .dispose();
390:                                                }
391:                                            } else if (!errorMessage.equals("")) {
392:                                                progress.setVisible(false);
393:                                                JOptionPane
394:                                                        .showMessageDialog(
395:                                                                ImportDialog2.this ,
396:                                                                errorMessage,
397:                                                                Language
398:                                                                        .getInstance()
399:                                                                        .getText(
400:                                                                                "Erreur..."),
401:                                                                JOptionPane.ERROR_MESSAGE);
402:                                                ImportDialog2.this .dispose();
403:                                            }
404:                                        }
405:                                    } catch (Exception ex) {
406:                                        Tools.ihmExceptionView(ex);
407:                                    }
408:                                }
409:                            };
410:                            t.start();
411:                        }
412:                    }
413:                });
414:
415:                annuler = new JButton(Language.getInstance().getText("Annuler"));
416:                annuler.addActionListener(new ActionListener() {
417:                    public void actionPerformed(ActionEvent e) {
418:                        try {
419:                            if (traitement != null) {
420:                                traitement.setAnnule(true);
421:                            }
422:                            ImportDialog2.this .dispose();
423:                        } catch (Exception ex) {
424:                            Tools.ihmExceptionView(ex);
425:                        }
426:                    }
427:                });
428:
429:                progress = new JProgressBar();
430:
431:                JPanel sauvLabelPanel = new JPanel(new FlowLayout(
432:                        FlowLayout.LEFT));
433:                sauvLabelPanel.add(sauvLabel);
434:                JPanel sauvTFPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
435:                sauvTFPanel.add(sauvTF);
436:                JPanel sauvButtonPanel = new JPanel(new FlowLayout(
437:                        FlowLayout.LEFT));
438:                sauvButtonPanel.add(sauvButton);
439:
440:                JPanel sauvPanel = new JPanel();
441:                sauvPanel.setLayout(new BoxLayout(sauvPanel, BoxLayout.Y_AXIS));
442:                sauvPanel.setBorder(BorderFactory.createTitledBorder(Language
443:                        .getInstance().getText("Document_d_import")));
444:                sauvPanel.add(sauvLabelPanel);
445:                sauvPanel.add(sauvTFPanel);
446:                sauvPanel.add(sauvButtonPanel);
447:
448:                JPanel importTestPanel = new JPanel();
449:                importTestPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
450:                importTestPanel.add(importCampBox);
451:
452:                JPanel selectTestPanel = new JPanel();
453:                selectTestPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
454:                selectTestPanel.add(testSelection);
455:                selectTestPanel.add(tousTests);
456:
457:                JPanel selectPanel = new JPanel();
458:                selectPanel.setLayout(new BoxLayout(selectPanel,
459:                        BoxLayout.Y_AXIS));
460:                selectPanel.setBorder(BorderFactory.createTitledBorder(Language
461:                        .getInstance().getText("Elements_a_importer")));
462:                selectPanel.add(importTestPanel);
463:                selectPanel.add(selectTestPanel);
464:                for (JPanel pPanel : panelsPluginsForImport) {
465:                    selectPanel.add(pPanel);
466:                }
467:
468:                JPanel supprOptionPanel = new JPanel(new FlowLayout(
469:                        FlowLayout.LEFT));
470:                supprOptionPanel.add(suppr);
471:                JPanel conflictPanel = new JPanel(new FlowLayout(
472:                        FlowLayout.LEFT));
473:                conflictPanel.add(conflitLabel);
474:                JPanel conflictOption1Panel = new JPanel(new FlowLayout(
475:                        FlowLayout.LEFT));
476:                conflictOption1Panel.add(Box.createHorizontalStrut(10));
477:                conflictOption1Panel.add(keepOriginal);
478:                JPanel conflictOption2Panel = new JPanel(new FlowLayout(
479:                        FlowLayout.LEFT));
480:                conflictOption2Panel.add(Box.createHorizontalStrut(10));
481:                conflictOption2Panel.add(keepOriginalAndImport);
482:                JPanel conflictOption3Panel = new JPanel(new FlowLayout(
483:                        FlowLayout.LEFT));
484:                conflictOption3Panel.add(Box.createHorizontalStrut(10));
485:                conflictOption3Panel.add(keepOriginalAndUpdate);
486:                JPanel conflictOption4Panel = new JPanel(new FlowLayout(
487:                        FlowLayout.LEFT));
488:                conflictOption4Panel.add(Box.createHorizontalStrut(10));
489:                conflictOption4Panel.add(updateOriginal);
490:                JPanel conflictOption5Panel = new JPanel(new FlowLayout(
491:                        FlowLayout.LEFT));
492:                conflictOption5Panel.add(Box.createHorizontalStrut(10));
493:                conflictOption5Panel.add(eraseOriginalAndImport);
494:
495:                JPanel optionsPanel = new JPanel();
496:                optionsPanel.setLayout(new BoxLayout(optionsPanel,
497:                        BoxLayout.Y_AXIS));
498:                optionsPanel.setBorder(new TitledBorder("Options"));
499:                optionsPanel.add(supprOptionPanel);
500:                optionsPanel.add(Box.createVerticalStrut(10));
501:                optionsPanel.add(conflictPanel);
502:                optionsPanel.add(conflictOption1Panel);
503:                optionsPanel.add(conflictOption2Panel);
504:                optionsPanel.add(conflictOption3Panel);
505:                optionsPanel.add(conflictOption4Panel);
506:                optionsPanel.add(conflictOption5Panel);
507:
508:                JPanel buttons = new JPanel();
509:                buttons.add(valider);
510:                buttons.add(annuler);
511:
512:                JPanel progression = new JPanel(new FlowLayout(
513:                        FlowLayout.CENTER));
514:                progression.add(progress);
515:
516:                JPanel page = new JPanel();
517:                page.setLayout(new BoxLayout(page, BoxLayout.Y_AXIS));
518:                page.add(Box.createVerticalStrut(10));
519:                page.add(sauvPanel);
520:                page.add(Box.createVerticalStrut(10));
521:                page.add(selectPanel);
522:                page.add(Box.createVerticalStrut(10));
523:                page.add(optionsPanel);
524:                page.add(Box.createVerticalStrut(10));
525:                page.add(buttons);
526:                page.add(Box.createRigidArea(new Dimension(1, 5)));
527:                page.add(progression);
528:
529:                Container contentPaneFrame = this .getContentPane();
530:                contentPaneFrame.add(page, BorderLayout.CENTER);
531:
532:                setTitle(Language.getInstance().getText(
533:                        "Import_à_partir_d'un_fichier_XML"));
534:                centerScreen();
535:            }
536:
537:            /**
538:             * Center and show the dialog
539:             */
540:            void centerScreen() {
541:                Dimension dim = getToolkit().getScreenSize();
542:                this .pack();
543:                Rectangle abounds = getBounds();
544:                setLocation((dim.width - abounds.width) / 2,
545:                        (dim.height - abounds.height) / 2);
546:                this .setVisible(true);
547:                requestFocus();
548:            }
549:
550:            /**
551:             * Méthode qui parse le document XML dont le chemin est indiqué dans "path"
552:             * @param path
553:             * @return un document DOM4J
554:             * @throws Exception
555:             */
556:            public Document xmlParser(String path) throws Exception {
557:                SAXReader reader = new SAXReader(false);
558:                Document doc = reader.read(new FileInputStream(new File(path)));
559:                return doc;
560:            }
561:
562:            /**
563:             * Méthode qui affiche les messages d'erreur
564:             * @return
565:             */
566:            public void showErrorMessage() {
567:                JOptionPane.showMessageDialog(ImportDialog2.this , errorMessage,
568:                        Language.getInstance().getText("Erreur_!"),
569:                        JOptionPane.ERROR_MESSAGE);
570:                ImportDialog2.this .dispose();
571:            }
572:
573:            /**
574:             * @return Returns the initSelection.
575:             */
576:            public boolean isInitSelection() {
577:                return initSelection;
578:            }
579:
580:            /**
581:             * @param initSelection The initSelection to set.
582:             */
583:            public void setInitSelection(boolean initSelection) {
584:                this .initSelection = initSelection;
585:            }
586:
587:            /**
588:             * Get the root of the tree of selected tests
589:             * @return
590:             */
591:            public DefaultMutableTreeNode getChosenRoot() {
592:                return chosenRoot;
593:            }
594:
595:            public boolean isSelectionDesTests() {
596:                return selectionDesTests;
597:            }
598:
599:            public void setSelectionDesTests(boolean selectionDesTests) {
600:                this .selectionDesTests = selectionDesTests;
601:            }
602:
603:            public void setFamilySelectionList(
604:                    ArrayList<Family> familySelectionList) {
605:                this .familySelectionList = familySelectionList;
606:            }
607:
608:            public void setSuiteSelectionList(
609:                    ArrayList<TestList> suiteSelectionList) {
610:                this .suiteSelectionList = suiteSelectionList;
611:            }
612:
613:            public void setTestSelectionList(ArrayList<Test> testSelectionList) {
614:                this .testSelectionList = testSelectionList;
615:            }
616:
617:            public void setChosenRoot(DefaultMutableTreeNode chosenRoot) {
618:                this .chosenRoot = chosenRoot;
619:            }
620:
621:            public boolean isSupprElement() {
622:                return suppr.isSelected();
623:            }
624:
625:            public boolean isKeepOriginalOption() {
626:                return keepOriginal.isSelected();
627:            }
628:
629:            public boolean isKeepOriginalAndImportOption() {
630:                return keepOriginalAndImport.isSelected();
631:            }
632:
633:            public boolean isKeepOriginalAndUpdateOption() {
634:                return keepOriginalAndUpdate.isSelected();
635:            }
636:
637:            public boolean isUpdateOriginalOption() {
638:                return updateOriginal.isSelected();
639:            }
640:
641:            public boolean isEraseOriginalAndImport() {
642:                return eraseOriginalAndImport.isSelected();
643:            }
644:
645:            public String getErrorMessage() {
646:                return errorMessage;
647:            }
648:
649:            public void setErrorMessage(String errorMessage) {
650:                this.errorMessage = errorMessage;
651:            }
652:
653:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.