author | avstepan |
Tue, 18 Nov 2014 16:32:04 +0400 | |
changeset 28067 | 447be91cbc44 |
permissions | -rw-r--r-- |
28067
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
1 |
/* |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
2 |
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
4 |
* |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
8 |
* |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
13 |
* accompanied this code). |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
14 |
* |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
18 |
* |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
21 |
* questions. |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
22 |
*/ |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
23 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
24 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
25 |
import java.awt.*; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
26 |
import java.awt.event.ActionEvent; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
27 |
import java.awt.event.ActionListener; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
28 |
import java.awt.print.*; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
29 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
30 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
31 |
public class Test { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
32 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
33 |
class CustomFrame extends Frame { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
34 |
public CustomFrame() { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
35 |
super(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
36 |
setTitle("Frame"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
37 |
setSize(150, 100); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
38 |
Button dummy = new Button("Dummy"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
39 |
add(dummy); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
40 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
41 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
42 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
43 |
class CustomWindow extends Window { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
44 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
45 |
private void GUI() { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
46 |
setSize(150, 100); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
47 |
Button dummy = new Button("Dummy"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
48 |
add(dummy); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
49 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
50 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
51 |
public CustomWindow(Dialog d) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
52 |
super(d); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
53 |
GUI(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
54 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
55 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
56 |
public CustomWindow(Frame f) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
57 |
super(f); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
58 |
GUI(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
59 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
60 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
61 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
62 |
private class CustomDialog extends Dialog implements ActionListener { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
63 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
64 |
private Button open, close; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
65 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
66 |
private void GUI() { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
67 |
setTitle("Dialog"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
68 |
setSize(150, 100); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
69 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
70 |
Panel p = new Panel(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
71 |
p.setLayout(new GridLayout(1, 2)); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
72 |
open = new Button("Open"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
73 |
open.addActionListener(this); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
74 |
p.add(open); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
75 |
close = new Button("Finish"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
76 |
close.addActionListener(this); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
77 |
p.add(close); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
78 |
add(p); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
79 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
80 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
81 |
public CustomDialog(Dialog d) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
82 |
super(d); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
83 |
GUI(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
84 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
85 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
86 |
public CustomDialog(Frame f) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
87 |
super(f); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
88 |
GUI(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
89 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
90 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
91 |
@Override |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
92 |
public void actionPerformed(ActionEvent e) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
93 |
if (open.equals(e.getSource())) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
94 |
if (isPrintDialog) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
95 |
PrinterJob.getPrinterJob().printDialog(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
96 |
} else { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
97 |
PrinterJob.getPrinterJob().pageDialog(new PageFormat()); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
98 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
99 |
} else if (close.equals(e.getSource())) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
100 |
if (parentDialog != null) { parentDialog.dispose(); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
101 |
if ( parentFrame != null) { parentFrame.dispose(); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
102 |
if (parent != null) { parent.dispose(); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
103 |
if (dialog != null) { dialog.dispose(); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
104 |
if ( frame != null) { frame.dispose(); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
105 |
if (window != null) { window.dispose(); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
106 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
107 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
108 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
109 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
110 |
class ParentDialog extends Dialog { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
111 |
public ParentDialog() { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
112 |
super((Frame) null); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
113 |
setTitle("Dialog"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
114 |
setSize(150, 100); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
115 |
Button dummy = new Button("Dummy"); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
116 |
add(dummy); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
117 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
118 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
119 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
120 |
private CustomFrame frame; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
121 |
private CustomWindow window; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
122 |
private CustomDialog dialog; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
123 |
private ParentDialog parent; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
124 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
125 |
private boolean isPrintDialog; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
126 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
127 |
private final Dialog.ModalityType modalityType; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
128 |
private final boolean setModal; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
129 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
130 |
public enum DialogParent |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
131 |
{NULL_FRAME, HIDDEN_FRAME, NULL_DIALOG, HIDDEN_DIALOG, FRAME, DIALOG}; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
132 |
private final DialogParent dialogParent; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
133 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
134 |
private Dialog parentDialog; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
135 |
private Frame parentFrame; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
136 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
137 |
public Test(boolean isPrintDlg, |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
138 |
Dialog.ModalityType type, |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
139 |
DialogParent p){ |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
140 |
isPrintDialog = isPrintDlg; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
141 |
modalityType = type; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
142 |
setModal = false; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
143 |
dialogParent = p; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
144 |
EventQueue.invokeLater( this::createGUI ); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
145 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
146 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
147 |
public Test(boolean isPrintDlg, |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
148 |
boolean modal, |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
149 |
DialogParent p) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
150 |
isPrintDialog = isPrintDlg; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
151 |
modalityType = null; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
152 |
setModal = modal; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
153 |
dialogParent = p; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
154 |
EventQueue.invokeLater( this::createGUI ); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
155 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
156 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
157 |
private void createGUI() { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
158 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
159 |
Window p; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
160 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
161 |
if (dialogParent == DialogParent.DIALOG) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
162 |
parent = new ParentDialog(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
163 |
window = new CustomWindow(parent); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
164 |
p = parent; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
165 |
} else { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
166 |
frame = new CustomFrame(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
167 |
window = new CustomWindow(frame); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
168 |
p = frame; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
169 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
170 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
171 |
int x = 50, y = 50; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
172 |
p.setLocation(x, y); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
173 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
174 |
y += (50 + p.getHeight()); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
175 |
window.setLocation(x, y); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
176 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
177 |
switch (dialogParent) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
178 |
case NULL_DIALOG: |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
179 |
dialog = new CustomDialog((Dialog) null); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
180 |
break; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
181 |
case NULL_FRAME: |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
182 |
dialog = new CustomDialog((Frame) null); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
183 |
break; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
184 |
case HIDDEN_DIALOG: |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
185 |
parentDialog = new Dialog((Frame) null); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
186 |
dialog = new CustomDialog(parentDialog); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
187 |
break; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
188 |
case HIDDEN_FRAME: |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
189 |
parentFrame = new Frame(); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
190 |
dialog = new CustomDialog(parentFrame); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
191 |
break; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
192 |
case DIALOG: |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
193 |
dialog = new CustomDialog(parent); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
194 |
case FRAME: |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
195 |
dialog = new CustomDialog(frame); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
196 |
break; |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
197 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
198 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
199 |
y += (50 + dialog.getHeight()); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
200 |
dialog.setLocation(x, y); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
201 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
202 |
if (modalityType == null) { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
203 |
dialog.setModal(setModal); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
204 |
} else { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
205 |
dialog.setModalityType(modalityType); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
206 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
207 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
208 |
|
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
209 |
public void start() { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
210 |
EventQueue.invokeLater(() -> { |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
211 |
if (parent != null) { parent.setVisible(true); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
212 |
else if (frame != null) { frame.setVisible(true); } |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
213 |
}); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
214 |
EventQueue.invokeLater(() -> { window.setVisible(true); }); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
215 |
EventQueue.invokeLater(() -> { dialog.setVisible(true); }); |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
216 |
} |
447be91cbc44
8055836: move awt tests from AWT_Modality to OpenJDK repository - part 9
avstepan
parents:
diff
changeset
|
217 |
} |