Source Code Cross Referenced for GUIConfigOJBXMLJava.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » util » loader » gui » 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 » GIS » GeOxygene 1.3 » fr.ign.cogit.geoxygene.util.loader.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the GeOxygene project source files. 
003:         * 
004:         * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for 
005:         * the development and deployment of geographic (GIS) applications. It is a open source 
006:         * contribution of the COGIT laboratory at the Institut Géographique National (the French 
007:         * National Mapping Agency).
008:         * 
009:         * See: http://oxygene-project.sourceforge.net 
010:         *  
011:         * Copyright (C) 2005 Institut Géographique National
012:         *
013:         * This library is free software; you can redistribute it and/or modify it under the terms
014:         * of the GNU Lesser General Public License as published by the Free Software Foundation; 
015:         * either version 2.1 of the License, or any later version.
016:         *
017:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY 
018:         * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
019:         * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020:         *
021:         * You should have received a copy of the GNU Lesser General Public License along with 
022:         * this library (see file LICENSE if present); if not, write to the Free Software 
023:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:         *  
025:         */
026:
027:        package fr.ign.cogit.geoxygene.util.loader.gui;
028:
029:        import java.awt.Container;
030:        import java.awt.FlowLayout;
031:        import java.awt.Frame;
032:        import java.awt.GridLayout;
033:        import java.awt.event.ActionEvent;
034:        import java.awt.event.ActionListener;
035:
036:        import javax.swing.JButton;
037:        import javax.swing.JDialog;
038:        import javax.swing.JFileChooser;
039:        import javax.swing.JFrame;
040:        import javax.swing.JLabel;
041:        import javax.swing.JOptionPane;
042:        import javax.swing.JPanel;
043:        import javax.swing.JTextArea;
044:        import javax.swing.JTextField;
045:
046:        /**
047:         * Choix des parametres pour la generation de fichiers de mapping OJB. 
048:         * Ces parametres sont : repertoires d'accueil (XML  et Java), nom du package, 
049:         * nom de la classe mere, nom des fichiers de mapping.
050:         *
051:         * @author Thierry Badard & Arnaud Braun
052:         * @version 1.0
053:         * 
054:         */
055:
056:        /* Le pasage des parametres se fait par un tableau de String
057:         */
058:
059:        public class GUIConfigOJBXMLJava extends JFrame {
060:
061:            private static final String FRAME_TITLE = "GeOxygene Configuration mapping OJB / Java ";
062:
063:            private String dataDirectory;
064:            private String mappingDirectory;
065:            private String packageName;
066:            private String motherClass;
067:            private String mappingFileName;
068:            private String motherClasseMappingFileName;
069:
070:            private static String packageNameText = "Nom du package : ";
071:            private static String dataDirectoryText = "Repertoire d'accueil des packages : ";
072:            private static String mappingDirectoryText = "Repertoire d'accueil des fichiers de mapping : ";
073:            private static String motherClassText = "Nom de la classe mere : ";
074:            private static String mappingFileNameText = "Nom du fichier de mapping : ";
075:            private static String motherClasseMappingFileNameText = "Nom du fichier de mapping de la classe mere(*) :";
076:
077:            private static String explicationText = "(*) : \nNe rien mettre si vous ne souhaitez pas faire apparaitre la classe mere dans le mapping"
078:                    + "\nOn peut aussi indiquer le meme fichier que le fichier de mapping";
079:
080:            private String[] selectedValues = new String[6];
081:
082:            public GUIConfigOJBXMLJava(String PackageName,
083:                    String DataDirectory, String MappingDirectory,
084:                    String MotherClass, String MappingFileName,
085:                    String MotherClasseMappingFileName) {
086:                packageName = PackageName;
087:                dataDirectory = DataDirectory;
088:                mappingDirectory = MappingDirectory;
089:                motherClass = MotherClass;
090:                mappingFileName = MappingFileName;
091:                motherClasseMappingFileName = MotherClasseMappingFileName;
092:            }
093:
094:            public String[] showDialog() {
095:                final JDialog dialog = createDialog(this );
096:                dialog.show();
097:                dialog.dispose();
098:                return selectedValues;
099:            }
100:
101:            private void getSelectedValues() {
102:                selectedValues[0] = dataDirectory;
103:                selectedValues[1] = mappingDirectory;
104:                selectedValues[2] = packageName;
105:                selectedValues[3] = motherClass;
106:                selectedValues[4] = mappingFileName;
107:                selectedValues[5] = motherClasseMappingFileName;
108:                if (selectedValues[5].trim().equals(""))
109:                    selectedValues[5] = null;
110:            }
111:
112:            private JDialog createDialog(Frame parent) {
113:
114:                String title = FRAME_TITLE;
115:                final JDialog dialog = new JDialog(parent, title, true);
116:
117:                Container contentPane = dialog.getContentPane();
118:                contentPane.setLayout(new GridLayout(7, 2));
119:
120:                JLabel dataDirectoryLabel = new JLabel(dataDirectoryText);
121:                JPanel dataDirectoryPanel = new JPanel(new FlowLayout());
122:                final JTextField dataDirectoryTextField = new JTextField(
123:                        dataDirectory);
124:                JButton dataDirectoryChoiceButton = new JButton("...");
125:                dataDirectoryChoiceButton
126:                        .addActionListener(new ActionListener() {
127:                            public void actionPerformed(ActionEvent e) {
128:                                dataDirectoryTextField
129:                                        .setText(GUIConfigOJBXMLJava
130:                                                .selectRepertoire());
131:                            }
132:                        });
133:                dataDirectoryPanel.add(dataDirectoryTextField);
134:                dataDirectoryPanel.add(dataDirectoryChoiceButton);
135:                contentPane.add(dataDirectoryLabel);
136:                contentPane.add(dataDirectoryPanel);
137:
138:                JLabel mappingDirectoryLabel = new JLabel(mappingDirectoryText);
139:                JPanel mappingDirectoryPanel = new JPanel(new FlowLayout());
140:                final JTextField mappingDirectoryTextField = new JTextField(
141:                        mappingDirectory);
142:                JButton mappingDirectoryChoiceButton = new JButton("...");
143:                mappingDirectoryChoiceButton
144:                        .addActionListener(new ActionListener() {
145:                            public void actionPerformed(ActionEvent e) {
146:                                mappingDirectoryTextField
147:                                        .setText(GUIConfigOJBXMLJava
148:                                                .selectRepertoire());
149:                            }
150:                        });
151:                mappingDirectoryPanel.add(mappingDirectoryTextField);
152:                mappingDirectoryPanel.add(mappingDirectoryChoiceButton);
153:                contentPane.add(mappingDirectoryLabel);
154:                contentPane.add(mappingDirectoryPanel);
155:
156:                JLabel packageNameLabel = new JLabel(packageNameText);
157:                final JTextField packageNameTextField = new JTextField(
158:                        packageName);
159:                contentPane.add(packageNameLabel);
160:                contentPane.add(packageNameTextField);
161:
162:                JLabel motherClassLabel = new JLabel(motherClassText);
163:                final JTextField motherClassTextField = new JTextField(
164:                        motherClass);
165:                contentPane.add(motherClassLabel);
166:                contentPane.add(motherClassTextField);
167:
168:                JLabel mappingFileNameLabel = new JLabel(mappingFileNameText);
169:                final JTextField mappingFileNameTextField = new JTextField(
170:                        mappingFileName);
171:                contentPane.add(mappingFileNameLabel);
172:                contentPane.add(mappingFileNameTextField);
173:
174:                JLabel motherClasseMappingFileNameLabel = new JLabel(
175:                        motherClasseMappingFileNameText);
176:                final JTextField motherClasseMappingFileNameTextField = new JTextField(
177:                        motherClasseMappingFileName);
178:                contentPane.add(motherClasseMappingFileNameLabel);
179:                contentPane.add(motherClasseMappingFileNameTextField);
180:
181:                JTextArea expl = new JTextArea(explicationText);
182:                contentPane.add(expl);
183:
184:                JPanel controlPanel = new JPanel(new FlowLayout(
185:                        FlowLayout.CENTER, 20, 10));
186:
187:                JButton okButton = new JButton("Ok");
188:                okButton.setActionCommand("Ok");
189:                okButton.addActionListener(new ActionListener() {
190:                    public void actionPerformed(ActionEvent e) {
191:                        packageName = packageNameTextField.getText();
192:                        dataDirectory = dataDirectoryTextField.getText();
193:                        mappingDirectory = mappingDirectoryTextField.getText();
194:                        motherClass = motherClassTextField.getText();
195:                        mappingFileName = mappingFileNameTextField.getText();
196:                        motherClasseMappingFileName = motherClasseMappingFileNameTextField
197:                                .getText();
198:                        getSelectedValues();
199:                        dialog.dispose();
200:                    }
201:                });
202:
203:                JButton cancelButton = new JButton("Cancel");
204:                cancelButton.addActionListener(new ActionListener() {
205:                    public void actionPerformed(ActionEvent e) {
206:                        selectedValues[2] = null; //package name
207:                        dialog.dispose();
208:                    }
209:                });
210:
211:                controlPanel.add(okButton);
212:                controlPanel.add(cancelButton);
213:                contentPane.add(controlPanel);
214:
215:                dialog.pack();
216:                dialog.setLocationRelativeTo(parent);
217:
218:                return dialog;
219:            }
220:
221:            ///////////////////////////////////////////////////////////////////////////////////////////////////////////
222:            ///////////////////////////////////////////////////////////////////////////////////////////////////////////    
223:            private static String selectRepertoire() {
224:                JFileChooser choixRep = new JFileChooser();
225:                choixRep.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
226:
227:                int result = choixRep.showSaveDialog(null);
228:
229:                if (result == JFileChooser.CANCEL_OPTION)
230:                    return "";
231:
232:                String rep = choixRep.getSelectedFile().getPath();
233:
234:                if (rep == null || rep.equals("")) {
235:                    JOptionPane.showMessageDialog(null,
236:                            "nom de fichier incorrect",
237:                            "nom de fichier incorrect",
238:                            JOptionPane.ERROR_MESSAGE);
239:                    return "";
240:                } else
241:                    return rep;
242:
243:            }
244:
245:        }
w_w_w__._j___a__v___a___2_s___.__c___o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.