Source Code Cross Referenced for SessionInternalFrame.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-2004 Colin Bell
005:         * colbell@users.sourceforge.net
006:         *
007:         * Modifications Copyright (C) 2003-2004 Jason Height
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2.1 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
022:         */
023:        import java.awt.Component;
024:        import java.awt.Window;
025:        import java.awt.event.FocusEvent;
026:        import java.beans.PropertyVetoException;
027:
028:        import javax.swing.Action;
029:        import javax.swing.Icon;
030:        import javax.swing.SwingUtilities;
031:        import javax.swing.event.InternalFrameAdapter;
032:        import javax.swing.event.InternalFrameEvent;
033:
034:        import net.sourceforge.squirrel_sql.client.IApplication;
035:        import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
036:        import net.sourceforge.squirrel_sql.client.session.IObjectTreeInternalFrame;
037:        import net.sourceforge.squirrel_sql.client.session.ISQLInternalFrame;
038:        import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
039:        import net.sourceforge.squirrel_sql.client.session.ISession;
040:        import net.sourceforge.squirrel_sql.client.Version;
041:
042:        public class SessionInternalFrame extends BaseSessionInternalFrame
043:                implements  ISQLInternalFrame, IObjectTreeInternalFrame {
044:            static final long serialVersionUID = 6961615570741567740L;
045:
046:            /** Application API. */
047:            private final IApplication _app;
048:
049:            private SessionPanel _sessionPanel;
050:
051:            public SessionInternalFrame(ISession session) {
052:                super (session, session.getTitle(), true, true, true, true);
053:                _app = session.getApplication();
054:                setVisible(false);
055:                createGUI(session);
056:            }
057:
058:            public SessionPanel getSessionPanel() {
059:                return _sessionPanel;
060:            }
061:
062:            public ISQLPanelAPI getSQLPanelAPI() {
063:                return _sessionPanel.getSQLPaneAPI();
064:            }
065:
066:            public IObjectTreeAPI getObjectTreeAPI() {
067:                return _sessionPanel.getObjectTreePanel();
068:            }
069:
070:            /**
071:             * Add the passed action to the toolbar of the sessions main window.
072:             *
073:             * @param	action	Action to be added.
074:             */
075:            void addToToolbar(Action action) {
076:                _sessionPanel.addToToolbar(action);
077:            }
078:
079:            public void addSeparatorToToolbar() {
080:                _sessionPanel.addSeparatorToToolbar();
081:            }
082:
083:            public void addToToolsPopUp(String selectionString, Action action) {
084:                _sessionPanel.addToToolsPopUp(selectionString, action);
085:            }
086:
087:            public void setSelected(boolean selected)
088:                    throws PropertyVetoException {
089:                super .setSelected(selected);
090:
091:                // Without this when using alt left/right to move
092:                // between sessions the focus is left in the SQL
093:                // entry area of the previous session.
094:                // TODO: Once Java 5 is minimum supported
095:                // we don't need this,
096:                if (Version.isJDK14()) {
097:                    if (selected) {
098:                        SwingUtilities.invokeLater(new Runnable() {
099:                            public void run() {
100:                                _sessionPanel.getSQLEntryPanel().requestFocus();
101:                            }
102:                        });
103:                    }
104:                }
105:            }
106:
107:            private void createGUI(final ISession session) {
108:                setVisible(false);
109:                setDefaultCloseOperation(SessionInternalFrame.DO_NOTHING_ON_CLOSE);
110:                final IApplication app = session.getApplication();
111:                Icon icon = app.getResources().getIcon(getClass(), "frameIcon"); //i18n
112:                if (icon != null) {
113:                    setFrameIcon(icon);
114:                }
115:
116:                addInternalFrameListener(new InternalFrameAdapter() {
117:                    // This is to fix a problem with the JDK (up to version 1.3)
118:                    // where focus events were not generated correctly. The sympton
119:                    // is being unable to key into the text entry field unless you click
120:                    // elsewhere after focus is gained by the internal frame.
121:                    // See bug ID 4309079 on the JavaSoft bug parade (plus others).
122:                    public void internalFrameActivated(InternalFrameEvent evt) {
123:                        Window window = SwingUtilities
124:                                .windowForComponent(SessionInternalFrame.this ._sessionPanel
125:                                        .getSQLPanel());
126:                        Component focusOwner = (window != null) ? window
127:                                .getFocusOwner() : null;
128:                        if (focusOwner != null) {
129:                            FocusEvent lost = new FocusEvent(focusOwner,
130:                                    FocusEvent.FOCUS_LOST);
131:                            FocusEvent gained = new FocusEvent(focusOwner,
132:                                    FocusEvent.FOCUS_GAINED);
133:                            window.dispatchEvent(lost);
134:                            window.dispatchEvent(gained);
135:                            window.dispatchEvent(lost);
136:                            focusOwner.requestFocus();
137:                        }
138:                    }
139:
140:                    public void internalFrameClosing(InternalFrameEvent evt) {
141:                        if (!session.isfinishedLoading()) {
142:                            return;
143:                        }
144:                        final ISession mySession = getSession();
145:                        if (mySession != null) {
146:                            _sessionPanel.sessionWindowClosing();
147:                            _app.getSessionManager().closeSession(mySession);
148:                        }
149:                    }
150:                });
151:
152:                _sessionPanel = new SessionPanel(session);
153:                setContentPane(_sessionPanel);
154:                validate();
155:            }
156:
157:            public void requestFocus() {
158:                _sessionPanel.getSQLEntryPanel().requestFocus();
159:            }
160:
161:            public boolean hasSQLPanelAPI() {
162:                return true;
163:            }
164:
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.