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


001:        package net.sourceforge.squirrel_sql.plugins.hibernate;
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 java.awt.*;
008:        import java.util.prefs.Preferences;
009:
010:        public class HibernateTabPanel extends JPanel {
011:            private static final StringManager s_stringMgr = StringManagerFactory
012:                    .getStringManager(HibernateTabPanel.class);
013:
014:            private static final String PERF_KEY_HQL_TAB_DIVIDER_LOCATION = "Squirrel.hibernateplugin.hqlTabDivLoc";
015:            private static final String PERF_KEY_LAST_SELECTED_TAB = "Squirrel.hibernateplugin.lastSelectedTab";
016:
017:            JComboBox cboConfigurations;
018:            JToggleButton btnConnected;
019:            JButton btnOpenConfigs;
020:
021:            private JSplitPane _splitHqlSql;
022:            private JPanel _toolbar;
023:            private int _curXOfToolbar;
024:            private JTabbedPane _tabObjectsHql;
025:            private HibernatePluginResources _resource;
026:
027:            public HibernateTabPanel(JComponent mappedObjectComp,
028:                    JComponent hqlTextComp, JComponent sqlTextComp,
029:                    HibernatePluginResources resource) {
030:                _resource = resource;
031:                setLayout(new GridBagLayout());
032:
033:                GridBagConstraints gbc;
034:
035:                gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
036:                        GridBagConstraints.NORTHWEST,
037:                        GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0),
038:                        0, 0);
039:                _toolbar = createToolbar();
040:                add(_toolbar, gbc);
041:
042:                _splitHqlSql = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
043:                        hqlTextComp, sqlTextComp);
044:
045:                _tabObjectsHql = new JTabbedPane();
046:
047:                // i18n[HibernateTabPanel.mappedObjects=Mapped objects]
048:                _tabObjectsHql.add(s_stringMgr
049:                        .getString("HQLTabPanel.mappedObjects"),
050:                        mappedObjectComp);
051:
052:                // i18n[HibernateTabPanel.hql=HQL]
053:                _tabObjectsHql.add(s_stringMgr.getString("HQLTabPanel.hql"),
054:                        _splitHqlSql);
055:
056:                gbc = new GridBagConstraints(0, 1, 1, 1, 1, 1,
057:                        GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
058:                        new Insets(0, 0, 0, 0), 0, 0);
059:                add(_tabObjectsHql, gbc);
060:
061:                _tabObjectsHql.setSelectedIndex(Preferences.userRoot().getInt(
062:                        PERF_KEY_LAST_SELECTED_TAB, 0));
063:
064:                SwingUtilities.invokeLater(new Runnable() {
065:                    public void run() {
066:                        _splitHqlSql.setDividerLocation(Preferences.userRoot()
067:                                .getDouble(PERF_KEY_HQL_TAB_DIVIDER_LOCATION,
068:                                        0.5));
069:                    }
070:                });
071:
072:            }
073:
074:            public void closing() {
075:                Preferences.userRoot().putDouble(
076:                        PERF_KEY_HQL_TAB_DIVIDER_LOCATION,
077:                        ((double) _splitHqlSql.getDividerLocation())
078:                                / ((double) _splitHqlSql.getHeight()));
079:                Preferences.userRoot().putInt(PERF_KEY_LAST_SELECTED_TAB,
080:                        _tabObjectsHql.getSelectedIndex());
081:            }
082:
083:            private JPanel createToolbar() {
084:                JPanel ret = new JPanel();
085:
086:                ret.setLayout(new GridBagLayout());
087:
088:                GridBagConstraints gbc;
089:
090:                _curXOfToolbar = 0;
091:
092:                // i18n[HibernateTabPanel.configuration=Configuration]
093:                JLabel lblCfg = new JLabel(s_stringMgr
094:                        .getString("HQLTabPanel.configuration"));
095:                gbc = new GridBagConstraints(_curXOfToolbar++, 0, 1, 1, 0, 0,
096:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
097:                        new Insets(5, 5, 5, 5), 0, 0);
098:                ret.add(lblCfg, gbc);
099:
100:                cboConfigurations = new JComboBox();
101:                gbc = new GridBagConstraints(_curXOfToolbar++, 0, 1, 1, 1, 0,
102:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
103:                        new Insets(5, 0, 5, 5), 0, 0);
104:                ret.add(cboConfigurations, gbc);
105:
106:                gbc = new GridBagConstraints(_curXOfToolbar++, 0, 1, 1, 0, 0,
107:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
108:                        new Insets(5, 5, 5, 5), 0, 0);
109:                btnConnected = new JToggleButton();
110:                //i18n[hibernate.HibernateTabPanel.connect=Connect/disconnect configuration selected configuration]
111:                btnConnected.setToolTipText(s_stringMgr
112:                        .getString("hibernate.HQLTabPanel.connect"));
113:                ret.add(btnConnected, gbc);
114:
115:                gbc = new GridBagConstraints(_curXOfToolbar++, 0, 1, 1, 0, 0,
116:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
117:                        new Insets(5, 5, 5, 5), 0, 0);
118:                btnOpenConfigs = new JButton(
119:                        _resource
120:                                .getIcon(HibernatePluginResources.IKeys.HIBERNATE_IMAGE));
121:                //i18n[hibernate.HibernateTabPanel.openConfigs=Open Hibernate configurations]
122:                btnOpenConfigs.setToolTipText(s_stringMgr
123:                        .getString("hibernate.HibernateTabPanel.openConfigs"));
124:                ret.add(btnOpenConfigs, gbc);
125:
126:                return ret;
127:            }
128:
129:            public void addToToolbar(JComponent comp) {
130:                GridBagConstraints gbc = new GridBagConstraints(
131:                        _curXOfToolbar++, 0, 1, 1, 0, 0,
132:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
133:                        new Insets(5, 5, 5, 5), 0, 0);
134:                _toolbar.add(comp, gbc);
135:
136:                _toolbar.validate();
137:            }
138:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.