Source Code Cross Referenced for BaseDialog.java in  » Database-Client » executequery » org » executequery » gui » 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 » executequery » org.executequery.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BaseDialog.java
003:         *
004:         * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         *
020:         */
021:
022:        package org.executequery.gui;
023:
024:        import java.awt.BorderLayout;
025:        import java.awt.GridBagConstraints;
026:        import java.awt.GridBagLayout;
027:        import java.awt.Insets;
028:        import java.awt.event.FocusEvent;
029:        import java.awt.event.FocusListener;
030:        import javax.swing.JDialog;
031:        import javax.swing.JPanel;
032:        import javax.swing.SwingUtilities;
033:        import org.executequery.GUIUtilities;
034:        import org.executequery.ActiveComponent;
035:        import org.underworldlabs.swing.GUIUtils;
036:        import org.underworldlabs.swing.GlassPanePanel;
037:
038:        /* ----------------------------------------------------------
039:         * CVS NOTE: Changes to the CVS repository prior to the 
040:         *           release of version 3.0.0beta1 has meant a 
041:         *           resetting of CVS revision numbers.
042:         * ----------------------------------------------------------
043:         */
044:
045:        /**
046:         * Base dialog to be extended.
047:         *
048:         * @author   Takis Diakoumis
049:         * @version  $Revision: 1.6 $
050:         * @date     $Date: 2006/06/07 15:06:47 $
051:         */
052:        public class BaseDialog extends JDialog implements  FocusListener,
053:                ActionContainer {
054:
055:            /** the content panel */
056:            private JPanel contentPanel;
057:
058:            /** Creates a new instance of BaseDialog */
059:            public BaseDialog(String name, boolean modal) {
060:                this (name, modal, null);
061:            }
062:
063:            /** Creates a new instance of BaseDialog */
064:            public BaseDialog(String name, boolean modal, boolean resizeable) {
065:                this (name, modal, null);
066:                setResizable(resizeable);
067:            }
068:
069:            /** Creates a new instance of BaseDialog */
070:            public BaseDialog(String name, boolean modal, JPanel panel) {
071:                super (GUIUtilities.getParentFrame(), name, modal);
072:                addDisplayComponentWithEmptyBorder(panel);
073:                addFocusListener(this );
074:                getRootPane().setGlassPane(new GlassPanePanel());
075:                setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
076:            }
077:
078:            /**
079:             * Indicates that a [long-running] process has begun or ended
080:             * as specified. This will trigger the glass pane on or off 
081:             * and set the cursor appropriately.
082:             *
083:             * @param inProcess - true | false
084:             */
085:            public void setInProcess(final boolean inProcess) {
086:                GUIUtils.invokeLater(new Runnable() {
087:                    public void run() {
088:                        if (getRootPane().getGlassPane().isVisible() == inProcess) {
089:                            return;
090:                        }
091:                        getRootPane().getGlassPane().setVisible(inProcess);
092:                    }
093:                });
094:                if (inProcess) {
095:                    GUIUtilities.showWaitCursor();
096:                } else {
097:                    GUIUtilities.showNormalCursor();
098:                }
099:            }
100:
101:            // ------------------------------------------
102:            // FocusListener implementation
103:
104:            public void focusGained(FocusEvent e) {
105:                dialogFocusChanged(true);
106:            }
107:
108:            public void focusLost(FocusEvent e) {
109:                dialogFocusChanged(false);
110:            }
111:
112:            // ------------------------------------------
113:
114:            /** 
115:             *  Removes this dialog from the application
116:             *  controller <code>GUIUtilities</code> object before
117:             *  a call to <code>super.dispose()</code>.
118:             */
119:            public void dispose() {
120:                if (contentPanel instanceof  ActiveComponent) {
121:                    ((ActiveComponent) contentPanel).cleanup();
122:                }
123:                contentPanel = null;
124:                GUIUtilities.deregisterDialog(this );
125:                GUIUtils.scheduleGC();
126:
127:                SwingUtilities.invokeLater(new Runnable() {
128:                    public void run() {
129:                        BaseDialog.this .super Dispose();
130:                    }
131:                });
132:            }
133:
134:            private void super Dispose() {
135:                super .dispose();
136:            }
137:
138:            /**
139:             * Indicates the process has completed.
140:             */
141:            public void finished() {
142:                dispose();
143:            }
144:
145:            /**
146:             * Indicates whether this is a dialog.
147:             *
148:             * @return true | false
149:             */
150:            public boolean isDialog() {
151:                return true;
152:            }
153:
154:            /** 
155:             *  Called for a change in focus as specified. This
156:             *  method will pass this object into <code>GUIUtilities</code>
157:             *  methods <code>setFocusedDialog(JDialog)</code> and
158:             *  <code>removeFocusedDialog(JDialog)</code> depending on
159:             *  the focus parameter specified.
160:             *
161:             *  @param whether this dialog has focus
162:             */
163:            private void dialogFocusChanged(boolean hasFocus) {
164:                if (hasFocus) {
165:                    GUIUtilities.setFocusedDialog(this );
166:                } else {
167:                    GUIUtilities.removeFocusedDialog(this );
168:                }
169:            }
170:
171:            /**
172:             * Adds the primary panel for display in this dialog.
173:             *
174:             * @param the main panel display
175:             */
176:            public void addDisplayComponentWithEmptyBorder(JPanel panel) {
177:                if (panel == null) {
178:                    return;
179:                }
180:                contentPanel = panel;
181:                getContentPane().setLayout(new GridBagLayout());
182:                getContentPane().add(
183:                        panel,
184:                        new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
185:                                GridBagConstraints.SOUTHEAST,
186:                                GridBagConstraints.BOTH,
187:                                new Insets(5, 5, 5, 5), 0, 0));
188:            }
189:
190:            /**
191:             * Adds the primary panel for display in this dialog.
192:             *
193:             * @param the main panel display
194:             */
195:            public void addDisplayComponent(JPanel panel) {
196:                if (panel == null) {
197:                    return;
198:                }
199:                contentPanel = panel;
200:                getContentPane().setLayout(new BorderLayout());
201:                getContentPane().add(panel, BorderLayout.CENTER);
202:            }
203:
204:            /**
205:             * Returns the content panel of this dialog.
206:             *
207:             * @return the dialog's content panel
208:             */
209:            public JPanel getConentPanel() {
210:                return contentPanel;
211:            }
212:
213:            /**
214:             * Packs, positions and displays the dialog.
215:             */
216:            public void display() {
217:                // check for multiple calls
218:                if (isVisible()) {
219:                    return;
220:                }
221:                pack();
222:                setLocation(GUIUtilities.getLocationForDialog(getSize()));
223:                GUIUtilities.registerDialog(this );
224:                setVisible(true);
225:
226:                if (contentPanel instanceof  FocusComponentPanel) {
227:                    GUIUtils
228:                            .requestFocusInWindow(((FocusComponentPanel) contentPanel)
229:                                    .getDefaultFocusComponent());
230:                }
231:
232:            }
233:
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.