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