Source Code Cross Referenced for BaseSessionInternalFrame.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) 2003-2004 Jason Height
005:         * jmheight@users.sourceforge.net
006:         *
007:         * This library is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:         *
012:         * This library is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this library; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020:         */
021:        import java.io.File;
022:
023:        import javax.swing.event.InternalFrameAdapter;
024:        import javax.swing.event.InternalFrameEvent;
025:
026:        import net.sourceforge.squirrel_sql.client.gui.BaseInternalFrame;
027:        import net.sourceforge.squirrel_sql.client.session.ISession;
028:        import net.sourceforge.squirrel_sql.fw.util.StringManager;
029:        import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
030:
031:        /**
032:         * Base functionality for Squirrels internal frames that are attached directly
033:         * to a session.
034:         *
035:         * @author <A HREF="mailto:jmheight@users.sourceforge.net">Jason Height</A>
036:         */
037:        public class BaseSessionInternalFrame extends BaseInternalFrame {
038:            protected ISession _session;
039:            private String _titleWithoutFile = "";
040:            private String _sqlFilePath = null;
041:
042:            /** Internationalized strings for this class. */
043:            private static final StringManager s_stringMgr = StringManagerFactory
044:                    .getStringManager(BaseSessionInternalFrame.class);
045:
046:            /**
047:             * Creates a non-resizable, non-closable, non-maximizable,
048:             * non-iconifiable JInternalFrame with no title.
049:             */
050:            public BaseSessionInternalFrame(ISession session) {
051:                super ();
052:                setupSheet(session);
053:            }
054:
055:            /**
056:             * Creates a non-closable, non-maximizable, non-iconifiable
057:             * JInternalFrame with the specified title and with
058:             * resizability specified.
059:             *
060:             * @param	title		Title for internal frame.
061:             * @param	resizable	<TT>true</TT> if frame can be resized.
062:             */
063:            public BaseSessionInternalFrame(ISession session, String title,
064:                    boolean resizable) {
065:                super (title, resizable);
066:                _titleWithoutFile = title;
067:                setupSheet(session);
068:            }
069:
070:            /**
071:             * Creates a JInternalFrame with the specified title and with
072:             * resizability, closability, maximizability and
073:             * iconifability specified.
074:             *
075:             * @param	title		Title for internal frame.
076:             * @param	resizable	<TT>true</TT> if frame can be resized.
077:             * @param	closeable	<TT>true</TT> if frame can be closed.
078:             * @param	maximizable	<TT>true</TT> if frame can be maximized.
079:             * @param	iconifiable	<TT>true</TT> if frame can be iconified.
080:             */
081:            public BaseSessionInternalFrame(ISession session, String title,
082:                    boolean resizable, boolean closable, boolean maximizable,
083:                    boolean iconifiable) {
084:                super (title, resizable, closable, maximizable, iconifiable);
085:                _titleWithoutFile = title;
086:                setupSheet(session);
087:            }
088:
089:            public void setTitle(String title) {
090:                _titleWithoutFile = title;
091:
092:                if (null == _sqlFilePath) {
093:                    super .setTitle(_titleWithoutFile);
094:                } else {
095:                    // i18n[BaseSessionInternalFrame.title={0}   SQL file: {1}]
096:                    String compositetitle = s_stringMgr.getString(
097:                            "BaseSessionInternalFrame.title", new String[] {
098:                                    _titleWithoutFile, _sqlFilePath });
099:                    super .setTitle(compositetitle);
100:                }
101:            }
102:
103:            private final void setupSheet(ISession session) {
104:                if (session == null) {
105:                    throw new IllegalArgumentException("Null ISession passed");
106:                }
107:                _session = session;
108:                _session.getApplication().getWindowManager()
109:                        .registerSessionSheet(this );
110:                addInternalFrameListener(new SheetActivationListener());
111:            }
112:
113:            public ISession getSession() {
114:                return _session;
115:            }
116:
117:            public void setSqlFile(File sqlFile) {
118:                if (sqlFile == null) {
119:                    _sqlFilePath = null;
120:                } else {
121:                    _sqlFilePath = sqlFile.getAbsolutePath();
122:                }
123:                setTitle(_titleWithoutFile);
124:            }
125:
126:            /**
127:             * Toggles the "*" at the end of the filename based on the value of 
128:             * unsavedEdits.  Just to provide the user with a visual hint that they may
129:             * need to save their changes.
130:             * 
131:             * @param unsavedEdits
132:             */
133:            public void setUnsavedEdits(boolean unsavedEdits) {
134:                String title = super .getTitle();
135:
136:                if (unsavedEdits && !title.endsWith("*")) {
137:                    super .setTitle(title + "*");
138:                }
139:                if (!unsavedEdits && title.endsWith("*")) {
140:                    super .setTitle(title.substring(0, title.length() - 1));
141:                }
142:            }
143:
144:            public boolean hasSQLPanelAPI() {
145:                return false;
146:            }
147:
148:            public void closeFrame(boolean withEvents) {
149:                if (!_session.isfinishedLoading()) {
150:                    return;
151:                }
152:                if (withEvents) {
153:                    fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING);
154:                }
155:                dispose();
156:
157:                if (withEvents) {
158:                    fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED);
159:                }
160:            }
161:
162:            /**
163:             * Sets the session behind this sheet to the active session when the
164:             * frame is activated
165:             */
166:            private class SheetActivationListener extends InternalFrameAdapter {
167:                public void internalFrameActivated(InternalFrameEvent e) {
168:                    _session
169:                            .setActiveSessionWindow((BaseSessionInternalFrame) e
170:                                    .getInternalFrame());
171:                    _session.getApplication().getSessionManager()
172:                            .setActiveSession(_session);
173:                }
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.