Source Code Cross Referenced for XPanelPeer.java in  » 6.0-JDK-Platform » solaris » sun » awt » X11 » 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 » 6.0 JDK Platform » solaris » sun.awt.X11 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:        package sun.awt.X11;
026:
027:        import java.awt.*;
028:        import java.awt.peer.*;
029:
030:        import sun.awt.SunGraphicsCallback;
031:
032:        public class XPanelPeer extends XCanvasPeer implements  PanelPeer {
033:
034:            XEmbeddingContainer embedder = null; //new XEmbeddingContainer();
035:
036:            /**
037:             * Embeds the given window into container using XEmbed protocol
038:             */
039:            public void xembed(long window) {
040:                if (embedder != null) {
041:                    embedder.add(window);
042:                }
043:            }
044:
045:            XPanelPeer() {
046:            }
047:
048:            XPanelPeer(XCreateWindowParams params) {
049:                super (params);
050:            }
051:
052:            XPanelPeer(Component target) {
053:                super (target);
054:            }
055:
056:            void postInit(XCreateWindowParams params) {
057:                super .postInit(params);
058:                if (embedder != null) {
059:                    embedder.install(this );
060:                }
061:            }
062:
063:            public Insets getInsets() {
064:                return new Insets(0, 0, 0, 0);
065:            }
066:
067:            public void paint(Graphics g) {
068:                super .paint(g);
069:                /*      SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
070:                        runComponents(((Container)target).getComponents(), g,
071:                        SunGraphicsCallback.LIGHTWEIGHTS |
072:                        SunGraphicsCallback.HEAVYWEIGHTS);
073:                 */}
074:
075:            public void print(Graphics g) {
076:                super .print(g);
077:                SunGraphicsCallback.PrintHeavyweightComponentsCallback
078:                        .getInstance().runComponents(
079:                                ((Container) target).getComponents(),
080:                                g,
081:                                SunGraphicsCallback.LIGHTWEIGHTS
082:                                        | SunGraphicsCallback.HEAVYWEIGHTS);
083:
084:            }
085:
086:            public void setBackground(Color c) {
087:                Component comp;
088:                int i;
089:
090:                Container cont = (Container) target;
091:                synchronized (target.getTreeLock()) {
092:                    int n = cont.getComponentCount();
093:                    for (i = 0; i < n; i++) {
094:                        comp = cont.getComponent(i);
095:                        ComponentPeer peer = comp.getPeer();
096:                        if (peer != null) {
097:                            Color color = comp.getBackground();
098:                            if (color == null || color.equals(c)) {
099:                                peer.setBackground(c);
100:                            }
101:                        }
102:                    }
103:                }
104:                super .setBackground(c);
105:            }
106:
107:            public void setForeground(Color c) {
108:                setForegroundForHierarchy((Container) target, c);
109:            }
110:
111:            private void setForegroundForHierarchy(Container cont, Color c) {
112:                synchronized (target.getTreeLock()) {
113:                    int n = cont.getComponentCount();
114:                    for (int i = 0; i < n; i++) {
115:                        Component comp = cont.getComponent(i);
116:                        Color color = comp.getForeground();
117:                        if (color == null || color.equals(c)) {
118:                            ComponentPeer cpeer = comp.getPeer();
119:                            if (cpeer != null) {
120:                                cpeer.setForeground(c);
121:                            }
122:                            if (cpeer instanceof  LightweightPeer
123:                                    && comp instanceof  Container) {
124:                                setForegroundForHierarchy((Container) comp, c);
125:                            }
126:                        }
127:                    }
128:                }
129:            }
130:
131:            /**
132:             * DEPRECATED:  Replaced by getInsets().
133:             */
134:            public Insets insets() {
135:                return getInsets();
136:            }
137:
138:            /*
139:             * This method is called from XWindowPeer.displayChanged, when
140:             * the window this Panel is on is moved to the new screen, or
141:             * display mode is changed.
142:             *
143:             * The notification is propagated to the child Canvas components.
144:             * Top-level windows and other Panels are notified too as their
145:             * peers are subclasses of XCanvasPeer. 
146:             */
147:            public void displayChanged(int screenNum) {
148:                super .displayChanged(screenNum);
149:                displayChanged((Container) target, screenNum);
150:            }
151:
152:            /*
153:             * Recursively iterates through all the HW and LW children
154:             * of the container and calls displayChanged() for HW peers.
155:             * Iteration through children peers only is not enough as the
156:             * displayChanged notification may not be propagated to HW
157:             * components inside LW containers, see 4452373 for details.
158:             */
159:            private static void displayChanged(Container target, int screenNum) {
160:                Component children[] = ((Container) target).getComponents();
161:                for (Component child : children) {
162:                    ComponentPeer cpeer = child.getPeer();
163:                    if (cpeer instanceof  XCanvasPeer) {
164:                        ((XCanvasPeer) cpeer).displayChanged(screenNum);
165:                    } else if (child instanceof  Container) {
166:                        displayChanged((Container) child, screenNum);
167:                    }
168:                }
169:            }
170:
171:            public void dispose() {
172:                if (embedder != null) {
173:                    embedder.deinstall();
174:                }
175:                super .dispose();
176:            }
177:
178:            protected boolean shouldFocusOnClick() {
179:                // Return false if this container has children so in that case it won't
180:                // be focused. Return true otherwise.
181:                return ((Container) target).getComponentCount() == 0;
182:            }
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.