Source Code Cross Referenced for DockingUtil.java in  » Swing-Library » InfoNode-Docking-Windows » net » infonode » docking » util » 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 » Swing Library » InfoNode Docking Windows » net.infonode.docking.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2004 NNL Technology AB
003:         * Visit www.infonode.net for information about InfoNode(R) 
004:         * products and how to contact NNL Technology AB.
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 (at your option) 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, 
019:         * MA 02111-1307, USA.
020:         */
021:
022:        // $Id: DockingUtil.java,v 1.25 2007/01/28 21:25:10 jesper Exp $
023:        package net.infonode.docking.util;
024:
025:        import net.infonode.docking.*;
026:        import net.infonode.docking.internalutil.InternalDockingUtil;
027:
028:        /**
029:         * Class that contains utility methods for docking windows.
030:         *
031:         * @author $Author: jesper $
032:         * @version $Revision: 1.25 $
033:         */
034:        public final class DockingUtil {
035:            private DockingUtil() {
036:            }
037:
038:            /**
039:             * Creates a root window with support for view serialization and popup menues.
040:             * All the views are added to a tab window which is placed in the root window.
041:             *
042:             * @param views                 the views that can be shown inside the root window
043:             * @param createWindowPopupMenu true if a standard window popup menu should be created
044:             * @return the created root window
045:             */
046:            public static RootWindow createRootWindow(AbstractViewMap views,
047:                    boolean createWindowPopupMenu) {
048:                return createRootWindow(views, views, createWindowPopupMenu);
049:            }
050:
051:            /**
052:             * <p>
053:             * Creates a root window with support for view serialization, popup menues and support for heavy
054:             * weight components inside the views.
055:             * </p>
056:             *
057:             * <p>
058:             * All the views are added to a tab window which is placed in the root window.
059:             * </p>
060:             *
061:             * @param views                 the views that can be shown inside the root window
062:             * @param createWindowPopupMenu true if a standard window popup menu should be created
063:             * @return the created root window
064:             * @since IDW 1.4.0
065:             */
066:            public static RootWindow createHeavyweightSupportedRootWindow(
067:                    AbstractViewMap views, boolean createWindowPopupMenu) {
068:                return createRootWindow(true, views, views,
069:                        createWindowPopupMenu);
070:            }
071:
072:            /**
073:             * Creates a root window with support for view serialization and popup menues.
074:             * All the views are added to a tab window which is placed in the root window.
075:             *
076:             * @param views                 contains all the static views
077:             * @param viewSerializer        the view serializer used in the created {@link RootWindow}
078:             * @param createWindowPopupMenu true if a standard window popup menu should be created
079:             * @return the created root window
080:             */
081:            public static RootWindow createRootWindow(AbstractViewMap views,
082:                    ViewSerializer viewSerializer, boolean createWindowPopupMenu) {
083:
084:                return createRootWindow(false, views, viewSerializer,
085:                        createWindowPopupMenu);
086:            }
087:
088:            /**
089:             * <p>
090:             * Creates a root window with support for view serialization, popup menues and support for
091:             * heavyweight components inside the views.
092:             * </p>
093:             *
094:             * <p>
095:             * All the views are added to a tab window which is placed in the root window.
096:             * </p>
097:             *
098:             * @param views                 contains all the static views
099:             * @param viewSerializer        the view serializer used in the created {@link RootWindow}
100:             * @param createWindowPopupMenu true if a standard window popup menu should be created
101:             * @return the created root window
102:             * @since IDW 1.4.0
103:             */
104:            public static RootWindow createHeavyweightSupportedRootWindow(
105:                    AbstractViewMap views, ViewSerializer viewSerializer,
106:                    boolean createWindowPopupMenu) {
107:
108:                return createRootWindow(true, views, viewSerializer,
109:                        createWindowPopupMenu);
110:            }
111:
112:            private static RootWindow createRootWindow(
113:                    boolean heavyweightSupport, AbstractViewMap views,
114:                    ViewSerializer viewSerializer, boolean createWindowPopupMenu) {
115:                TabWindow tabWindow = new TabWindow();
116:
117:                for (int i = 0; i < views.getViewCount(); i++)
118:                    tabWindow.addTab(views.getViewAtIndex(i));
119:                tabWindow.setSelectedTab(0);
120:                RootWindow rootWindow = new RootWindow(heavyweightSupport,
121:                        viewSerializer, tabWindow);
122:
123:                if (createWindowPopupMenu)
124:                    rootWindow.setPopupMenuFactory(WindowMenuUtil
125:                            .createWindowMenuFactory(views, true));
126:
127:                return rootWindow;
128:            }
129:
130:            /**
131:             * Returns true if <tt>ancestor</tt> is an ancestor of <tt>child</tt> or the windows are the same.
132:             *
133:             * @param ancestor the ancestor window
134:             * @param child    the child window
135:             * @return true if <tt>ancestor</tt> is an ancestor of <tt>child</tt> or the windows are the same
136:             */
137:            public static boolean isAncestor(DockingWindow ancestor,
138:                    DockingWindow child) {
139:                return child != null
140:                        && (ancestor == child || isAncestor(ancestor, child
141:                                .getWindowParent()));
142:            }
143:
144:            /**
145:             * <p>
146:             * Adds a window inside a root window. The following methods are tried in order:
147:             * </p>
148:             * <ol>
149:             * <li>If the window already is added inside the root window nothing happens.</li>
150:             * <li>The window is restored to it's last location if that location is inside the root window.</li>
151:             * <li>The window is added inside the root window.</li>
152:             * </ol>
153:             *
154:             * @param window     the window to add
155:             * @param rootWindow the root window in which to add it
156:             * @since IDW 1.1.0
157:             */
158:            public static void addWindow(DockingWindow window,
159:                    RootWindow rootWindow) {
160:                if (rootWindow == null || window.getRootWindow() == rootWindow)
161:                    return;
162:
163:                if (window.getRootWindow() == null) {
164:                    window.restore();
165:
166:                    if (window.getRootWindow() == rootWindow)
167:                        return;
168:                }
169:
170:                InternalDockingUtil.addToRootWindow(window, rootWindow);
171:            }
172:
173:            /**
174:             * Returns the {@link TabWindow} for a window. This is either the window itself or the parent window.
175:             *
176:             * @param window the window
177:             * @return the {@link TabWindow} for the window
178:             * @since IDW 1.3.0
179:             */
180:            public static TabWindow getTabWindowFor(DockingWindow window) {
181:                return window instanceof  TabWindow ? (TabWindow) window
182:                        : window.getWindowParent() != null
183:                                && window.getWindowParent() instanceof  TabWindow ? (TabWindow) window
184:                                .getWindowParent()
185:                                : null;
186:            }
187:
188:            /**
189:             * Returns the {@link FloatingWindow} for a window if the window is undocked.
190:             *
191:             * @param window the window
192:             * @return the {@link FloatingWindow} for the window or null if the window is not undocked
193:             * @since IDW 1.4.0
194:             */
195:            public static FloatingWindow getFloatingWindowFor(
196:                    DockingWindow window) {
197:                if (window == null)
198:                    return null;
199:
200:                if (!window.isUndocked())
201:                    return null;
202:
203:                while (window != null && !(window instanceof  FloatingWindow))
204:                    window = window.getWindowParent();
205:
206:                return (FloatingWindow) window;
207:            }
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.