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


001:        package net.sourceforge.squirrel_sql.client.gui.session;
002:
003:        /*
004:         * Copyright (C) 2001-2003 Colin Bell
005:         * colbell@users.sourceforge.net
006:         *
007:         * Copyright (C) 2003 Jason Height
008:         * jmheight@users.sourceforge.net
009:         *
010:         * This library is free software; you can redistribute it and/or
011:         * modify it under the terms of the GNU Lesser General Public
012:         * License as published by the Free Software Foundation; either
013:         * version 2.1 of the License, or (at your option) any later version.
014:         *
015:         * This library is distributed in the hope that it will be useful,
016:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
017:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
018:         * Lesser General Public License for more details.
019:         *
020:         * You should have received a copy of the GNU Lesser General Public
021:         * License along with this library; if not, write to the Free Software
022:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
023:         */
024:        import net.sourceforge.squirrel_sql.client.IApplication;
025:        import net.sourceforge.squirrel_sql.client.action.ActionCollection;
026:        import net.sourceforge.squirrel_sql.client.session.*;
027:        import net.sourceforge.squirrel_sql.client.session.action.*;
028:        import net.sourceforge.squirrel_sql.client.session.mainpanel.SQLPanel;
029:        import net.sourceforge.squirrel_sql.fw.gui.ToolBar;
030:        import net.sourceforge.squirrel_sql.fw.gui.StatusBar;
031:
032:        import javax.swing.*;
033:        import javax.swing.event.InternalFrameAdapter;
034:        import javax.swing.event.InternalFrameEvent;
035:        import java.awt.*;
036:
037:        public class SQLInternalFrame extends BaseSessionInternalFrame
038:                implements  ISQLInternalFrame {
039:            /** Application API. */
040:            private final IApplication _app;
041:
042:            private SQLPanel _sqlPanel;
043:            /** Toolbar for window. */
044:            private SQLToolBar _toolBar;
045:
046:            private StatusBar _statusBar = new StatusBar();
047:
048:            public SQLInternalFrame(ISession session) {
049:                super (session, session.getTitle(), true, true, true, true);
050:                _app = session.getApplication();
051:                setVisible(false);
052:                createGUI(session);
053:            }
054:
055:            public SQLPanel getSQLPanel() {
056:                return _sqlPanel;
057:            }
058:
059:            public ISQLPanelAPI getSQLPanelAPI() {
060:                return _sqlPanel.getSQLPanelAPI();
061:            }
062:
063:            private void createGUI(ISession session) {
064:                setVisible(false);
065:                final IApplication app = session.getApplication();
066:                Icon icon = app.getResources().getIcon(getClass(), "frameIcon"); //i18n
067:                if (icon != null) {
068:                    setFrameIcon(icon);
069:                }
070:
071:                // This is to fix a problem with the JDK (up to version 1.3)
072:                // where focus events were not generated correctly. The sympton
073:                // is being unable to key into the text entry field unless you click
074:                // elsewhere after focus is gained by the internal frame.
075:                // See bug ID 4309079 on the JavaSoft bug parade (plus others).
076:                addInternalFrameListener(new InternalFrameAdapter() {
077:                    public void internalFrameActivated(InternalFrameEvent evt) {
078:                        //				Window window = SwingUtilities
079:                        //						.windowForComponent(SQLInternalFrame.this.getSQLPanel());
080:                        //				Component focusOwner = (window != null) ? window
081:                        //						.getFocusOwner() : null;
082:                        //				if (focusOwner != null)
083:                        //				{
084:                        //					FocusEvent lost = new FocusEvent(focusOwner,
085:                        //							FocusEvent.FOCUS_LOST);
086:                        //					FocusEvent gained = new FocusEvent(focusOwner,
087:                        //							FocusEvent.FOCUS_GAINED);
088:                        //					window.dispatchEvent(lost);
089:                        //					window.dispatchEvent(gained);
090:                        //					window.dispatchEvent(lost);
091:                        //					focusOwner.requestFocus();
092:                        //				}
093:
094:                        SwingUtilities.invokeLater(new Runnable() {
095:                            public void run() {
096:                                _sqlPanel.getSQLEntryPanel().getTextComponent()
097:                                        .requestFocus();
098:                            }
099:                        });
100:                    }
101:
102:                    public void internalFrameClosing(InternalFrameEvent e) {
103:                        _sqlPanel.sessionWindowClosing();
104:                    }
105:                });
106:
107:                _sqlPanel = new SQLPanel(getSession(), false);
108:
109:                // Needed to make the panel set the divider location from preferences
110:                _sqlPanel.setVisible(true);
111:
112:                _toolBar = new SQLToolBar(getSession(), _sqlPanel
113:                        .getSQLPanelAPI());
114:                JPanel contentPanel = new JPanel(new BorderLayout());
115:                contentPanel.add(_toolBar, BorderLayout.NORTH);
116:                contentPanel.add(_sqlPanel, BorderLayout.CENTER);
117:
118:                Font fn = app.getFontInfoStore().getStatusBarFontInfo()
119:                        .createFont();
120:                _statusBar.setFont(fn);
121:                contentPanel.add(_statusBar, BorderLayout.SOUTH);
122:
123:                RowColumnLabel lblRowCol = new RowColumnLabel(_sqlPanel
124:                        .getSQLEntryPanel());
125:                _statusBar.addJComponent(lblRowCol);
126:
127:                setContentPane(contentPanel);
128:                validate();
129:            }
130:
131:            public void requestFocus() {
132:                SwingUtilities.invokeLater(new Runnable() {
133:                    public void run() {
134:                        _sqlPanel.getSQLEntryPanel().requestFocus();
135:                    }
136:                });
137:
138:            }
139:
140:            public void addSeparatorToToolbar() {
141:                if (null != _toolBar) {
142:                    _toolBar.addSeparator();
143:                }
144:            }
145:
146:            public void addToToolbar(Action action) {
147:                if (null != _toolBar) {
148:                    _toolBar.add(action);
149:                }
150:            }
151:
152:            public void addToToolsPopUp(String selectionString, Action action) {
153:                getSQLPanelAPI().addToToolsPopUp(selectionString, action);
154:            }
155:
156:            public boolean hasSQLPanelAPI() {
157:                return true;
158:            }
159:
160:            /** The class representing the toolbar at the top of a sql internal frame*/
161:            private class SQLToolBar extends ToolBar {
162:                SQLToolBar(ISession session, ISQLPanelAPI panel) {
163:                    super ();
164:                    createGUI(session, panel);
165:                }
166:
167:                private void createGUI(ISession session, ISQLPanelAPI panel) {
168:                    ActionCollection actions = session.getApplication()
169:                            .getActionCollection();
170:                    setUseRolloverButtons(true);
171:                    setFloatable(false);
172:                    add(actions.get(ExecuteSqlAction.class));
173:                    addSeparator();
174:                    add(actions.get(FileNewAction.class));
175:                    add(actions.get(FileOpenAction.class));
176:                    add(actions.get(FileAppendAction.class));
177:                    add(actions.get(FileSaveAction.class));
178:                    add(actions.get(FileSaveAsAction.class));
179:                    add(actions.get(FilePrintAction.class));
180:                    add(actions.get(FileCloseAction.class));
181:                    addSeparator();
182:                    add(actions.get(PreviousSqlAction.class));
183:                    add(actions.get(NextSqlAction.class));
184:                    add(actions.get(SelectSqlAction.class));
185:                    addSeparator();
186:                    add(actions.get(SQLFilterAction.class));
187:                    actions.get(SQLFilterAction.class).setEnabled(true);
188:                }
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.