author | pkbalakr |
Tue, 24 May 2016 14:19:53 +0530 | |
changeset 38992 | 5e8d53377c10 |
parent 32865 | f9cb6e427f9e |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23272 | 2 |
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
package sun.awt.windows; |
|
26 |
||
27 |
import java.awt.*; |
|
28 |
import java.awt.peer.*; |
|
29 |
||
30 |
import sun.awt.*; |
|
31 |
import sun.awt.im.*; |
|
32 |
||
23272 | 33 |
final class WDialogPeer extends WWindowPeer implements DialogPeer { |
2 | 34 |
// Toolkit & peer internals |
35 |
||
36 |
// Platform default background for dialogs. Gets set on target if |
|
37 |
// target has none explicitly specified. |
|
32865
f9cb6e427f9e
8136783: Run blessed-modifier-order script on java.desktop
prr
parents:
30469
diff
changeset
|
38 |
static final Color defaultBackground = SystemColor.control; |
2 | 39 |
|
40 |
WDialogPeer(Dialog target) { |
|
41 |
super(target); |
|
42 |
||
43 |
InputMethodManager imm = InputMethodManager.getInstance(); |
|
44 |
String menuString = imm.getTriggerMenuString(); |
|
45 |
if (menuString != null) |
|
46 |
{ |
|
47 |
pSetIMMOption(menuString); |
|
48 |
} |
|
49 |
} |
|
50 |
||
4366
4446f3b8a9b4
6402325: Swing toolbars vs native toolbars on Windows
anthony
parents:
2643
diff
changeset
|
51 |
native void createAwtDialog(WComponentPeer parent); |
23272 | 52 |
@Override |
4366
4446f3b8a9b4
6402325: Swing toolbars vs native toolbars on Windows
anthony
parents:
2643
diff
changeset
|
53 |
void create(WComponentPeer parent) { |
4446f3b8a9b4
6402325: Swing toolbars vs native toolbars on Windows
anthony
parents:
2643
diff
changeset
|
54 |
preCreate(parent); |
4446f3b8a9b4
6402325: Swing toolbars vs native toolbars on Windows
anthony
parents:
2643
diff
changeset
|
55 |
createAwtDialog(parent); |
4446f3b8a9b4
6402325: Swing toolbars vs native toolbars on Windows
anthony
parents:
2643
diff
changeset
|
56 |
} |
4446f3b8a9b4
6402325: Swing toolbars vs native toolbars on Windows
anthony
parents:
2643
diff
changeset
|
57 |
|
2 | 58 |
native void showModal(); |
59 |
native void endModal(); |
|
60 |
||
23272 | 61 |
@Override |
2 | 62 |
void initialize() { |
63 |
Dialog target = (Dialog)this.target; |
|
64 |
// Need to set target's background to default _before_ a call |
|
65 |
// to super.initialize. |
|
38992
5e8d53377c10
8057574: inconsistent behavior for setBackground (Windows/Linux)
pkbalakr
parents:
32865
diff
changeset
|
66 |
if (!target.isBackgroundSet()) { |
2 | 67 |
target.setBackground(defaultBackground); |
68 |
} |
|
69 |
||
70 |
super.initialize(); |
|
71 |
||
72 |
if (target.getTitle() != null) { |
|
73 |
setTitle(target.getTitle()); |
|
74 |
} |
|
75 |
setResizable(target.isResizable()); |
|
76 |
} |
|
77 |
||
23272 | 78 |
@Override |
2 | 79 |
protected void realShow() { |
80 |
Dialog dlg = (Dialog)target; |
|
81 |
if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) { |
|
82 |
showModal(); |
|
83 |
} else { |
|
84 |
super.realShow(); |
|
85 |
} |
|
86 |
} |
|
87 |
||
23272 | 88 |
@Override |
11271
f10f98b24801
7117011: Reduce number of warnings in sun/awt/windows and sun/awt/datatransfer
denis
parents:
5506
diff
changeset
|
89 |
@SuppressWarnings("deprecation") |
23272 | 90 |
void hide() { |
2 | 91 |
Dialog dlg = (Dialog)target; |
92 |
if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) { |
|
93 |
endModal(); |
|
94 |
} else { |
|
95 |
super.hide(); |
|
96 |
} |
|
97 |
} |
|
98 |
||
23272 | 99 |
@Override |
2 | 100 |
public void blockWindows(java.util.List<Window> toBlock) { |
101 |
for (Window w : toBlock) { |
|
30469 | 102 |
WWindowPeer wp = AWTAccessor.getComponentAccessor().getPeer(w); |
2 | 103 |
if (wp != null) { |
104 |
wp.setModalBlocked((Dialog)target, true); |
|
105 |
} |
|
106 |
} |
|
107 |
} |
|
108 |
||
23272 | 109 |
@Override |
2 | 110 |
public Dimension getMinimumSize() { |
111 |
if (((Dialog)target).isUndecorated()) { |
|
112 |
return super.getMinimumSize(); |
|
113 |
} else { |
|
114 |
return new Dimension(getSysMinWidth(), getSysMinHeight()); |
|
115 |
} |
|
116 |
} |
|
117 |
||
129
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
118 |
@Override |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
119 |
boolean isTargetUndecorated() { |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
120 |
return ((Dialog)target).isUndecorated(); |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
121 |
} |
f995b9c9c5fa
6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents:
2
diff
changeset
|
122 |
|
23272 | 123 |
@Override |
2 | 124 |
public void reshape(int x, int y, int width, int height) { |
125 |
if (((Dialog)target).isUndecorated()) { |
|
2643
ea218b1a2000
6821948: Consider removing the constraints for bounds of untrusted top-level windows
anthony
parents:
715
diff
changeset
|
126 |
super.reshape(x, y, width, height); |
2 | 127 |
} else { |
2643
ea218b1a2000
6821948: Consider removing the constraints for bounds of untrusted top-level windows
anthony
parents:
715
diff
changeset
|
128 |
reshapeFrame(x, y, width, height); |
2 | 129 |
} |
130 |
} |
|
131 |
||
132 |
native void pSetIMMOption(String option); |
|
133 |
void notifyIMMOptionChange(){ |
|
134 |
InputMethodManager.getInstance().notifyChangeRequest((Component)target); |
|
135 |
} |
|
136 |
} |