Source Code Cross Referenced for InternalDockingUtil.java in  » Swing-Library » InfoNode-Docking-Windows » net » infonode » docking » internalutil » 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.internalutil 
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: InternalDockingUtil.java,v 1.27 2007/01/28 21:25:10 jesper Exp $
023:        package net.infonode.docking.internalutil;
024:
025:        import net.infonode.docking.DockingWindow;
026:        import net.infonode.docking.RootWindow;
027:        import net.infonode.docking.TabWindow;
028:        import net.infonode.docking.View;
029:        import net.infonode.docking.action.DockingWindowAction;
030:        import net.infonode.docking.properties.WindowTabButtonProperties;
031:        import net.infonode.docking.util.DockingUtil;
032:        import net.infonode.docking.util.ViewMap;
033:        import net.infonode.properties.propertymap.PropertyMap;
034:        import net.infonode.util.IntList;
035:        import net.infonode.util.Printer;
036:
037:        import javax.swing.*;
038:        import java.awt.*;
039:        import java.awt.event.ActionEvent;
040:        import java.awt.event.ActionListener;
041:        import java.util.ArrayList;
042:        import java.util.Map;
043:
044:        /**
045:         * @author $Author: jesper $
046:         * @version $Revision: 1.27 $
047:         */
048:        public class InternalDockingUtil {
049:            private InternalDockingUtil() {
050:            }
051:
052:            public static final int DEFAULT_BUTTON_ICON_SIZE = 10;
053:
054:            public static void getViews(DockingWindow window, ArrayList views) {
055:                if (window == null)
056:                    return;
057:                else if (window instanceof  View)
058:                    views.add(window);
059:                else {
060:                    for (int i = 0; i < window.getChildWindowCount(); i++)
061:                        getViews(window.getChildWindow(i), views);
062:                }
063:            }
064:
065:            public static IntList getWindowPath(DockingWindow window) {
066:                return getWindowPath(window, IntList.EMPTY_LIST);
067:            }
068:
069:            /**
070:             * Returns the window located at <tt>windowPath</tt>.
071:             *
072:             * @param relativeToWindow the window the path is relative to
073:             * @param windowPath       the window path
074:             * @return the window located at <tt>windowPath</tt>
075:             */
076:            public static DockingWindow getWindow(
077:                    DockingWindow relativeToWindow, IntList windowPath) {
078:                return windowPath.isEmpty() ? relativeToWindow
079:                        : windowPath.getValue() >= relativeToWindow
080:                                .getChildWindowCount() ? null : getWindow(
081:                                relativeToWindow.getChildWindow(windowPath
082:                                        .getValue()), windowPath.getNext());
083:            }
084:
085:            private static IntList getWindowPath(DockingWindow window,
086:                    IntList tail) {
087:                DockingWindow parent = window.getWindowParent();
088:                return parent == null ? tail : getWindowPath(parent,
089:                        new IntList(parent.getChildWindowIndex(window), tail));
090:            }
091:
092:            public static void addDebugMenuItems(JPopupMenu menu,
093:                    final DockingWindow window) {
094:                menu.add("Dump Tree").addActionListener(new ActionListener() {
095:                    public void actionPerformed(ActionEvent e) {
096:                        dump(window, new Printer());
097:                    }
098:                });
099:            }
100:
101:            public static void dump(DockingWindow window, Printer printer) {
102:                DockingWindow parent = window.getWindowParent();
103:
104:                String clName = window.getClass().getName();
105:
106:                printer
107:                        .println(clName.substring(clName.lastIndexOf('.') + 1)
108:                                + ", "
109:                                + System.identityHashCode(window)
110:                                + " ("
111:                                + (parent == null ? "null" : String
112:                                        .valueOf(System
113:                                                .identityHashCode(parent)))
114:                                + "), '"
115:                                + window.getTitle()
116:                                + "', "
117:                                + (window.isVisible() ? "visible"
118:                                        : "not visible")
119:                                + ", "
120:                                + (window.isMaximized() ? "maximized"
121:                                        : "not maximized") + ", "
122:                                + (window.getChildWindowCount() > 0 ? ":" : ""));
123:
124:                if (window.getChildWindowCount() > 0) {
125:                    printer.beginSection();
126:
127:                    for (int i = 0; i < window.getChildWindowCount(); i++) {
128:                        if (window.getChildWindow(i) == null)
129:                            printer.println("null");
130:                        else
131:                            dump(window.getChildWindow(i), printer);
132:                    }
133:
134:                    printer.endSection();
135:                }
136:            }
137:
138:            public static RootWindow createInnerRootWindow(View[] views) {
139:                RootWindow rootWindow = DockingUtil.createRootWindow(
140:                        new ViewMap(views), true);
141:                rootWindow.getRootWindowProperties().getWindowAreaProperties()
142:                        .setBackgroundColor(null);
143:                rootWindow.getRootWindowProperties()
144:                        .getWindowAreaShapedPanelProperties()
145:                        .setComponentPainter(null);
146:                rootWindow.getRootWindowProperties().getComponentProperties()
147:                        .setBackgroundColor(null);
148:                rootWindow.getRootWindowProperties().getComponentProperties()
149:                        .setBorder(null);
150:                //rootWindow.getRootWindowProperties().getWindowAreaProperties().setBorder(new LineBorder(Color.GRAY));
151:                return rootWindow;
152:            }
153:
154:            public static boolean updateButtons(ButtonInfo[] buttonInfos,
155:                    AbstractButton[] buttons, Container container,
156:                    DockingWindow window, PropertyMap map, Map changes) {
157:                //    DockingWindow window = w.getOptimizedWindow();
158:                boolean updateContainer = false;
159:
160:                for (int i = 0; i < buttonInfos.length; i++) {
161:                    WindowTabButtonProperties p = new WindowTabButtonProperties(
162:                            buttonInfos[i].getProperty().get(map));
163:                    DockingWindowAction action = p.getAction();
164:                    Map propertyChanges = changes == null ? null
165:                            : (Map) changes.get(p.getMap());
166:                    boolean v = p.isVisible();
167:                    boolean b = action != null && action.isPerformable(window);
168:                    boolean visible = p.isVisible() && action != null
169:                            && action.getAction(window).isEnabled();
170:
171:                    if ((buttons[i] == null || (propertyChanges != null && propertyChanges
172:                            .containsKey(WindowTabButtonProperties.FACTORY)))
173:                            && p.getFactory() != null && action != null) {
174:                        buttons[i] = p.getFactory().createButton(window);
175:                        buttons[i].setFocusable(false);
176:                        buttons[i].addActionListener(action.getAction(window)
177:                                .toSwingAction());
178:                        updateContainer = true;
179:                    }
180:
181:                    if (buttons[i] != null) {
182:                        buttons[i].setToolTipText(p.getToolTipText());
183:                        buttons[i].setIcon(p.getIcon());
184:                        buttons[i].setVisible(visible);
185:                    }
186:                }
187:
188:                if (updateContainer && container != null) {
189:                    container.removeAll();
190:
191:                    for (int j = 0; j < buttonInfos.length; j++) {
192:                        if (buttons[j] != null)
193:                            container.add(buttons[j]);
194:                    }
195:                }
196:
197:                return updateContainer;
198:            }
199:
200:            public static void addToRootWindow(DockingWindow window,
201:                    RootWindow rootWindow) {
202:                if (rootWindow == null)
203:                    return;
204:
205:                DockingWindow w = rootWindow.getWindow();
206:
207:                if (w == null)
208:                    rootWindow.setWindow(window);
209:                else if (w instanceof  TabWindow)
210:                    ((TabWindow) w).addTab(window);
211:                else
212:                    rootWindow.setWindow(new TabWindow(new DockingWindow[] { w,
213:                            window }));
214:            }
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.