Source Code Cross Referenced for SelectTablesDialog.java in  » J2EE » jag » com » finalist » jaggenerator » 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 » J2EE » jag » com.finalist.jaggenerator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*   Copyright (C) 2003 Finalist IT Group
002:         *
003:         *   This file is part of JAG - the Java J2EE Application Generator
004:         *
005:         *   JAG is free software; you can redistribute it and/or modify
006:         *   it under the terms of the GNU General Public License as published by
007:         *   the Free Software Foundation; either version 2 of the License, or
008:         *   (at your option) any later version.
009:         *   JAG is distributed in the hope that it will be useful,
010:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:         *   GNU General Public License for more details.
013:         *   You should have received a copy of the GNU General Public License
014:         *   along with JAG; if not, write to the Free Software
015:         *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
016:         */
017:
018:        package com.finalist.jaggenerator;
019:
020:        import java.util.*;
021:        import java.util.List;
022:        import java.awt.*;
023:        import java.awt.event.WindowAdapter;
024:        import java.awt.event.WindowEvent;
025:        import java.awt.event.ActionListener;
026:        import java.awt.event.ActionEvent;
027:        import javax.swing.*;
028:
029:        /**
030:         *
031:         * @author  hillie
032:         */
033:        public class SelectTablesDialog extends JDialog {
034:            private DefaultListModel listModel = new DefaultListModel();
035:
036:            private static final ArrayList tableList = new ArrayList();
037:            private static final ArrayList alreadySelected = new ArrayList();
038:
039:            /** Creates new form SelectTablesDialog */
040:            public SelectTablesDialog(JagGenerator parent) {
041:                super (parent, true);
042:                initComponents();
043:                this .setTitle("Select tables..");
044:                setBounds(50, 10, 200, 700);
045:
046:                ArrayList tables = DatabaseUtils.getTables();
047:                if (tables != null) {
048:                    for (Iterator it = tables.iterator(); it.hasNext();) {
049:                        String table = (String) it.next();
050:                        if (!alreadySelected.contains(table)) {
051:                            listModel.addElement(table);
052:                        }
053:                    }
054:                    list.setModel(listModel);
055:                }
056:            }
057:
058:            /**
059:             * Once the user has selected tables using this dialog, this method returns the selected tables.
060:             * @return the ArrayList of selected table names (String), never <code>null</code>.
061:             */
062:            public static ArrayList getTablelist() {
063:                return tableList;
064:            }
065:
066:            /**
067:             * By adding table names to this list, those tables are excluded from appearing in future dialogues.
068:             *
069:             * @return
070:             */
071:            public static List getAlreadyselected() {
072:                return alreadySelected;
073:            }
074:
075:            /**
076:             * clears all lists.
077:             */
078:            public static void clear() {
079:                tableList.clear();
080:                alreadySelected.clear();
081:            }
082:
083:            /** This method is called from within the constructor to
084:             * initialize the form.
085:             * WARNING: Do NOT modify this code. The content of this method is
086:             * always regenerated by the Form Editor.
087:             */
088:            private void initComponents() {//GEN-BEGIN:initComponents
089:                java.awt.GridBagConstraints gridBagConstraints;
090:
091:                jScrollPane1 = new javax.swing.JScrollPane();
092:                list = new javax.swing.JList();
093:                jPanel1 = new javax.swing.JPanel();
094:                selectButton = new javax.swing.JButton();
095:                cancelButton = new javax.swing.JButton();
096:
097:                getContentPane().setLayout(new java.awt.GridBagLayout());
098:
099:                addWindowListener(new java.awt.event.WindowAdapter() {
100:                    public void windowClosing(java.awt.event.WindowEvent evt) {
101:                        closeDialog(evt);
102:                    }
103:                });
104:
105:                list.addMouseListener(new java.awt.event.MouseAdapter() {
106:                    public void mouseClicked(java.awt.event.MouseEvent evt) {
107:                        listMouseClicked(evt);
108:                    }
109:                });
110:
111:                jScrollPane1.setViewportView(list);
112:
113:                gridBagConstraints = new java.awt.GridBagConstraints();
114:                gridBagConstraints.gridx = 0;
115:                gridBagConstraints.gridy = 0;
116:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
117:                gridBagConstraints.weightx = 1.0;
118:                gridBagConstraints.weighty = 1.0;
119:                getContentPane().add(jScrollPane1, gridBagConstraints);
120:
121:                selectButton.setText("Select");
122:                selectButton.setSelected(true);
123:                selectButton
124:                        .addActionListener(new java.awt.event.ActionListener() {
125:                            public void actionPerformed(
126:                                    java.awt.event.ActionEvent evt) {
127:                                selectButtonActionPerformed(evt);
128:                            }
129:                        });
130:
131:                jPanel1.add(selectButton);
132:
133:                cancelButton.setText("Cancel");
134:                cancelButton
135:                        .addActionListener(new java.awt.event.ActionListener() {
136:                            public void actionPerformed(
137:                                    java.awt.event.ActionEvent evt) {
138:                                cancelButtonActionPerformed(evt);
139:                            }
140:                        });
141:
142:                jPanel1.add(cancelButton);
143:
144:                gridBagConstraints = new java.awt.GridBagConstraints();
145:                gridBagConstraints.gridx = 0;
146:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
147:                getContentPane().add(jPanel1, gridBagConstraints);
148:
149:                pack();
150:            }//GEN-END:initComponents
151:
152:            private void listMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listMouseClicked
153:                if (evt.getClickCount() > 1) {
154:                    selectButtonActionPerformed(null);
155:                }
156:            }//GEN-LAST:event_listMouseClicked
157:
158:            private void cancelButtonActionPerformed(
159:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
160:                closeDialog(null);
161:            }//GEN-LAST:event_cancelButtonActionPerformed
162:
163:            private void selectButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_selectButtonActionPerformed
164:                Object[] tables = list.getSelectedValues();
165:                evt = null;
166:                tableList.clear();
167:                tableList.addAll(Arrays.asList(tables));
168:                dispose();
169:            }//GEN-LAST:event_selectButtonActionPerformed
170:
171:            /** Closes the dialog */
172:            private void closeDialog(WindowEvent evt) {//GEN-FIRST:event_closeDialog
173:                tableList.clear();
174:                evt = null;
175:                this .dispose();
176:            }//GEN-LAST:event_closeDialog
177:
178:            // Variables declaration - do not modify//GEN-BEGIN:variables
179:            private javax.swing.JButton cancelButton;
180:            private javax.swing.JPanel jPanel1;
181:            private javax.swing.JScrollPane jScrollPane1;
182:            private javax.swing.JList list;
183:            private javax.swing.JButton selectButton;
184:            // End of variables declaration//GEN-END:variables
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.