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


001:        /*
002:         * Copyright 1996-2005 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:
026:        package sun.awt.motif;
027:
028:        import sun.awt.EmbeddedFrame;
029:        import java.util.logging.*;
030:        import java.awt.Component;
031:        import java.awt.Point;
032:        import java.awt.Rectangle;
033:        import java.awt.Window;
034:        import java.awt.AWTKeyStroke;
035:        import java.awt.Component;
036:        import java.awt.Container;
037:        import sun.awt.SunToolkit;
038:        import java.util.LinkedList;
039:        import java.util.Iterator;
040:
041:        import sun.java2d.SurfaceData;
042:
043:        public class MEmbeddedFramePeer extends MFramePeer {
044:            private static final Logger xembedLog = Logger
045:                    .getLogger("sun.awt.motif.xembed.MEmbeddedFramePeer");
046:
047:            //     A detail code is required for XEMBED_FOCUS_IN. The following values are valid:    
048:            /* Details for  XEMBED_FOCUS_IN: */
049:            final static int XEMBED_FOCUS_CURRENT = 0;
050:            final static int XEMBED_FOCUS_FIRST = 1;
051:            final static int XEMBED_FOCUS_LAST = 2;
052:
053:            LinkedList<AWTKeyStroke> strokes = new LinkedList<AWTKeyStroke>();
054:
055:            public MEmbeddedFramePeer(EmbeddedFrame target) {
056:                super (target);
057:                xembedLog
058:                        .fine("Creating XEmbed-enabled motif embedded frame, frame supports XEmbed:"
059:                                + supportsXEmbed());
060:            }
061:
062:            void create(MComponentPeer parent) {
063:                NEFcreate(parent, ((MEmbeddedFrame) target).handle);
064:            }
065:
066:            native void NEFcreate(MComponentPeer parent, long handle);
067:
068:            native void pShowImpl();
069:
070:            void pShow() {
071:                pShowImpl();
072:            }
073:
074:            boolean supportsXEmbed() {
075:                EmbeddedFrame frame = (EmbeddedFrame) target;
076:                if (frame != null) {
077:                    return frame.supportsXEmbed();
078:                } else {
079:                    return false;
080:                }
081:            }
082:
083:            public void setVisible(boolean vis) {
084:                super .setVisible(vis);
085:                xembedLog.fine("Peer made visible");
086:                if (vis && !supportsXEmbed()) {
087:                    xembedLog.fine("Synthesizing FocusIn");
088:                    // Fix for 4878303 - generate WINDOW_GAINED_FOCUS and update if we were focused 
089:                    // since noone will do it for us(WM does it for regular top-levels)
090:                    synthesizeFocusInOut(true);
091:                }
092:            }
093:
094:            public native void synthesizeFocusInOut(boolean b);
095:
096:            native boolean isXEmbedActive();
097:
098:            native boolean isXEmbedApplicationActive();
099:
100:            native void requestXEmbedFocus();
101:
102:            public boolean requestWindowFocus() {
103:                xembedLog.fine("In requestWindowFocus");
104:                // Should check for active state of host application
105:                if (isXEmbedActive()) {
106:                    if (isXEmbedApplicationActive()) {
107:                        xembedLog.fine("Requesting focus from embedding host");
108:                        requestXEmbedFocus();
109:                        return true;
110:                    } else {
111:                        xembedLog.fine("Host application is not active");
112:                        return false;
113:                    }
114:                } else {
115:                    xembedLog.fine("Requesting focus from X");
116:                    return super .requestWindowFocus();
117:                }
118:            }
119:
120:            void registerAccelerator(AWTKeyStroke stroke) {
121:                //         if (stroke == null) return;
122:                //         strokes.add(stroke);
123:                //         if (isXEmbedActive()) {
124:                //             nativeRegisterAccelerator(stroke, strokes.size()-1);
125:                //         }
126:            }
127:
128:            void unregisterAccelerator(AWTKeyStroke stroke) {
129:                //         if (stroke == null) return;
130:                //         if (isXEmbedActive()) {
131:                //             int index = strokes.indexOf(stroke);
132:                //             nativeUnregisterAccelerator(index);
133:                //         }
134:            }
135:
136:            void notifyStarted() {
137:                // Register accelerators
138:                //         int i = 0;
139:                //         Iterator<AWTKeyStroke> iter = strokes.iterator();
140:                //         while (iter.hasNext()) {
141:                //             nativeRegisterAccelerator(iter.next(), i++);
142:                //         }
143:
144:                updateDropTarget();
145:            }
146:
147:            native void traverseOut(boolean direction);
148:
149:            void handleFocusIn(int detail) {
150:                xembedLog.log(Level.FINE, "handleFocusIn {0}",
151:                        new Object[] { Integer.valueOf(detail) });
152:                switch (detail) {
153:                case XEMBED_FOCUS_CURRENT:
154:                    // Do nothing - just restore to the current value
155:                    break;
156:                case XEMBED_FOCUS_FIRST:
157:                    SunToolkit.executeOnEventHandlerThread(target,
158:                            new Runnable() {
159:                                public void run() {
160:                                    Component comp = ((Container) target)
161:                                            .getFocusTraversalPolicy()
162:                                            .getFirstComponent(
163:                                                    (Container) target);
164:                                    if (comp != null) {
165:                                        comp.requestFocusInWindow();
166:                                    }
167:                                }
168:                            });
169:                    break;
170:                case XEMBED_FOCUS_LAST:
171:                    SunToolkit.executeOnEventHandlerThread(target,
172:                            new Runnable() {
173:                                public void run() {
174:                                    Component comp = ((Container) target)
175:                                            .getFocusTraversalPolicy()
176:                                            .getLastComponent(
177:                                                    (Container) target);
178:                                    if (comp != null) {
179:                                        comp.requestFocusInWindow();
180:                                    }
181:                                }
182:                            });
183:                    break;
184:                }
185:            }
186:
187:            public void handleWindowFocusIn() {
188:                super .handleWindowFocusIn();
189:                xembedLog.fine("windowFocusIn");
190:            }
191:
192:            public void handleWindowFocusOut(Window oppositeWindow) {
193:                super .handleWindowFocusOut(oppositeWindow);
194:                xembedLog.fine("windowFocusOut, opposite is null?:"
195:                        + (oppositeWindow == null));
196:            }
197:
198:            native void pReshapePrivate(int x, int y, int w, int h);
199:
200:            public void setBoundsPrivate(int x, int y, int width, int height) {
201:                if (disposed) {
202:                    return;
203:                }
204:
205:                // Should set paintPending before reshape to prevent
206:                // thread race between PaintEvent and setBounds
207:                // This part of the 4267393 fix proved to be unstable under solaris,
208:                // dissabled due to regressions 4418155, 4486762, 4490079
209:                paintPending = false; //checkNativePaintOnSetBounds(width, height);
210:
211:                pReshapePrivate(x, y, width, height);
212:
213:                if ((width != oldWidth) || (height != oldHeight)) {
214:                    SurfaceData oldData = surfaceData;
215:                    if (oldData != null) {
216:                        surfaceData = graphicsConfig.createSurfaceData(this );
217:                        oldData.invalidate();
218:                    }
219:                    oldWidth = width;
220:                    oldHeight = height;
221:                }
222:                validateSurface(width, height);
223:                serialNum++;
224:            }
225:
226:            public native Rectangle getBoundsPrivate();
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.