Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / Dialog.js
1 Clazz.declarePackage ("java.awt");
2 Clazz.load (["java.lang.Enum", "java.awt.Window"], "java.awt.Dialog", ["java.lang.IllegalArgumentException", "java.awt.Frame", "$.IllegalComponentStateException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.resizable = true;
5 this.undecorated = false;
6 this.modal = false;
7 this.modalityType = null;
8 this.title = null;
9 this.isInHide = false;
10 this.isInDispose = false;
11 Clazz.instantialize (this, arguments);
12 }, java.awt, "Dialog", java.awt.Window);
13 Clazz.makeConstructor (c$, 
14 function (owner) {
15 this.construct (owner, "", false);
16 }, "java.awt.Frame");
17 Clazz.makeConstructor (c$, 
18 function (owner, modal) {
19 this.construct (owner, "", modal);
20 }, "java.awt.Frame,~B");
21 Clazz.makeConstructor (c$, 
22 function (owner, title) {
23 this.construct (owner, title, false);
24 }, "java.awt.Frame,~S");
25 Clazz.makeConstructor (c$, 
26 function (owner, title, modal) {
27 this.construct (owner, title, modal ? java.awt.Dialog.DEFAULT_MODALITY_TYPE : java.awt.Dialog.ModalityType.MODELESS);
28 }, "java.awt.Frame,~S,~B");
29 Clazz.makeConstructor (c$, 
30 function (owner, title, modal, gc) {
31 this.construct (owner, title, modal ? java.awt.Dialog.DEFAULT_MODALITY_TYPE : java.awt.Dialog.ModalityType.MODELESS, gc);
32 }, "java.awt.Frame,~S,~B,java.awt.GraphicsConfiguration");
33 Clazz.makeConstructor (c$, 
34 function (owner) {
35 this.construct (owner, "", false);
36 }, "java.awt.Dialog");
37 Clazz.makeConstructor (c$, 
38 function (owner, title) {
39 this.construct (owner, title, false);
40 }, "java.awt.Dialog,~S");
41 Clazz.makeConstructor (c$, 
42 function (owner, title, modal) {
43 this.construct (owner, title, modal ? java.awt.Dialog.DEFAULT_MODALITY_TYPE : java.awt.Dialog.ModalityType.MODELESS);
44 }, "java.awt.Dialog,~S,~B");
45 Clazz.makeConstructor (c$, 
46 function (owner, title, modal, gc) {
47 this.construct (owner, title, modal ? java.awt.Dialog.DEFAULT_MODALITY_TYPE : java.awt.Dialog.ModalityType.MODELESS, gc);
48 }, "java.awt.Dialog,~S,~B,java.awt.GraphicsConfiguration");
49 Clazz.makeConstructor (c$, 
50 function (owner) {
51 this.construct (owner, null, java.awt.Dialog.ModalityType.MODELESS);
52 }, "java.awt.Window");
53 Clazz.makeConstructor (c$, 
54 function (owner, title) {
55 this.construct (owner, title, java.awt.Dialog.ModalityType.MODELESS);
56 }, "java.awt.Window,~S");
57 Clazz.makeConstructor (c$, 
58 function (owner, modalityType) {
59 this.construct (owner, null, modalityType);
60 }, "java.awt.Window,java.awt.Dialog.ModalityType");
61 Clazz.makeConstructor (c$, 
62 function (owner, title, modalityType) {
63 Clazz.superConstructor (this, java.awt.Dialog, [owner]);
64 if ((owner != null) && !(Clazz.instanceOf (owner, java.awt.Frame)) && !(Clazz.instanceOf (owner, java.awt.Dialog))) {
65 throw  new IllegalArgumentException ("Wrong parent window");
66 }this.title = title;
67 this.setModalityType (modalityType);
68 }, "java.awt.Window,~S,java.awt.Dialog.ModalityType");
69 Clazz.makeConstructor (c$, 
70 function (owner, title, modalityType, gc) {
71 Clazz.superConstructor (this, java.awt.Dialog, [owner, gc]);
72 if ((owner != null) && !(Clazz.instanceOf (owner, java.awt.Frame)) && !(Clazz.instanceOf (owner, java.awt.Dialog))) {
73 throw  new IllegalArgumentException ("wrong owner window");
74 }this.title = title;
75 this.setModalityType (modalityType);
76 }, "java.awt.Window,~S,java.awt.Dialog.ModalityType,java.awt.GraphicsConfiguration");
77 Clazz.overrideMethod (c$, "constructComponentName", 
78 function () {
79 {
80 return "dialog" + java.awt.Dialog.$nameCounter++;
81 }});
82 Clazz.defineMethod (c$, "addNotify", 
83 function () {
84 {
85 if (this.parent != null) {
86 this.parent.addNotify ();
87 }Clazz.superCall (this, java.awt.Dialog, "addNotify", []);
88 }});
89 Clazz.defineMethod (c$, "isModal", 
90 function () {
91 return this.isModal_NoClientCode ();
92 });
93 Clazz.defineMethod (c$, "isModal_NoClientCode", 
94 function () {
95 return this.modalityType !== java.awt.Dialog.ModalityType.MODELESS;
96 });
97 Clazz.defineMethod (c$, "setModal", 
98 function (modal) {
99 this.modal = modal;
100 this.setModalityType (modal ? java.awt.Dialog.DEFAULT_MODALITY_TYPE : java.awt.Dialog.ModalityType.MODELESS);
101 }, "~B");
102 Clazz.defineMethod (c$, "getModalityType", 
103 function () {
104 return this.modalityType;
105 });
106 Clazz.defineMethod (c$, "setModalityType", 
107 function (type) {
108 if (type == null) {
109 type = java.awt.Dialog.ModalityType.MODELESS;
110 }if (this.modalityType === type) {
111 return;
112 }this.checkModalityPermission (type);
113 this.modalityType = type;
114 this.modal = (this.modalityType !== java.awt.Dialog.ModalityType.MODELESS);
115 }, "java.awt.Dialog.ModalityType");
116 Clazz.defineMethod (c$, "getTitle", 
117 function () {
118 return this.title;
119 });
120 Clazz.defineMethod (c$, "setTitle", 
121 function (title) {
122 var oldTitle = this.title;
123 {
124 this.title = title;
125 }this.firePropertyChangeObject ("title", oldTitle, title);
126 }, "~S");
127 Clazz.defineMethod (c$, "show", 
128 function () {
129 });
130 Clazz.defineMethod (c$, "modalityPushed", 
131 function () {
132 });
133 Clazz.defineMethod (c$, "modalityPopped", 
134 function () {
135 });
136 Clazz.defineMethod (c$, "interruptBlocking", 
137 function () {
138 if (this.isModal ()) {
139 this.disposeImpl ();
140 } else if (this.windowClosingException != null) {
141 this.windowClosingException.fillInStackTrace ();
142 this.windowClosingException.printStackTrace ();
143 this.windowClosingException = null;
144 }});
145 Clazz.defineMethod (c$, "hideAndDisposePreHandler", 
146  function () {
147 this.isInHide = true;
148 });
149 Clazz.defineMethod (c$, "hideAndDisposeHandler", 
150  function () {
151 this.isInHide = false;
152 });
153 Clazz.defineMethod (c$, "hide", 
154 function () {
155 this.hideAndDisposePreHandler ();
156 Clazz.superCall (this, java.awt.Dialog, "hide", []);
157 if (!this.isInDispose) {
158 this.hideAndDisposeHandler ();
159 }});
160 Clazz.defineMethod (c$, "doDispose", 
161 function () {
162 this.isInDispose = true;
163 Clazz.superCall (this, java.awt.Dialog, "doDispose", []);
164 this.hideAndDisposeHandler ();
165 this.isInDispose = false;
166 });
167 Clazz.defineMethod (c$, "isResizable", 
168 function () {
169 return this.resizable;
170 });
171 Clazz.defineMethod (c$, "setResizable", 
172 function (resizable) {
173 var testvalid = false;
174 {
175 this.resizable = resizable;
176 }if (testvalid) {
177 this.invalidateIfValid ();
178 }}, "~B");
179 Clazz.defineMethod (c$, "setUndecorated", 
180 function (undecorated) {
181 {
182 if (this.isDisplayable ()) {
183 throw  new java.awt.IllegalComponentStateException ("The dialog is displayable.");
184 }this.undecorated = undecorated;
185 }}, "~B");
186 Clazz.defineMethod (c$, "isUndecorated", 
187 function () {
188 return this.undecorated;
189 });
190 Clazz.defineMethod (c$, "paramString", 
191 function () {
192 var str = Clazz.superCall (this, java.awt.Dialog, "paramString", []) + "," + this.modalityType;
193 if (this.title != null) {
194 str += ",title=" + this.title;
195 }return str;
196 });
197 Clazz.defineMethod (c$, "modalShow", 
198 function () {
199 });
200 Clazz.defineMethod (c$, "modalHide", 
201 function () {
202 });
203 Clazz.defineMethod (c$, "shouldBlock", 
204 function (w) {
205 if (!this.isVisible_NoClientCode () || (!w.isVisible_NoClientCode () && !w.isInShow) || this.isInHide || (w === this) || !this.isModal_NoClientCode ()) {
206 return false;
207 }if ((Clazz.instanceOf (w, java.awt.Dialog)) && (w).isInHide) {
208 return false;
209 }var blockerToCheck = this;
210 while (blockerToCheck != null) {
211 var c = w;
212 while ((c != null) && (c !== blockerToCheck)) {
213 c = c.getParent_NoClientCode ();
214 }
215 if (c === blockerToCheck) {
216 return false;
217 }blockerToCheck = blockerToCheck.getModalBlocker ();
218 }
219 switch (this.modalityType) {
220 case java.awt.Dialog.ModalityType.MODELESS:
221 return false;
222 case java.awt.Dialog.ModalityType.DOCUMENT_MODAL:
223 if (w.isModalExcluded (java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE)) {
224 var c = this;
225 while ((c != null) && (c !== w)) {
226 c = c.getParent_NoClientCode ();
227 }
228 return c === w;
229 } else {
230 return this.getDocumentRoot () === w.getDocumentRoot ();
231 }case java.awt.Dialog.ModalityType.APPLICATION_MODAL:
232 return !w.isModalExcluded (java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE) && (this.appContext === w.appContext);
233 case java.awt.Dialog.ModalityType.TOOLKIT_MODAL:
234 return !w.isModalExcluded (java.awt.Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
235 }
236 return false;
237 }, "java.awt.Window");
238 Clazz.defineMethod (c$, "checkModalityPermission", 
239  function (mt) {
240 }, "java.awt.Dialog.ModalityType");
241 Clazz.pu$h(self.c$);
242 c$ = Clazz.declareType (java.awt.Dialog, "ModalityType", Enum);
243 Clazz.defineEnumConstant (c$, "MODELESS", 0, []);
244 Clazz.defineEnumConstant (c$, "DOCUMENT_MODAL", 1, []);
245 Clazz.defineEnumConstant (c$, "APPLICATION_MODAL", 2, []);
246 Clazz.defineEnumConstant (c$, "TOOLKIT_MODAL", 3, []);
247 c$ = Clazz.p0p ();
248 Clazz.pu$h(self.c$);
249 c$ = Clazz.declareType (java.awt.Dialog, "ModalExclusionType", Enum);
250 Clazz.defineEnumConstant (c$, "NO_EXCLUDE", 0, []);
251 Clazz.defineEnumConstant (c$, "APPLICATION_EXCLUDE", 1, []);
252 Clazz.defineEnumConstant (c$, "TOOLKIT_EXCLUDE", 2, []);
253 c$ = Clazz.p0p ();
254 c$.DEFAULT_MODALITY_TYPE = c$.prototype.DEFAULT_MODALITY_TYPE = java.awt.Dialog.ModalityType.APPLICATION_MODAL;
255 Clazz.defineStatics (c$,
256 "$base", "dialog",
257 "$nameCounter", 0);
258 });