Source Code Cross Referenced for PopUpFormalismeExcel.java in  » Test-Coverage » salome-tmf » salomeTMF_plug » pluginxlsxml » Commun » 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.Commun 
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.Commun;
025:
026:        import java.io.IOException;
027:        import java.awt.BorderLayout;
028:        import java.awt.Container;
029:        import java.awt.FlowLayout;
030:        import java.awt.event.ActionEvent;
031:        import java.awt.event.ActionListener;
032:        import java.io.File;
033:        import java.net.URL;
034:        import javax.swing.Box;
035:        import javax.swing.BoxLayout;
036:        import javax.swing.JButton;
037:        import javax.swing.JDialog;
038:        import javax.swing.JFileChooser;
039:        import javax.swing.JLabel;
040:        import javax.swing.JPanel;
041:        import jxl.write.WriteException;
042:        import org.objectweb.salome_tmf.ihm.main.SalomeTMFContext;
043:        import org.objectweb.salome_tmf.ihm.models.ScriptFileFilter;
044:        import org.objectweb.salome_tmf.plugins.IPlugObject;
045:        import salomeTMF_plug.pluginxlsxml.language.Language;
046:
047:        /**
048:         * /**
049:         * 
050:         * @author adm_dfej
051:         */
052:        public class PopUpFormalismeExcel extends JDialog {
053:
054:            private File fichierDeSortieXLS;
055:            private JButton genererModele;
056:            private JButton annuler;
057:            private JLabel explicationsTestsLabel;
058:            private JLabel explicationsExigencesLabel;
059:            private JLabel explicationsParametresLabel;
060:            private JLabel explicationsEnvironnementsLabel;
061:            private JLabel explicationsCampagnesLabel;
062:            private JLabel explicationsExecutionsCampagnesLabel;
063:            private JLabel laiusExigencesLabel;
064:            private JLabel laiusTestsLabel;
065:            private JLabel laiusParametresLabel;
066:            private JLabel laiusEnvironnementsLabel;
067:            private JLabel laiusCampagnesLabel;
068:            private JLabel laiusExecutionsCampagnesLabel;
069:            private String xlsFile;
070:            private int numeroColonne = 0;
071:            private int numeroLigne = 0;
072:            private int nombreLigneRequirementLu = 0;
073:            private int numeroColonneExigence = 0;
074:            private boolean selectionExportExigence = true;
075:            private boolean selectionExportTest = true;
076:            private boolean selectionExportParametre = true;
077:            private boolean selectionExportEnvironnement = true;
078:            private boolean selectionExportCampagne = true;
079:            private boolean selectionExportExecutionCampagne = true;
080:            private boolean masquageColonnes = false;
081:
082:            private boolean presenceFeuilleAnomalie = false;
083:
084:            // Salome GUI
085:            private IPlugObject pIhm = null;
086:            private URL urlBase;
087:            private String url_txt;
088:
089:            /**
090:             * Creates a new instance of PopUpFormalismeExcel
091:             * 
092:             * @param vt
093:             *            Interface Homme Machine
094:             */
095:            public PopUpFormalismeExcel(IPlugObject vt) {
096:                super (SalomeTMFContext.getInstance().getSalomeFrame(), true);
097:                if (vt != null) {
098:                    this .pIhm = vt;
099:                }
100:
101:                explicationsExigencesLabel = new JLabel(Language.getInstance()
102:                        .getText("Explications_Exigences_Label"));
103:                explicationsTestsLabel = new JLabel(Language.getInstance()
104:                        .getText("Explications_Tests_Label"));
105:                explicationsParametresLabel = new JLabel(Language.getInstance()
106:                        .getText("Explications_Parametres_Label"));
107:                explicationsEnvironnementsLabel = new JLabel(Language
108:                        .getInstance().getText(
109:                                "Explications_Environnements_Label"));
110:                explicationsCampagnesLabel = new JLabel(Language.getInstance()
111:                        .getText("Explications_Campagnes_Label"));
112:                explicationsExecutionsCampagnesLabel = new JLabel(Language
113:                        .getInstance().getText(
114:                                "Explications_Executions_Campagnes_Label"));
115:                laiusExigencesLabel = new JLabel(Language.getInstance()
116:                        .getText("Laius_Exigences_Label"));
117:                laiusTestsLabel = new JLabel(Language.getInstance().getText(
118:                        "Laius_Tests_Label"));
119:                laiusParametresLabel = new JLabel(Language.getInstance()
120:                        .getText("Laius_Parametres_Label"));
121:                laiusEnvironnementsLabel = new JLabel(Language.getInstance()
122:                        .getText("Laius_Environnements_Label"));
123:                laiusCampagnesLabel = new JLabel(Language.getInstance()
124:                        .getText("Laius_Campagnes_Label"));
125:                laiusExecutionsCampagnesLabel = new JLabel(Language
126:                        .getInstance().getText(
127:                                "Laius_Executions_Campagnes_Label"));
128:
129:                genererModele = new JButton(Language.getInstance().getText(
130:                        "Generer_Modele"));
131:                genererModele.addActionListener(new ActionListener() {
132:                    public void actionPerformed(ActionEvent e) {
133:
134:                        // Ouvrir boite dialogue Choix fichier excel
135:                        JFileChooser fileChooser = new JFileChooser();
136:                        fileChooser
137:                                .addChoosableFileFilter(new ScriptFileFilter(
138:                                        Language.getInstance().getText(
139:                                                "Fichier_XLS_[*.xls]"), ".xls"));
140:
141:                        int returnVal = fileChooser.showDialog(
142:                                PopUpFormalismeExcel.this , Language
143:                                        .getInstance().getText("Sélectionner"));
144:
145:                        if (returnVal == JFileChooser.APPROVE_OPTION) {
146:                            xlsFile = fileChooser.getSelectedFile()
147:                                    .getAbsolutePath();
148:                            if (xlsFile.indexOf(".") != -1) {
149:                                if (!xlsFile
150:                                        .substring(xlsFile.lastIndexOf("."))
151:                                        .equals(".xls")) {
152:                                    xlsFile += ".xls";
153:                                }
154:                            } else {
155:                                xlsFile += ".xls";
156:                            }
157:                            // Cree fichier excel
158:                            String nomFichierSortie = xlsFile;
159:
160:                            // Tente de créer le fichier excel
161:                            fichierDeSortieXLS = new File(nomFichierSortie);
162:                            int i = 0;
163:                            while (fichierDeSortieXLS.exists()) {
164:
165:                                if (i == 0) {
166:                                    System.out
167:                                            .println(Language
168:                                                    .getInstance()
169:                                                    .getText(
170:                                                            "FileName_Already_Exists"));
171:
172:                                    nomFichierSortie = nomFichierSortie
173:                                            .substring(0, nomFichierSortie
174:                                                    .lastIndexOf("."))
175:                                            + "_"
176:                                            + Integer.toString(i)
177:                                            + ".xls";
178:
179:                                } else {
180:                                    nomFichierSortie = nomFichierSortie
181:                                            .substring(0, nomFichierSortie
182:                                                    .lastIndexOf("_"))
183:                                            + "_"
184:                                            + Integer.toString(i)
185:                                            + ".xls";
186:
187:                                }
188:
189:                                fichierDeSortieXLS = new File(nomFichierSortie);
190:                                i++;
191:                            }
192:                            System.out.println(Language.getInstance().getText(
193:                                    "Fichier_Sortie_XLS")
194:                                    + fichierDeSortieXLS.toString());
195:                            try {
196:                                fichierDeSortieXLS.createNewFile();
197:                            } catch (IOException ex) {
198:                                System.out.println(Language.getInstance()
199:                                        .getText("Erreur_Fichier_Sortie_XML")
200:                                        + fichierDeSortieXLS.toString());
201:                                ex.printStackTrace();
202:                            }
203:                            try {
204:                                int NombreBrancheExigence = 2;
205:                                EcritEntete EcritEntete = new EcritEntete(
206:                                        NombreBrancheExigence,
207:                                        fichierDeSortieXLS,
208:                                        presenceFeuilleAnomalie);
209:                                EcritEntete.getWorkbookHeading();
210:                                EcritEntete.makeExample();
211:                                EcritEntete.organizeXLSfile(
212:                                        selectionExportExigence,
213:                                        selectionExportTest,
214:                                        selectionExportParametre,
215:                                        selectionExportEnvironnement,
216:                                        selectionExportCampagne,
217:                                        selectionExportExecutionCampagne,
218:                                        presenceFeuilleAnomalie,
219:                                        masquageColonnes);
220:                                EcritEntete
221:                                        .closeWorkbook(presenceFeuilleAnomalie);
222:                            } catch (WriteException ex) {
223:                                ex.printStackTrace();
224:                            }
225:
226:                            // Ferme la fenetre
227:                            PopUpFormalismeExcel.this .dispose();
228:                        }
229:                    }
230:                });
231:
232:                annuler = new JButton(Language.getInstance().getText("Annuler"));
233:                annuler.addActionListener(new ActionListener() {
234:                    public void actionPerformed(ActionEvent e) {
235:
236:                        PopUpFormalismeExcel.this .dispose();
237:
238:                    }
239:                });
240:
241:                JPanel texte = new JPanel();
242:                texte.setLayout(new FlowLayout(FlowLayout.LEFT));
243:                texte.add(explicationsTestsLabel);
244:                JPanel texte2 = new JPanel();
245:                texte2.setLayout(new FlowLayout(FlowLayout.LEFT));
246:                texte2.add(laiusTestsLabel);
247:                JPanel texte3 = new JPanel();
248:                texte3.setLayout(new FlowLayout(FlowLayout.LEFT));
249:                texte3.add(explicationsExigencesLabel);
250:                JPanel texte4 = new JPanel();
251:                texte4.setLayout(new FlowLayout(FlowLayout.LEFT));
252:                texte4.add(laiusExigencesLabel);
253:                JPanel texte5 = new JPanel();
254:                texte5.setLayout(new FlowLayout(FlowLayout.LEFT));
255:                texte5.add(explicationsParametresLabel);
256:                JPanel texte6 = new JPanel();
257:                texte6.setLayout(new FlowLayout(FlowLayout.LEFT));
258:                texte6.add(laiusParametresLabel);
259:                JPanel texte7 = new JPanel();
260:                texte7.setLayout(new FlowLayout(FlowLayout.LEFT));
261:                texte7.add(explicationsEnvironnementsLabel);
262:                JPanel texte8 = new JPanel();
263:                texte8.setLayout(new FlowLayout(FlowLayout.LEFT));
264:                texte8.add(laiusEnvironnementsLabel);
265:                JPanel texte9 = new JPanel();
266:                texte9.setLayout(new FlowLayout(FlowLayout.LEFT));
267:                texte9.add(explicationsCampagnesLabel);
268:                JPanel texte10 = new JPanel();
269:                texte10.setLayout(new FlowLayout(FlowLayout.LEFT));
270:                texte10.add(laiusCampagnesLabel);
271:                JPanel texte11 = new JPanel();
272:                texte11.setLayout(new FlowLayout(FlowLayout.LEFT));
273:                texte11.add(explicationsExecutionsCampagnesLabel);
274:                JPanel texte12 = new JPanel();
275:                texte12.setLayout(new FlowLayout(FlowLayout.LEFT));
276:                texte12.add(laiusExecutionsCampagnesLabel);
277:                JPanel buttons = new JPanel();
278:                buttons.add(genererModele);
279:                buttons.add(annuler);
280:
281:                JPanel page = new JPanel();
282:                page.setLayout(new BoxLayout(page, BoxLayout.Y_AXIS));
283:                if (TestPresencePlugin.testDeLaPresenceDuPluginRequirement()) {
284:                    page.add(texte3);
285:                    page.add(Box.createVerticalStrut(10));
286:                    page.add(texte4);
287:                    page.add(Box.createVerticalStrut(10));
288:                }
289:                page.add(texte);
290:                page.add(Box.createVerticalStrut(3));
291:                page.add(texte2);
292:                page.add(Box.createVerticalStrut(10));
293:                page.add(texte5);
294:                page.add(Box.createVerticalStrut(3));
295:                page.add(texte6);
296:                page.add(Box.createVerticalStrut(10));
297:                page.add(texte7);
298:                page.add(Box.createVerticalStrut(3));
299:                page.add(texte8);
300:                page.add(Box.createVerticalStrut(10));
301:                page.add(texte9);
302:                page.add(Box.createVerticalStrut(3));
303:                page.add(texte10);
304:                page.add(Box.createVerticalStrut(10));
305:                page.add(texte11);
306:                page.add(Box.createVerticalStrut(3));
307:                page.add(texte12);
308:                page.add(Box.createVerticalStrut(10));
309:                page.add(buttons);
310:
311:                Container contentPaneFrame = this .getContentPane();
312:                contentPaneFrame.add(page, BorderLayout.CENTER);
313:
314:                setLocation(400, 100);
315:                setTitle(Language.getInstance().getText(
316:                        "Generation_modele_Excel"));
317:                pack();
318:                setVisible(true);
319:
320:            }
321:
322:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.