Source Code Cross Referenced for JFrmMainFrame.java in  » Database-ORM » db-ojb » org » apache » ojb » tools » mapping » reversedb » 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 » Database ORM » db ojb » org.apache.ojb.tools.mapping.reversedb.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.ojb.tools.mapping.reversedb.gui;
002:
003:        /* Copyright 2002-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        import org.apache.ojb.tools.mapping.reversedb.gui.actions.*;
019:
020:        /**
021:         *
022:         * @author <a href="mailto:bfl@florianbruckner.com">Florian Bruckner</a>
023:         * @version $Id: JFrmMainFrame.java,v 1.1.2.1 2005/12/21 22:32:02 tomdz Exp $
024:         */
025:        public class JFrmMainFrame extends javax.swing.JFrame {
026:            public static final String JDBC_DRIVER = "JDBCDriver";
027:            public static final String JDBC_URL = "JDBCURL";
028:            public static final String JDBC_USER = "JDBCUsername";
029:            public static final String JDBC_PASSWORD = "JDBCPassword";
030:
031:            private java.util.HashMap hmPropertySheets = new java.util.HashMap();
032:
033:            org.apache.ojb.tools.mapping.reversedb.DBMeta aDBMeta;
034:            java.util.Properties schemeGeneratorProperties;
035:            java.sql.Connection aConnection = null;
036:
037:            /** Creates new form JFrmMainFrame */
038:            public JFrmMainFrame(java.util.Properties theProperties) {
039:                schemeGeneratorProperties = theProperties;
040:                initComponents();
041:            }
042:
043:            public void setConnection(java.sql.Connection conn) {
044:                firePropertyChange("JDBCConnection", aConnection, conn);
045:                aConnection = conn;
046:            }
047:
048:            public String getProperty(String propertyName, String defaultValue) {
049:                return schemeGeneratorProperties.getProperty(propertyName,
050:                        defaultValue);
051:            }
052:
053:            public void setProperty(String propertyName, String value) {
054:                firePropertyChange(propertyName, schemeGeneratorProperties
055:                        .getProperty(propertyName), value);
056:                schemeGeneratorProperties.setProperty(propertyName, value);
057:                try {
058:                    schemeGeneratorProperties.store(
059:                            new java.io.FileOutputStream(System
060:                                    .getProperty("user.home")
061:                                    + System.getProperty("file.separator")
062:                                    + "SchemeGenerator.properties"), "");
063:                } catch (java.io.FileNotFoundException ex) {
064:                    ex.printStackTrace();
065:                } catch (java.io.IOException ioex) {
066:                    ioex.printStackTrace();
067:                }
068:            }
069:
070:            public org.apache.ojb.tools.mapping.reversedb.DBMeta getDBMeta() {
071:                return this .aDBMeta;
072:            }
073:
074:            public void analyzeSchema() {
075:                try {
076:                    String strCatalogPattern = javax.swing.JOptionPane
077:                            .showInputDialog(
078:                                    this ,
079:                                    "Enter regular expression to filter catalogs (leave blank to get all catalogs, all catalogs will match the expression)");
080:                    String strSchemaPattern = javax.swing.JOptionPane
081:                            .showInputDialog(
082:                                    this ,
083:                                    "Enter regular expression to filter schemas (leave blank to get all schemas, all read schemas will match the expression)");
084:
085:                    aDBMeta = new org.apache.ojb.tools.mapping.reversedb.DBMeta(
086:                            strCatalogPattern, strSchemaPattern,
087:                            this .aConnection.getMetaData());
088:                    aDBMeta.read();
089:                    aDBMeta.generateReferences();
090:                    aDBMeta.debug();
091:                    this .jTree1.setModel(new javax.swing.tree.DefaultTreeModel(
092:                            aDBMeta));
093:                } catch (java.sql.SQLException sqlEx) {
094:                    java.sql.SQLException currentSqlEx = sqlEx;
095:                    while (currentSqlEx != null) {
096:                        System.out.println(sqlEx.getErrorCode() + ":"
097:                                + sqlEx.getMessage());
098:                        currentSqlEx = currentSqlEx.getNextException();
099:                    }
100:                    sqlEx.printStackTrace();
101:                } catch (Throwable t) {
102:                    t.printStackTrace();
103:                }
104:            }
105:
106:            /** This method is called from within the constructor to
107:             * initialize the form.
108:             * WARNING: Do NOT modify this code. The content of this method is
109:             * always regenerated by the Form Editor.
110:             */
111:            private void initComponents() {//GEN-BEGIN:initComponents
112:                java.awt.GridBagConstraints gridBagConstraints;
113:
114:                jToolBar1 = new javax.swing.JToolBar();
115:                jButton1 = new javax.swing.JButton();
116:                jButton2 = new javax.swing.JButton();
117:                jButton3 = new javax.swing.JButton();
118:                jButton4 = new javax.swing.JButton();
119:                jButton5 = new javax.swing.JButton();
120:                jButton6 = new javax.swing.JButton();
121:                jSplitPane1 = new javax.swing.JSplitPane();
122:                jScrollPane1 = new javax.swing.JScrollPane();
123:                jTree1 = new javax.swing.JTree();
124:                jScrollPane2 = new javax.swing.JScrollPane();
125:                jPanel1 = new javax.swing.JPanel();
126:                menuBar = new javax.swing.JMenuBar();
127:                fileMenu = new javax.swing.JMenu();
128:                mnuFileConnect = new javax.swing.JMenuItem();
129:                mnuFileReadSchema = new javax.swing.JMenuItem();
130:                exitMenuItem = new javax.swing.JMenuItem();
131:
132:                getContentPane().setLayout(new java.awt.GridBagLayout());
133:
134:                setTitle("OJB Scheme Generator");
135:                addWindowListener(new java.awt.event.WindowAdapter() {
136:                    public void windowClosing(java.awt.event.WindowEvent evt) {
137:                        exitForm(evt);
138:                    }
139:                });
140:
141:                jButton1.setAction(new DBConnPropertiesAction(this ));
142:                jToolBar1.add(jButton1);
143:
144:                jButton2.setText("Read");
145:                jButton2.addActionListener(new java.awt.event.ActionListener() {
146:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
147:                        jButton2ActionPerformed(evt);
148:                    }
149:                });
150:
151:                jToolBar1.add(jButton2);
152:
153:                jButton3.setText("Save XML");
154:                jButton3.setAction(new SaveXMLAction(this ));
155:                jToolBar1.add(jButton3);
156:
157:                jButton4.setAction(new GenerateJavaClassesAction(this ));
158:                jToolBar1.add(jButton4);
159:
160:                jButton5.setAction(new SetPackageAction(this ));
161:                jToolBar1.add(jButton5);
162:
163:                jButton6.setAction(new DisableClassesWithRegexAction(this ));
164:                jToolBar1.add(jButton6);
165:
166:                gridBagConstraints = new java.awt.GridBagConstraints();
167:                gridBagConstraints.gridx = 0;
168:                gridBagConstraints.gridy = 0;
169:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
170:                gridBagConstraints.weightx = 1.0;
171:                getContentPane().add(jToolBar1, gridBagConstraints);
172:
173:                jSplitPane1.setDividerLocation(100);
174:                jTree1.setModel(null);
175:                jTree1
176:                        .addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
177:                            public void valueChanged(
178:                                    javax.swing.event.TreeSelectionEvent evt) {
179:                                jTree1ValueChanged(evt);
180:                            }
181:                        });
182:
183:                jScrollPane1.setViewportView(jTree1);
184:
185:                jSplitPane1.setLeftComponent(jScrollPane1);
186:
187:                jScrollPane2.setViewportView(jPanel1);
188:
189:                jSplitPane1.setRightComponent(jScrollPane2);
190:
191:                gridBagConstraints = new java.awt.GridBagConstraints();
192:                gridBagConstraints.gridx = 0;
193:                gridBagConstraints.gridy = 1;
194:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
195:                gridBagConstraints.weightx = 1.0;
196:                gridBagConstraints.weighty = 1.0;
197:                getContentPane().add(jSplitPane1, gridBagConstraints);
198:
199:                fileMenu.setText("File");
200:                fileMenu.addActionListener(new java.awt.event.ActionListener() {
201:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
202:                        fileMenuActionPerformed(evt);
203:                    }
204:                });
205:
206:                mnuFileConnect.setAction(new DBConnPropertiesAction(this ));
207:                mnuFileConnect
208:                        .addActionListener(new java.awt.event.ActionListener() {
209:                            public void actionPerformed(
210:                                    java.awt.event.ActionEvent evt) {
211:                                mnuFileConnectActionPerformed(evt);
212:                            }
213:                        });
214:
215:                fileMenu.add(mnuFileConnect);
216:
217:                mnuFileReadSchema.setText("Read Schema");
218:                mnuFileReadSchema
219:                        .addActionListener(new java.awt.event.ActionListener() {
220:                            public void actionPerformed(
221:                                    java.awt.event.ActionEvent evt) {
222:                                mnuFileReadSchemaActionPerformed(evt);
223:                            }
224:                        });
225:
226:                fileMenu.add(mnuFileReadSchema);
227:
228:                exitMenuItem.setText("Exit");
229:                exitMenuItem
230:                        .addActionListener(new java.awt.event.ActionListener() {
231:                            public void actionPerformed(
232:                                    java.awt.event.ActionEvent evt) {
233:                                exitMenuItemActionPerformed(evt);
234:                            }
235:                        });
236:
237:                fileMenu.add(exitMenuItem);
238:
239:                menuBar.add(fileMenu);
240:
241:                setJMenuBar(menuBar);
242:
243:                pack();
244:            }//GEN-END:initComponents
245:
246:            private void jTree1ValueChanged(
247:                    javax.swing.event.TreeSelectionEvent evt)//GEN-FIRST:event_jTree1ValueChanged
248:            {//GEN-HEADEREND:event_jTree1ValueChanged
249:                javax.swing.tree.TreePath tp = evt.getPath();
250:                if (tp != null) {
251:                    Object o = tp.getLastPathComponent();
252:                    if (o instanceof  PropertySheetModel) {
253:                        PropertySheetModel p = (PropertySheetModel) o;
254:                        PropertySheetView pv = (PropertySheetView) hmPropertySheets
255:                                .get(p.getPropertySheetClass());
256:                        if (pv == null) {
257:                            try {
258:                                pv = (PropertySheetView) p
259:                                        .getPropertySheetClass().newInstance();
260:                            } catch (InstantiationException ie) {
261:                                // What to do here?????
262:                                ie.printStackTrace();
263:                            } catch (IllegalAccessException iae) {
264:                                iae.printStackTrace();
265:                            }
266:                        }
267:                        pv.setModel(p);
268:                        this .jScrollPane2
269:                                .setViewportView((java.awt.Component) pv);
270:                    }
271:                }
272:            }//GEN-LAST:event_jTree1ValueChanged
273:
274:            private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton2ActionPerformed
275:            {//GEN-HEADEREND:event_jButton2ActionPerformed
276:                this .analyzeSchema();
277:            }//GEN-LAST:event_jButton2ActionPerformed
278:
279:            private void mnuFileReadSchemaActionPerformed(
280:                    java.awt.event.ActionEvent evt)//GEN-FIRST:event_mnuFileReadSchemaActionPerformed
281:            {//GEN-HEADEREND:event_mnuFileReadSchemaActionPerformed
282:                this .analyzeSchema();
283:            }//GEN-LAST:event_mnuFileReadSchemaActionPerformed
284:
285:            private void mnuFileConnectActionPerformed(
286:                    java.awt.event.ActionEvent evt)//GEN-FIRST:event_mnuFileConnectActionPerformed
287:            {//GEN-HEADEREND:event_mnuFileConnectActionPerformed
288:                // Add your handling code here:
289:            }//GEN-LAST:event_mnuFileConnectActionPerformed
290:
291:            private void fileMenuActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileMenuActionPerformed
292:            {//GEN-HEADEREND:event_fileMenuActionPerformed
293:                // Add your handling code here:
294:            }//GEN-LAST:event_fileMenuActionPerformed
295:
296:            private void exitMenuItemActionPerformed(
297:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
298:                System.exit(0);
299:            }//GEN-LAST:event_exitMenuItemActionPerformed
300:
301:            /** Exit the Application */
302:            private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
303:                System.exit(0);
304:            }//GEN-LAST:event_exitForm
305:
306:            /**
307:             * @param args the command line arguments
308:             */
309:            public static void main(String args[]) {
310:                // new JFrmMainFrame().show ();8
311:            }
312:
313:            // Variables declaration - do not modify//GEN-BEGIN:variables
314:            private javax.swing.JMenuItem exitMenuItem;
315:            private javax.swing.JMenu fileMenu;
316:            private javax.swing.JButton jButton1;
317:            private javax.swing.JButton jButton2;
318:            private javax.swing.JButton jButton3;
319:            private javax.swing.JButton jButton4;
320:            private javax.swing.JButton jButton5;
321:            private javax.swing.JButton jButton6;
322:            private javax.swing.JPanel jPanel1;
323:            private javax.swing.JScrollPane jScrollPane1;
324:            private javax.swing.JScrollPane jScrollPane2;
325:            private javax.swing.JSplitPane jSplitPane1;
326:            private javax.swing.JToolBar jToolBar1;
327:            private javax.swing.JTree jTree1;
328:            private javax.swing.JMenuBar menuBar;
329:            private javax.swing.JMenuItem mnuFileConnect;
330:            private javax.swing.JMenuItem mnuFileReadSchema;
331:            // End of variables declaration//GEN-END:variables
332:
333:        }
334:
335:        /***************************** Changelog *****************************
336:         * // $Log: JFrmMainFrame.java,v $
337:         * // Revision 1.1.2.1  2005/12/21 22:32:02  tomdz
338:         * // Updated license
339:         * //
340:         * // Revision 1.1  2004/05/05 16:38:49  arminw
341:         * // fix fault
342:         * // wrong package structure used:
343:         * // org.apache.ojb.tools.reversdb
344:         * // org.apache.ojb.tools.reversdb2
345:         * //
346:         * // instead of
347:         * // org.apache.ojb.tools.mapping.reversdb
348:         * // org.apache.ojb.tools.mapping.reversdb2
349:         * //
350:         * // Revision 1.1  2004/05/04 13:44:59  arminw
351:         * // move reverseDB stuff
352:         * //
353:         * // Revision 1.9  2004/04/04 23:53:42  brianm
354:         * // Fixed initial copyright dates to match cvs repository
355:         * //
356:         * // Revision 1.8  2004/03/11 18:16:22  brianm
357:         * // ASL 2.0
358:         * //
359:         * // Revision 1.7  2003/06/21 10:15:50  florianbruckner
360:         * // start frame with a null treemodel (get rid of sample TreeModel on startup)
361:         * //
362:         * // Revision 1.6  2003/02/21 12:49:59  florianbruckner
363:         * // remove duplicate license from header
364:         * // Listen on the selection model for a changed selection instead of listening on mouse events
365:         * //
366:         * // Revision 1.5  2003/01/28 21:42:31  florianbruckner
367:         * // add dialog for entering a schema and catalog regex pattern
368:         * //
369:         * // Revision 1.4  2003/01/28 19:59:35  florianbruckner
370:         * // simple fix for error reporting
371:         * //
372:         * // Revision 1.3  2002/06/18 12:26:41  florianbruckner
373:         * // changes in Netbeans Form definitions after move to jakarta.
374:         * //
375:         * // Revision 1.2  2002/06/17 19:34:34  jvanzyl
376:         * // Correcting all the package references.
377:         * // PR:
378:         * // Obtained from:
379:         * // Submitted by:
380:         * // Reviewed by:
381:         * //
382:         * // Revision 1.1.1.1  2002/06/17 18:16:54  jvanzyl
383:         * // Initial OJB import
384:         * //
385:         * // Revision 1.3  2002/05/18 19:13:33  mattbaird
386:         * // Big Checkin includes:
387:         *
388:         * // - Fix for ODMG recursion bug, using registered for lock map.
389:         *
390:         * // - Do not create objects with no primary key that aren't using a key generator.
391:         *
392:         * // - Refactoring to allow OJB to use managed connections from an application server.
393:         *
394:         * // - addition of initial JCA implementation.
395:         *
396:         * // - addition of MBean code to integrate OJB into JBoss
397:         * //
398:         * // Revision 1.2  2002/05/16 11:47:09  florianbruckner
399:         * // fix CR/LF issue, change license to ASL
400:         * //
401:         * // Revision 1.1  2002/04/18 11:44:16  mpoeschl
402:         * //
403:         * // move files to new location
404:         * //
405:         * // Revision 1.5  2002/04/07 09:05:17  thma
406:         * // *** empty log message ***
407:         * //
408:         * // Revision 1.3  2002/03/11 18:40:26  florianbruckner
409:         * // modify .form files so the use the correct package name
410:         * //
411:         * // Revision 1.2  2002/03/11 17:36:26  florianbruckner
412:         * // fix line break issue for these files that were previously checked in with -kb
413:         * //
414:         * // Revision 1.1  2002/03/04 17:19:32  thma
415:         * // initial checking for Florians Reverse engineering tool
416:         * //
417:         * // Revision 1.1.1.1  2002/02/20 13:35:25  Administrator
418:         * // initial import
419:         * //
420:         * /***************************** Changelog *****************************/
w__w__w__.__j__a___v_a_2s.___c__om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.