Source Code Cross Referenced for WingRootPane.java in  » Web-Framework » wingS » com » javujavu » javux » wings » 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 » Web Framework » wingS » com.javujavu.javux.wings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *	Javu WingS - Lightweight Java Component Set
003:         *	Copyright (c) 2005-2007 Krzysztof A. Sadlocha
004:         *	e-mail: ksadlocha@programics.com
005:         *
006:         *	This library is free software; you can redistribute it and/or
007:         *	modify it under the terms of the GNU Lesser General Public
008:         *	License as published by the Free Software Foundation; either
009:         *	version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *	This library 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 GNU
014:         *	Lesser General Public License for more details.
015:         *
016:         *	You should have received a copy of the GNU Lesser General Public
017:         *	License along with this library; if not, write to the Free Software
018:         *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.javujavu.javux.wings;
022:
023:        import java.awt.Container;
024:        import java.awt.Dimension;
025:        import java.awt.Rectangle;
026:
027:        /**
028:         * A container derived form <code>WingComponent</code> used by
029:         * <code>WingFrame</code>, <code>WingDialog</code>, <code>WingWindow</code>,
030:         * <code>WingApplet</code>.
031:         * This class provide:
032:         * <ul>
033:         * <li>Highly customizable look of top level containers based on hierarchical skin style sheets.
034:         * <li>Interactive keyboard shortcut handling.
035:         * <li>An infrastructure for painting with double buffering
036:         * <li>Layout for content pane and menu
037:         * <li>Layout for lightweight popups
038:         * </ul>
039:         * <br>WingS components can work without the root pane but is recommended
040:         * to use top level containers containing it.<br>
041:         *
042:         * <br>
043:         * <b>This is one of the core WingS classes required by all the components</b><br>
044:         * <br>
045:         * <b>This class is thread safe.</b>
046:         **/
047:        public class WingRootPane extends WingComponent {
048:            private WingComponent content;
049:            private WingComponent menu;
050:
051:            /**
052:             * Loads skin resources.<br>
053:             * <pre>
054:             * styles:
055:             * [optional styleID.]window.normal
056:             * </pre>
057:             * @see Style
058:             * @see WingSkin
059:             */
060:            public void loadSkin() {
061:                stNormal = WingSkin.getStyle(styleId, "window", NORMAL, null);
062:                Container p = getParent();
063:                if (p != null)
064:                    p.setBackground(stNormal.background);
065:            }
066:
067:            public Style getStyle() {
068:                return stNormal;
069:            }
070:
071:            /**
072:             * Sets the content pane - the one and only one container
073:             * that holds the components.
074:             * <br><br><strong>This method acquire TreeLock</strong>
075:             * @param c the <code>WingComponent</code> used as the content pane
076:             */
077:            public void setContentPane(WingComponent c) {
078:                synchronized (getTreeLock()) {
079:                    if (content != null)
080:                        removeShortcuts(content);
081:                    this .removeAll();
082:                    if (c != null) {
083:                        this .add(c);
084:                        addShortcuts(c);
085:                    }
086:                    this .content = c;
087:
088:                    setMenuBar(menu);
089:                    revalidateAndRepaint();
090:                }
091:            }
092:
093:            /**
094:             * Adds a lightweight popup component
095:             * <br><br><strong>This method acquire TreeLock</strong>
096:             * @param c a popup component
097:             */
098:            public void addPopup(WingComponent c) {
099:                this .add(c, 0);
100:            }
101:
102:            /**
103:             * Removes a lightweight popup component
104:             * <br><br><strong>This method acquire TreeLock</strong>
105:             * @param c a popup component
106:             */
107:            public void removePopup(WingComponent c) {
108:                Rectangle bounds = c.getBounds();
109:                this .remove(c);
110:                repaint(bounds.x, bounds.y, bounds.width, bounds.height);
111:            }
112:
113:            /**
114:             * Adds, removes or changes the <code>WingComponent</code>
115:             * used as a menu bar.
116:             * <br><br><strong>This method acquire TreeLock</strong>
117:             * @param menu the <code>WingComponent</code> to add;
118:             * use <code>null</code> to remove menu bar
119:             */
120:            public void setMenuBar(WingComponent menu) {
121:                synchronized (getTreeLock()) {
122:                    if (this .menu != null) {
123:                        removeShortcuts(this .menu);
124:                        remove(this .menu);
125:                    }
126:                    this .menu = menu;
127:                    if (menu != null) {
128:                        addShortcuts(menu);
129:                        add(menu);
130:                    }
131:                    revalidateAndRepaint();
132:                }
133:            }
134:
135:            /**
136:             * <br><br><strong>This method acquire TreeLock</strong>
137:             */
138:            public void doLayout() {
139:                WingComponent c = content, m = menu;
140:                int menuHeight = 0;
141:                Dimension size = getSize();
142:                if (m != null) {
143:                    Dimension ms = m.getPreferredSize();
144:                    for (int f = 0; f < 2; f++) {
145:                        m.setBounds(0, 0, size.width, ms.height);
146:                        m.validate();
147:                        Dimension ms2 = m.getPreferredSize();
148:                        if (ms2.equals(ms))
149:                            break;
150:                        ms = ms2;
151:                    }
152:                    menuHeight = ms.height;
153:                }
154:                if (c != null) {
155:                    c.setBounds(0, menuHeight, size.width, size.height
156:                            - menuHeight);
157:                }
158:            }
159:
160:            /**
161:             * <br><br><strong>This method acquire TreeLock</strong>
162:             */
163:            public Dimension getPreferredSize() {
164:                WingComponent c = content, m = menu;
165:                Dimension dc = null, dm = null;
166:                if (c != null)
167:                    dc = c.getPreferredSize();
168:                if (m != null)
169:                    dm = m.getPreferredSize();
170:                if (dc == null && dm == null)
171:                    return new Dimension();
172:                if (dc == null)
173:                    return dm;
174:                if (dm == null)
175:                    return dc;
176:                return new Dimension((dc.width > dm.width) ? dc.width
177:                        : dm.width, dm.height + dc.height);
178:            }
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.