13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package sun.awt.windows;
27
28 import sun.awt.*;
29 import java.awt.*;
30 import java.awt.event.InvocationEvent;
31 import java.awt.peer.ComponentPeer;
32 import java.awt.image.*;
33 import sun.awt.image.ByteInterleavedRaster;
34 import sun.security.action.GetPropertyAction;
35 import java.security.PrivilegedAction;
36 import java.security.AccessController;
37
38 @SuppressWarnings("serial") // JDK-implementation class
39 public class WEmbeddedFrame extends EmbeddedFrame {
40
41 static {
42 initIDs();
43 }
44
45 private long handle;
46
47 private int bandWidth = 0;
48 private int bandHeight = 0;
49 private int imgWid = 0;
50 private int imgHgt = 0;
51
52 private static int pScale = 0;
53 private static final int MAX_BAND_SIZE = (1024*30);
54
63 public WEmbeddedFrame() {
64 this((long)0);
65 }
66
67 /**
68 * @deprecated This constructor will be removed in 1.5
69 */
70 @Deprecated
71 public WEmbeddedFrame(int handle) {
72 this((long)handle);
73 }
74
75 public WEmbeddedFrame(long handle) {
76 this.handle = handle;
77 if (handle != 0) {
78 addNotify();
79 show();
80 }
81 }
82
83 @SuppressWarnings("deprecation")
84 public void addNotify() {
85 if (getPeer() == null) {
86 WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
87 setPeer(toolkit.createEmbeddedFrame(this));
88 }
89 super.addNotify();
90 }
91
92 /*
93 * Get the native handle
94 */
95 public long getEmbedderHandle() {
96 return handle;
97 }
98
99 /*
100 * Print the embedded frame and its children using the specified HDC.
101 */
102
103 void print(long hdc) {
104 BufferedImage bandImage = null;
105
215 int sy, int swidth, int sheight, int dx,
216 int dy, int dwidth, int dheight);
217
218 /**
219 * Initialize JNI field IDs
220 */
221 private static native void initIDs();
222
223 /**
224 * This method is called from the native code when this embedded
225 * frame should be activated. It is expected to be overridden in
226 * subclasses, for example, in plugin to activate the browser
227 * window that contains this embedded frame.
228 *
229 * NOTE: This method may be called by privileged threads.
230 * DO NOT INVOKE CLIENT CODE ON THIS THREAD!
231 */
232 public void activateEmbeddingTopLevel() {
233 }
234
235 @SuppressWarnings("deprecation")
236 public void synthesizeWindowActivation(final boolean activate) {
237 if (!activate || EventQueue.isDispatchThread()) {
238 ((WFramePeer)getPeer()).emulateActivation(activate);
239 } else {
240 // To avoid focus concurrence b/w IE and EmbeddedFrame
241 // activation is postponed by means of posting it to EDT.
242 Runnable r = new Runnable() {
243 public void run() {
244 ((WFramePeer)getPeer()).emulateActivation(true);
245 }
246 };
247 WToolkit.postEvent(WToolkit.targetToAppContext(this),
248 new InvocationEvent(this, r));
249 }
250 }
251
252 @SuppressWarnings("deprecation")
253 public boolean requestFocusToEmbedder() {
254 if (isEmbeddedInIE) {
255 return ((WEmbeddedFramePeer) getPeer()).requestFocusToEmbedder();
256 }
257 return false;
258 }
259
260 public void registerAccelerator(AWTKeyStroke stroke) {}
261 public void unregisterAccelerator(AWTKeyStroke stroke) {}
262
263 /**
264 * Should be overridden in subclasses. Call to
265 * super.notifyModalBlocked(blocker, blocked) must be present
266 * when overriding.
267 * It may occur that embedded frame is not put into its
268 * container at the moment when it is blocked, for example,
269 * when running an applet in IE. Then the call to this method
270 * should be delayed until embedded frame is reparented.
271 *
272 * NOTE: This method may be called by privileged threads.
273 * DO NOT INVOKE CLIENT CODE ON THIS THREAD!
274 */
275 public void notifyModalBlocked(Dialog blocker, boolean blocked) {
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package sun.awt.windows;
27
28 import sun.awt.*;
29 import java.awt.*;
30 import java.awt.event.InvocationEvent;
31 import java.awt.peer.ComponentPeer;
32 import java.awt.image.*;
33
34 import sun.awt.image.ByteInterleavedRaster;
35 import sun.security.action.GetPropertyAction;
36
37 import java.awt.peer.FramePeer;
38 import java.security.PrivilegedAction;
39 import java.security.AccessController;
40
41 @SuppressWarnings("serial") // JDK-implementation class
42 public class WEmbeddedFrame extends EmbeddedFrame {
43
44 static {
45 initIDs();
46 }
47
48 private long handle;
49
50 private int bandWidth = 0;
51 private int bandHeight = 0;
52 private int imgWid = 0;
53 private int imgHgt = 0;
54
55 private static int pScale = 0;
56 private static final int MAX_BAND_SIZE = (1024*30);
57
66 public WEmbeddedFrame() {
67 this((long)0);
68 }
69
70 /**
71 * @deprecated This constructor will be removed in 1.5
72 */
73 @Deprecated
74 public WEmbeddedFrame(int handle) {
75 this((long)handle);
76 }
77
78 public WEmbeddedFrame(long handle) {
79 this.handle = handle;
80 if (handle != 0) {
81 addNotify();
82 show();
83 }
84 }
85
86 public void addNotify() {
87 if (!isDisplayable()) {
88 WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
89 setPeer(toolkit.createEmbeddedFrame(this));
90 }
91 super.addNotify();
92 }
93
94 /*
95 * Get the native handle
96 */
97 public long getEmbedderHandle() {
98 return handle;
99 }
100
101 /*
102 * Print the embedded frame and its children using the specified HDC.
103 */
104
105 void print(long hdc) {
106 BufferedImage bandImage = null;
107
217 int sy, int swidth, int sheight, int dx,
218 int dy, int dwidth, int dheight);
219
220 /**
221 * Initialize JNI field IDs
222 */
223 private static native void initIDs();
224
225 /**
226 * This method is called from the native code when this embedded
227 * frame should be activated. It is expected to be overridden in
228 * subclasses, for example, in plugin to activate the browser
229 * window that contains this embedded frame.
230 *
231 * NOTE: This method may be called by privileged threads.
232 * DO NOT INVOKE CLIENT CODE ON THIS THREAD!
233 */
234 public void activateEmbeddingTopLevel() {
235 }
236
237 public void synthesizeWindowActivation(final boolean activate) {
238 final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
239 if (!activate || EventQueue.isDispatchThread()) {
240 peer.emulateActivation(activate);
241 } else {
242 // To avoid focus concurrence b/w IE and EmbeddedFrame
243 // activation is postponed by means of posting it to EDT.
244 Runnable r = new Runnable() {
245 public void run() {
246 peer.emulateActivation(true);
247 }
248 };
249 WToolkit.postEvent(WToolkit.targetToAppContext(this),
250 new InvocationEvent(this, r));
251 }
252 }
253
254 public boolean requestFocusToEmbedder() {
255 if (isEmbeddedInIE) {
256 final WEmbeddedFramePeer peer = AWTAccessor.getComponentAccessor()
257 .getPeer(this);
258 return peer.requestFocusToEmbedder();
259 }
260 return false;
261 }
262
263 public void registerAccelerator(AWTKeyStroke stroke) {}
264 public void unregisterAccelerator(AWTKeyStroke stroke) {}
265
266 /**
267 * Should be overridden in subclasses. Call to
268 * super.notifyModalBlocked(blocker, blocked) must be present
269 * when overriding.
270 * It may occur that embedded frame is not put into its
271 * container at the moment when it is blocked, for example,
272 * when running an applet in IE. Then the call to this method
273 * should be delayed until embedded frame is reparented.
274 *
275 * NOTE: This method may be called by privileged threads.
276 * DO NOT INVOKE CLIENT CODE ON THIS THREAD!
277 */
278 public void notifyModalBlocked(Dialog blocker, boolean blocked) {
|