Source Code Cross Referenced for HibernateConfigPanel.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » plugins » hibernate » configuration » 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 Client » squirrel sql 2.6.5a » net.sourceforge.squirrel_sql.plugins.hibernate.configuration 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.squirrel_sql.plugins.hibernate.configuration;
002:
003:        import net.sourceforge.squirrel_sql.fw.util.StringManager;
004:        import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
005:
006:        import javax.swing.*;
007:        import javax.swing.border.TitledBorder;
008:        import java.awt.*;
009:
010:        public class HibernateConfigPanel extends JPanel {
011:            private static final StringManager s_stringMgr = StringManagerFactory
012:                    .getStringManager(HibernateConfigPanel.class);
013:
014:            JComboBox cboConfigs;
015:            JButton btnNewConfig;
016:            JButton btnRemoveConfig;
017:            JTextField txtFactoryProvider;
018:            JButton btnEditFactoryProviderInfo;
019:            JList lstClassPath;
020:            JButton btnClassPathAdd;
021:            JButton btnClassPathRemove;
022:            JTextField txtConfigName;
023:            JButton btnApplyConfigChanges;
024:            JRadioButton radConfiguration;
025:            JRadioButton radUserDefProvider;
026:            JRadioButton radJPA;
027:            JTextField txtPersistenceUnitName;
028:
029:            public HibernateConfigPanel() {
030:                setLayout(new GridBagLayout());
031:
032:                GridBagConstraints gbc;
033:
034:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
035:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
036:                        new Insets(5, 5, 5, 5), 0, 0);
037:                // i18n[HibernateConfigPanel.config=Configuration]
038:                JLabel lblConfig = new JLabel(s_stringMgr
039:                        .getString("HibernatePanel.config"));
040:                add(lblConfig, gbc);
041:
042:                gbc = new GridBagConstraints(1, 0, 1, 1, 1, 0,
043:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
044:                        new Insets(5, 5, 5, 5), 0, 0);
045:                cboConfigs = new JComboBox();
046:                add(cboConfigs, gbc);
047:
048:                gbc = new GridBagConstraints(2, 0, 1, 1, 0, 0,
049:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
050:                        new Insets(5, 5, 5, 5), 0, 0);
051:                // i18n[HibernateConfigPanel.newConfig=New]
052:                btnNewConfig = new JButton(s_stringMgr
053:                        .getString("HibernatePanel.newConfig"));
054:                add(btnNewConfig, gbc);
055:
056:                gbc = new GridBagConstraints(3, 0, 1, 1, 0, 0,
057:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
058:                        new Insets(5, 5, 5, 5), 0, 0);
059:                // i18n[HibernateConfigPanel.removeConfig=Remove]
060:                btnRemoveConfig = new JButton(s_stringMgr
061:                        .getString("HibernatePanel.removeConfig"));
062:                add(btnRemoveConfig, gbc);
063:
064:                gbc = new GridBagConstraints(0, 1, 4, 1, 1, 1,
065:                        GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
066:                        new Insets(15, 10, 10, 10), 0, 0);
067:                add(createConfigDefPanel(), gbc);
068:            }
069:
070:            private JPanel createConfigDefPanel() {
071:                JPanel ret = new JPanel(new GridBagLayout());
072:                // i18n[HibernateConfigPanel.ConfiguirationDef=Configuration definition]
073:                ret.setBorder(BorderFactory.createTitledBorder(s_stringMgr
074:                        .getString("HibernatePanel.ConfiguirationDef")));
075:
076:                GridBagConstraints gbc;
077:
078:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
079:                        GridBagConstraints.NORTHWEST,
080:                        GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5),
081:                        0, 0);
082:                ret.add(createConfigNamePanel(), gbc);
083:
084:                gbc = new GridBagConstraints(0, 1, 1, 1, 1, 1,
085:                        GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
086:                        new Insets(0, 5, 5, 5), 0, 0);
087:                ret.add(createClasspathPanel(), gbc);
088:
089:                gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0,
090:                        GridBagConstraints.NORTHWEST,
091:                        GridBagConstraints.HORIZONTAL, new Insets(10, 5, 5, 5),
092:                        0, 0);
093:                ret.add(createHowToCreateSessionFactoryPanel(), gbc);
094:
095:                gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0,
096:                        GridBagConstraints.CENTER, GridBagConstraints.NONE,
097:                        new Insets(10, 5, 5, 5), 0, 0);
098:                // i18n[HibernateConfigPanel.applyConfigChanges=Apply changes to this configuration]
099:                btnApplyConfigChanges = new JButton(s_stringMgr
100:                        .getString("HibernatePanel.applyConfigChanges"));
101:                ret.add(btnApplyConfigChanges, gbc);
102:
103:                return ret;
104:            }
105:
106:            private JPanel createConfigNamePanel() {
107:                JPanel ret = new JPanel(new GridBagLayout());
108:
109:                GridBagConstraints gbc;
110:
111:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
112:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
113:                        new Insets(5, 5, 5, 5), 0, 0);
114:                // i18n[HibernateConfigPanel.configName=Configuration name]
115:                ret.add(new JLabel(s_stringMgr
116:                        .getString("HibernatePanel.configName")), gbc);
117:
118:                gbc = new GridBagConstraints(1, 0, 1, 1, 1, 0,
119:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
120:                        new Insets(5, 5, 5, 5), 0, 0);
121:                txtConfigName = new JTextField();
122:                ret.add(txtConfigName, gbc);
123:
124:                return ret;
125:            }
126:
127:            private JPanel createClasspathPanel() {
128:                // i18n[HibernateConfigPanel.newFactoryClasspathBorder=Additional classpath entries to create a SessionFactoryImpl]
129:                TitledBorder brd = BorderFactory.createTitledBorder(s_stringMgr
130:                        .getString("HibernatePanel.newFactoryClasspathBorder"));
131:                JPanel ret = new JPanel(new GridBagLayout());
132:                ret.setBorder(brd);
133:
134:                GridBagConstraints gbc;
135:
136:                gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1,
137:                        GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
138:                        new Insets(0, 5, 5, 5), 0, 0);
139:                lstClassPath = new JList();
140:                ret.add(new JScrollPane(lstClassPath), gbc);
141:
142:                gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
143:                        GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
144:                        new Insets(0, 5, 5, 5), 0, 0);
145:                ret.add(createButtonClasspathPanel(), gbc);
146:
147:                return ret;
148:
149:            }
150:
151:            private JPanel createButtonClasspathPanel() {
152:                JPanel ret = new JPanel(new GridBagLayout());
153:
154:                GridBagConstraints gbc;
155:
156:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
157:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
158:                        new Insets(5, 5, 5, 5), 0, 0);
159:                // i18n[HibernateConfigPanel.classPathAdd=Add classpath entry]
160:                btnClassPathAdd = new JButton(s_stringMgr
161:                        .getString("HibernatePanel.classPathAdd"));
162:                ret.add(btnClassPathAdd, gbc);
163:
164:                gbc = new GridBagConstraints(1, 0, 1, 1, 0, 0,
165:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
166:                        new Insets(5, 5, 5, 5), 0, 0);
167:                // i18n[HibernateConfigPanel.classPathRemove=Remove selected entries]
168:                btnClassPathRemove = new JButton(s_stringMgr
169:                        .getString("HibernatePanel.classPathRemove"));
170:                ret.add(btnClassPathRemove, gbc);
171:
172:                return ret;
173:            }
174:
175:            private JPanel createHowToCreateSessionFactoryPanel() {
176:                JPanel ret = new JPanel();
177:
178:                ret.setBorder(BorderFactory.createEtchedBorder());
179:                ret.setLayout(new GridBagLayout());
180:
181:                GridBagConstraints gbc;
182:
183:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
184:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
185:                        new Insets(5, 5, 5, 5), 0, 0);
186:                // i18n[HibernateConfigPanel.toObtainSessionFact=To obtain a Hibernate SessionFactoryImpl instance SQuirreL should:]
187:                ret.add(new JLabel(s_stringMgr
188:                        .getString("HibernatePanel.toObtainSessionFact")), gbc);
189:
190:                gbc = new GridBagConstraints(0, 1, 1, 1, 0, 0,
191:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
192:                        new Insets(5, 5, 5, 5), 0, 0);
193:                // i18n[HibernateConfigPanel.toObtainSessionFactConfiguration=Call "new org.hibernate.cfg.Configuration().configure().buildSessionFactory();"]
194:                radConfiguration = new JRadioButton(
195:                        s_stringMgr
196:                                .getString("HibernatePanel.toObtainSessionFactConfiguration"));
197:                ret.add(radConfiguration, gbc);
198:
199:                gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0,
200:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
201:                        new Insets(5, 5, 5, 5), 0, 0);
202:                ret.add(createJPAPanel(), gbc);
203:
204:                gbc = new GridBagConstraints(0, 3, 1, 1, 0, 0,
205:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
206:                        new Insets(5, 5, 0, 5), 0, 0);
207:                // i18n[HibernateConfigPanel.toObtainSessionFactFactoryProvider=Invoke the user defined provider method below:]
208:                radUserDefProvider = new JRadioButton(
209:                        s_stringMgr
210:                                .getString("HibernatePanel.toObtainSessionFactFactoryProvider"));
211:                ret.add(radUserDefProvider, gbc);
212:
213:                ButtonGroup btnGr = new ButtonGroup();
214:                btnGr.add(radConfiguration);
215:                btnGr.add(radUserDefProvider);
216:                btnGr.add(radJPA);
217:                radConfiguration.setSelected(true);
218:
219:                gbc = new GridBagConstraints(0, 4, 1, 1, 1, 0,
220:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
221:                        new Insets(0, 5, 5, 5), 0, 0);
222:                ret.add(createUserDefinedSessionFactoryPanel(), gbc);
223:
224:                return ret;
225:
226:            }
227:
228:            private JPanel createJPAPanel() {
229:                JPanel ret = new JPanel(new GridBagLayout());
230:
231:                GridBagConstraints gbc;
232:
233:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
234:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
235:                        new Insets(5, 0, 5, 5), 0, 0);
236:                // i18n[HibernateConfigPanel.toObtainSessionFactJPA=Call "javax.persistence.Persistence.createEntityManagerFactory("<persitence-unit name>");"]
237:                radJPA = new JRadioButton(s_stringMgr
238:                        .getString("HibernatePanel.toObtainSessionFactJPA"));
239:                ret.add(radJPA, gbc);
240:
241:                gbc = new GridBagConstraints(1, 0, 1, 1, 0, 0,
242:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
243:                        new Insets(5, 5, 5, 5), 0, 0);
244:                // i18n[HibernateConfigPanel.toObtainSessionFactPersUnit=persitence-unit name:]
245:                ret
246:                        .add(
247:                                new JLabel(
248:                                        s_stringMgr
249:                                                .getString("HibernatePanel.toObtainSessionFactPersUnit")),
250:                                gbc);
251:
252:                gbc = new GridBagConstraints(2, 0, 1, 1, 1, 0,
253:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
254:                        new Insets(5, 0, 5, 5), 0, 0);
255:                txtPersistenceUnitName = new JTextField();
256:                ret.add(txtPersistenceUnitName, gbc);
257:
258:                return ret;
259:            }
260:
261:            private JPanel createUserDefinedSessionFactoryPanel() {
262:                JPanel ret = new JPanel(new GridBagLayout());
263:
264:                GridBagConstraints gbc;
265:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
266:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
267:                        new Insets(5, 5, 5, 5), 0, 0);
268:                // i18n[HibernateConfigPanel.FactoryProvider=SessionFactoryImpl provider]
269:                JLabel lblConfig = new JLabel(s_stringMgr
270:                        .getString("HibernatePanel.FactoryProvider"));
271:                ret.add(lblConfig, gbc);
272:
273:                gbc = new GridBagConstraints(1, 0, 1, 1, 1, 0,
274:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
275:                        new Insets(5, 5, 5, 5), 0, 0);
276:                txtFactoryProvider = new JTextField();
277:                txtFactoryProvider.setEditable(false);
278:                txtFactoryProvider.setBackground(Color.lightGray);
279:
280:                ret.add(txtFactoryProvider, gbc);
281:
282:                gbc = new GridBagConstraints(2, 0, 1, 1, 0, 0,
283:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
284:                        new Insets(5, 5, 5, 5), 0, 0);
285:                // i18n[HibernateConfigPanel.editFactoryProvider=Edit]
286:                btnEditFactoryProviderInfo = new JButton(s_stringMgr
287:                        .getString("HibernatePanel.editFactoryProvider"));
288:                ret.add(btnEditFactoryProviderInfo, gbc);
289:
290:                return ret;
291:            }
292:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.