Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / Window.js
1 Clazz.declarePackage ("java.awt");
2 Clazz.load (["java.awt.Container", "java.util.ArrayList", "$.Vector", "java.awt.Color"], ["java.awt.Window", "$.FocusManager"], ["java.lang.IllegalArgumentException", "java.util.Arrays", "java.applet.Applet", "java.awt.AWTEventMulticaster", "$.BorderLayout", "$.ComponentOrientation", "$.Cursor", "$.GraphicsEnvironment", "$.Point", "$.Toolkit", "java.awt.event.WindowEvent", "$.WindowFocusListener", "$.WindowListener", "$.WindowStateListener", "java.util.Locale", "$.ResourceBundle", "javax.swing.JComponent", "$.RootPaneContainer", "jssun.awt.AppContext", "swingjs.JSToolkit"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.warningString = null;
5 this.icons = null;
6 this.temporaryLostComponent = null;
7 this.syncLWRequests = false;
8 this.beforeFirstShow = true;
9 this.state = 0;
10 this.alwaysOnTop = false;
11 this.ownedWindowList = null;
12 this.showWithParent = false;
13 this.modalBlocker = null;
14 this.modalExclusionType = null;
15 this.windowListener = null;
16 this.windowStateListener = null;
17 this.windowFocusListener = null;
18 this.focusableWindowState = true;
19 this.isInShow = false;
20 this.opacity = 1.0;
21 this.shape = null;
22 this.isTrayIconWindow = false;
23 this.opaque = true;
24 Clazz.instantialize (this, arguments);
25 }, java.awt, "Window", java.awt.Container);
26 Clazz.prepareFields (c$, function () {
27 this.ownedWindowList =  new java.util.Vector ();
28 });
29 Clazz.makeConstructor (c$, 
30 function (gc) {
31 Clazz.superConstructor (this, java.awt.Window, []);
32 this.init (gc);
33 }, "java.awt.GraphicsConfiguration");
34 Clazz.defineMethod (c$, "init", 
35  function (gc) {
36 this.syncLWRequests = java.awt.Window.systemSyncLWRequests;
37 this.addToWindowList ();
38 this.cursor = java.awt.Cursor.getPredefinedCursor (0);
39 this.visible = false;
40 this.setLayout ( new java.awt.BorderLayout ());
41 this.modalExclusionType = java.awt.Dialog.ModalExclusionType.NO_EXCLUDE;
42 }, "java.awt.GraphicsConfiguration");
43 Clazz.makeConstructor (c$, 
44 function () {
45 Clazz.superConstructor (this, java.awt.Window, []);
46 this.init (null);
47 });
48 Clazz.makeConstructor (c$, 
49 function (owner) {
50 Clazz.superConstructor (this, java.awt.Window, []);
51 this.init (owner == null ? null : owner.getGraphicsConfiguration ());
52 this.ownedInit (owner);
53 }, "java.awt.Frame");
54 Clazz.makeConstructor (c$, 
55 function (owner) {
56 Clazz.superConstructor (this, java.awt.Window, []);
57 this.init (owner == null ? null : owner.getGraphicsConfiguration ());
58 this.ownedInit (owner);
59 }, "java.awt.Window");
60 Clazz.makeConstructor (c$, 
61 function (owner, gc) {
62 this.construct (gc);
63 this.ownedInit (owner);
64 }, "java.awt.Window,java.awt.GraphicsConfiguration");
65 Clazz.defineMethod (c$, "ownedInit", 
66  function (owner) {
67 this.parent = owner;
68 if (owner != null) {
69 owner.addOwnedWindow (this);
70 }}, "java.awt.Window");
71 Clazz.overrideMethod (c$, "constructComponentName", 
72 function () {
73 {
74 return "win" + java.awt.Window.nameCounter++;
75 }});
76 Clazz.defineMethod (c$, "getIconImages", 
77 function () {
78 var icons = this.icons;
79 if (icons == null || icons.size () == 0) {
80 return  new java.util.ArrayList ();
81 }return  new java.util.ArrayList (icons);
82 });
83 Clazz.defineMethod (c$, "setIconImages", 
84 function (icons) {
85 this.icons = (icons == null) ?  new java.util.ArrayList () :  new java.util.ArrayList (icons);
86 this.firePropertyChangeObject ("iconImage", null, null);
87 }, "java.util.List");
88 Clazz.defineMethod (c$, "setIconImage", 
89 function (image) {
90 var imageList =  new java.util.ArrayList ();
91 if (image != null) {
92 imageList.add (image);
93 }this.setIconImages (imageList);
94 }, "java.awt.Image");
95 Clazz.defineMethod (c$, "addNotify", 
96 function () {
97 var parent = this.parent;
98 if (parent != null && parent.getPeer () == null) {
99 parent.addNotify ();
100 }if (this.peer == null) {
101 this.peer = this.getToolkit ().createWindow (this);
102 }{
103 java.awt.Window.allWindows.add (this);
104 }Clazz.superCall (this, java.awt.Window, "addNotify", []);
105 });
106 Clazz.defineMethod (c$, "removeNotify", 
107 function () {
108 {
109 java.awt.Window.allWindows.remove (this);
110 }Clazz.superCall (this, java.awt.Window, "removeNotify", []);
111 });
112 Clazz.defineMethod (c$, "pack", 
113 function () {
114 var parent = this.parent;
115 if (parent != null && parent.getPeer () == null) {
116 parent.addNotify ();
117 }if (this.peer == null) {
118 this.addNotify ();
119 }var newSize = this.getPreferredSize ();
120 if (this.peer != null) {
121 this.setClientSize (newSize.width, newSize.height);
122 }if (this.beforeFirstShow) {
123 this.isPacked = true;
124 }this.validate ();
125 });
126 Clazz.defineMethod (c$, "setMinimumSize", 
127 function (minimumSize) {
128 {
129 Clazz.superCall (this, java.awt.Window, "setMinimumSize", [minimumSize]);
130 var size = this.getSize ();
131 if (this.isMinimumSizeSet ()) {
132 if (size.width < minimumSize.width || size.height < minimumSize.height) {
133 var nw = Math.max (this.width, minimumSize.width);
134 var nh = Math.max (this.height, minimumSize.height);
135 this.setSize (nw, nh);
136 }}}}, "java.awt.Dimension");
137 Clazz.defineMethod (c$, "reshape", 
138 function (x, y, width, height) {
139 if (this.isMinimumSizeSet ()) {
140 var minSize = this.getMinimumSize ();
141 if (width < minSize.width) {
142 width = minSize.width;
143 }if (height < minSize.height) {
144 height = minSize.height;
145 }}Clazz.superCall (this, java.awt.Window, "reshape", [x, y, width, height]);
146 }, "~N,~N,~N,~N");
147 Clazz.defineMethod (c$, "setClientSize", 
148 function (w, h) {
149 {
150 this.setBounds (this.x, this.y, w, h);
151 }}, "~N,~N");
152 c$.closeSplashScreen = Clazz.defineMethod (c$, "closeSplashScreen", 
153 function () {
154 });
155 Clazz.defineMethod (c$, "show", 
156 function () {
157 this.validate ();
158 this.isInShow = true;
159 if (this.visible) {
160 this.toFront ();
161 } else {
162 this.beforeFirstShow = false;
163 java.awt.Window.closeSplashScreen ();
164 Clazz.superCall (this, java.awt.Window, "show", []);
165 for (var i = 0; i < this.ownedWindowList.size (); i++) {
166 var child = this.ownedWindowList.elementAt (i);
167 if ((child != null) && child.showWithParent) {
168 child.show ();
169 child.showWithParent = false;
170 }}
171 if (!this.isModalBlocked ()) {
172 this.updateChildrenBlocking ();
173 } else {
174 this.modalBlocker.toFront_NoClientCode ();
175 }if (Clazz.instanceOf (this, java.awt.Frame) || Clazz.instanceOf (this, java.awt.Dialog)) {
176 java.awt.Window.updateChildFocusableWindowState (this);
177 }}this.isInShow = false;
178 if ((this.state & 1) == 0) {
179 this.postWindowEvent (200);
180 this.state |= 1;
181 }});
182 c$.updateChildFocusableWindowState = Clazz.defineMethod (c$, "updateChildFocusableWindowState", 
183 function (w) {
184 for (var i = 0; i < w.ownedWindowList.size (); i++) {
185 var child = w.ownedWindowList.elementAt (i);
186 if (child != null) {
187 java.awt.Window.updateChildFocusableWindowState (child);
188 }}
189 }, "java.awt.Window");
190 Clazz.defineMethod (c$, "postWindowEvent", 
191 function (id) {
192 if (this.windowListener != null || (this.eventMask & 64) != 0 || java.awt.Toolkit.enabledOnToolkit (64)) {
193 var e =  new java.awt.event.WindowEvent (this, id);
194 java.awt.Toolkit.getEventQueue ().postEvent (e);
195 }}, "~N");
196 Clazz.defineMethod (c$, "hide", 
197 function () {
198 {
199 for (var i = 0; i < this.ownedWindowList.size (); i++) {
200 var child = this.ownedWindowList.elementAt (i);
201 if ((child != null) && child.visible) {
202 child.hide ();
203 child.showWithParent = true;
204 }}
205 }Clazz.superCall (this, java.awt.Window, "hide", []);
206 });
207 Clazz.overrideMethod (c$, "clearMostRecentFocusOwnerOnHide", 
208 function () {
209 });
210 Clazz.defineMethod (c$, "dispose", 
211 function () {
212 this.doDispose ();
213 });
214 Clazz.defineMethod (c$, "disposeImpl", 
215 function () {
216 this.dispose ();
217 });
218 Clazz.defineMethod (c$, "doDispose", 
219 function () {
220 if (!Clazz.isClassDefined ("java.awt.Window$1DisposeAction")) {
221 java.awt.Window.$Window$1DisposeAction$ ();
222 }
223 var action = Clazz.innerTypeInstance (java.awt.Window$1DisposeAction, this, null);
224 action.run ();
225 this.postWindowEvent (202);
226 });
227 Clazz.overrideMethod (c$, "adjustListeningChildrenOnParent", 
228 function (mask, num) {
229 }, "~N,~N");
230 Clazz.overrideMethod (c$, "adjustDecendantsOnParent", 
231 function (num) {
232 }, "~N");
233 Clazz.defineMethod (c$, "toFront", 
234 function () {
235 this.toFront_NoClientCode ();
236 });
237 Clazz.defineMethod (c$, "toFront_NoClientCode", 
238 function () {
239 if (this.visible) {
240 }});
241 Clazz.defineMethod (c$, "toBack", 
242 function () {
243 this.toBack_NoClientCode ();
244 });
245 Clazz.defineMethod (c$, "toBack_NoClientCode", 
246 function () {
247 if (this.isAlwaysOnTop ()) {
248 try {
249 this.setAlwaysOnTop (false);
250 } catch (e) {
251 if (Clazz.exceptionOf (e, SecurityException)) {
252 } else {
253 throw e;
254 }
255 }
256 }if (this.visible) {
257 }});
258 Clazz.overrideMethod (c$, "getToolkit", 
259 function () {
260 return java.awt.Toolkit.getDefaultToolkit ();
261 });
262 Clazz.defineMethod (c$, "getWarningString", 
263 function () {
264 return this.warningString;
265 });
266 Clazz.overrideMethod (c$, "getLocale", 
267 function () {
268 if (this.locale == null) {
269 return java.util.Locale.getDefault ();
270 }return this.locale;
271 });
272 Clazz.defineMethod (c$, "setCursor", 
273 function (cursor) {
274 if (cursor == null) {
275 cursor = java.awt.Cursor.getPredefinedCursor (0);
276 }Clazz.superCall (this, java.awt.Window, "setCursor", [cursor]);
277 }, "java.awt.Cursor");
278 Clazz.defineMethod (c$, "getOwner", 
279 function () {
280 return this.getOwner_NoClientCode ();
281 });
282 Clazz.defineMethod (c$, "getOwner_NoClientCode", 
283 function () {
284 return this.parent;
285 });
286 Clazz.defineMethod (c$, "getOwnedWindows", 
287 function () {
288 return this.getOwnedWindows_NoClientCode ();
289 });
290 Clazz.defineMethod (c$, "getOwnedWindows_NoClientCode", 
291 function () {
292 var realCopy;
293 {
294 var fullSize = this.ownedWindowList.size ();
295 var realSize = 0;
296 var fullCopy =  new Array (fullSize);
297 for (var i = 0; i < fullSize; i++) {
298 fullCopy[realSize] = this.ownedWindowList.elementAt (i);
299 if (fullCopy[realSize] != null) {
300 realSize++;
301 }}
302 if (fullSize != realSize) {
303 realCopy = java.util.Arrays.copyOf (fullCopy, realSize);
304 } else {
305 realCopy = fullCopy;
306 }}return realCopy;
307 });
308 Clazz.defineMethod (c$, "isModalBlocked", 
309 function () {
310 return this.modalBlocker != null;
311 });
312 Clazz.defineMethod (c$, "setModalBlocked", 
313 function (blocker, blocked, peerCall) {
314 }, "java.awt.Dialog,~B,~B");
315 Clazz.defineMethod (c$, "getModalBlocker", 
316 function () {
317 return this.modalBlocker;
318 });
319 c$.getAllWindows = Clazz.defineMethod (c$, "getAllWindows", 
320 function () {
321 {
322 var v =  new java.util.ArrayList ();
323 v.addAll (java.awt.Window.allWindows);
324 return v;
325 }});
326 c$.getAllUnblockedWindows = Clazz.defineMethod (c$, "getAllUnblockedWindows", 
327 function () {
328 {
329 var unblocked =  new java.util.ArrayList ();
330 for (var i = 0; i < java.awt.Window.allWindows.size (); i++) {
331 var w = java.awt.Window.allWindows.get (i);
332 if (!w.isModalBlocked ()) {
333 unblocked.add (w);
334 }}
335 return unblocked;
336 }});
337 c$.getWindows = Clazz.defineMethod (c$, "getWindows", 
338  function (appContext) {
339 {
340 var realCopy;
341 var windowList = appContext.get (java.awt.Window);
342 if (windowList != null) {
343 var fullSize = windowList.size ();
344 var realSize = 0;
345 var fullCopy =  new Array (fullSize);
346 for (var i = 0; i < fullSize; i++) {
347 var w = windowList.get (i);
348 if (w != null) {
349 fullCopy[realSize++] = w;
350 }}
351 if (fullSize != realSize) {
352 realCopy = java.util.Arrays.copyOf (fullCopy, realSize);
353 } else {
354 realCopy = fullCopy;
355 }} else {
356 realCopy =  new Array (0);
357 }return realCopy;
358 }}, "jssun.awt.AppContext");
359 c$.getWindows = Clazz.defineMethod (c$, "getWindows", 
360 function () {
361 return java.awt.Window.getWindows (jssun.awt.AppContext.getAppContext ());
362 });
363 c$.getOwnerlessWindows = Clazz.defineMethod (c$, "getOwnerlessWindows", 
364 function () {
365 var allWindows = java.awt.Window.getWindows ();
366 var ownerlessCount = 0;
367 for (var w, $w = 0, $$w = allWindows; $w < $$w.length && ((w = $$w[$w]) || true); $w++) {
368 if (w.getOwner () == null) {
369 ownerlessCount++;
370 }}
371 var ownerless =  new Array (ownerlessCount);
372 var c = 0;
373 for (var w, $w = 0, $$w = allWindows; $w < $$w.length && ((w = $$w[$w]) || true); $w++) {
374 if (w.getOwner () == null) {
375 ownerless[c++] = w;
376 }}
377 return ownerless;
378 });
379 Clazz.defineMethod (c$, "getDocumentRoot", 
380 function () {
381 {
382 var w = this;
383 while (w.getOwner () != null) {
384 w = w.getOwner ();
385 }
386 return w;
387 }});
388 Clazz.defineMethod (c$, "setModalExclusionType", 
389 function (exclusionType) {
390 if (exclusionType == null) {
391 exclusionType = java.awt.Dialog.ModalExclusionType.NO_EXCLUDE;
392 }if (!java.awt.Toolkit.getDefaultToolkit ().isModalExclusionTypeSupported (exclusionType)) {
393 exclusionType = java.awt.Dialog.ModalExclusionType.NO_EXCLUDE;
394 }if (this.modalExclusionType === exclusionType) {
395 return;
396 }this.modalExclusionType = exclusionType;
397 }, "java.awt.Dialog.ModalExclusionType");
398 Clazz.defineMethod (c$, "getModalExclusionType", 
399 function () {
400 return this.modalExclusionType;
401 });
402 Clazz.defineMethod (c$, "isModalExcluded", 
403 function (exclusionType) {
404 if ((this.modalExclusionType != null) && this.modalExclusionType.compareTo (exclusionType) >= 0) {
405 return true;
406 }var owner = this.getOwner_NoClientCode ();
407 return (owner != null) && owner.isModalExcluded (exclusionType);
408 }, "java.awt.Dialog.ModalExclusionType");
409 Clazz.defineMethod (c$, "updateChildrenBlocking", 
410 function () {
411 });
412 Clazz.defineMethod (c$, "addWindowListener", 
413 function (l) {
414 if (l == null) {
415 return;
416 }this.newEventsOnly = true;
417 this.windowListener = java.awt.AWTEventMulticaster.add (this.windowListener, l);
418 }, "java.awt.event.WindowListener");
419 Clazz.defineMethod (c$, "addWindowStateListener", 
420 function (l) {
421 if (l == null) {
422 return;
423 }this.windowStateListener = java.awt.AWTEventMulticaster.add (this.windowStateListener, l);
424 this.newEventsOnly = true;
425 }, "java.awt.event.WindowStateListener");
426 Clazz.defineMethod (c$, "addWindowFocusListener", 
427 function (l) {
428 if (l == null) {
429 return;
430 }this.windowFocusListener = java.awt.AWTEventMulticaster.add (this.windowFocusListener, l);
431 this.newEventsOnly = true;
432 }, "java.awt.event.WindowFocusListener");
433 Clazz.defineMethod (c$, "removeWindowListener", 
434 function (l) {
435 if (l == null) {
436 return;
437 }this.windowListener = java.awt.AWTEventMulticaster.remove (this.windowListener, l);
438 }, "java.awt.event.WindowListener");
439 Clazz.defineMethod (c$, "removeWindowStateListener", 
440 function (l) {
441 if (l == null) {
442 return;
443 }this.windowStateListener = java.awt.AWTEventMulticaster.remove (this.windowStateListener, l);
444 }, "java.awt.event.WindowStateListener");
445 Clazz.defineMethod (c$, "removeWindowFocusListener", 
446 function (l) {
447 if (l == null) {
448 return;
449 }this.windowFocusListener = java.awt.AWTEventMulticaster.remove (this.windowFocusListener, l);
450 }, "java.awt.event.WindowFocusListener");
451 Clazz.defineMethod (c$, "getWindowListeners", 
452 function () {
453 return (this.getListeners (java.awt.event.WindowListener));
454 });
455 Clazz.defineMethod (c$, "getWindowFocusListeners", 
456 function () {
457 return (this.getListeners (java.awt.event.WindowFocusListener));
458 });
459 Clazz.defineMethod (c$, "getWindowStateListeners", 
460 function () {
461 return (this.getListeners (java.awt.event.WindowStateListener));
462 });
463 Clazz.defineMethod (c$, "getListeners", 
464 function (listenerType) {
465 var l = null;
466 if (listenerType === java.awt.event.WindowFocusListener) {
467 l = this.windowFocusListener;
468 } else if (listenerType === java.awt.event.WindowStateListener) {
469 l = this.windowStateListener;
470 } else if (listenerType === java.awt.event.WindowListener) {
471 l = this.windowListener;
472 } else {
473 return Clazz.superCall (this, java.awt.Window, "getListeners", [listenerType]);
474 }return java.awt.AWTEventMulticaster.getListeners (l, listenerType);
475 }, "Class");
476 Clazz.defineMethod (c$, "eventEnabled", 
477 function (e) {
478 switch (e.id) {
479 case 200:
480 case 201:
481 case 202:
482 case 203:
483 case 204:
484 case 205:
485 case 206:
486 if ((this.eventMask & 64) != 0 || this.windowListener != null) {
487 return true;
488 }return false;
489 case 207:
490 case 208:
491 if ((this.eventMask & 524288) != 0 || this.windowFocusListener != null) {
492 return true;
493 }return false;
494 case 209:
495 if ((this.eventMask & 262144) != 0 || this.windowStateListener != null) {
496 return true;
497 }return false;
498 default:
499 break;
500 }
501 return Clazz.superCall (this, java.awt.Window, "eventEnabled", [e]);
502 }, "java.awt.AWTEvent");
503 Clazz.overrideMethod (c$, "processEvent", 
504 function (e) {
505 if (Clazz.instanceOf (e, java.awt.event.WindowEvent)) {
506 switch (e.getID ()) {
507 case 200:
508 case 201:
509 case 202:
510 case 203:
511 case 204:
512 case 205:
513 case 206:
514 this.processWindowEvent (e);
515 break;
516 case 207:
517 case 208:
518 this.processWindowFocusEvent (e);
519 break;
520 case 209:
521 this.processWindowStateEvent (e);
522 default:
523 break;
524 }
525 return;
526 }this.processEventCont (e);
527 }, "java.awt.AWTEvent");
528 Clazz.defineMethod (c$, "processWindowEvent", 
529 function (e) {
530 var listener = this.windowListener;
531 if (listener != null) {
532 switch (e.getID ()) {
533 case 200:
534 listener.windowOpened (e);
535 break;
536 case 201:
537 listener.windowClosing (e);
538 break;
539 case 202:
540 listener.windowClosed (e);
541 break;
542 case 203:
543 listener.windowIconified (e);
544 break;
545 case 204:
546 listener.windowDeiconified (e);
547 break;
548 case 205:
549 listener.windowActivated (e);
550 break;
551 case 206:
552 listener.windowDeactivated (e);
553 break;
554 default:
555 break;
556 }
557 }}, "java.awt.event.WindowEvent");
558 Clazz.defineMethod (c$, "processWindowFocusEvent", 
559 function (e) {
560 var listener = this.windowFocusListener;
561 if (listener != null) {
562 switch (e.getID ()) {
563 case 207:
564 listener.windowGainedFocus (e);
565 break;
566 case 208:
567 listener.windowLostFocus (e);
568 break;
569 default:
570 break;
571 }
572 }}, "java.awt.event.WindowEvent");
573 Clazz.defineMethod (c$, "processWindowStateEvent", 
574 function (e) {
575 var listener = this.windowStateListener;
576 if (listener != null) {
577 switch (e.getID ()) {
578 case 209:
579 listener.windowStateChanged (e);
580 break;
581 default:
582 break;
583 }
584 }}, "java.awt.event.WindowEvent");
585 Clazz.overrideMethod (c$, "preProcessKeyEvent", 
586 function (e) {
587 }, "java.awt.event.KeyEvent");
588 Clazz.overrideMethod (c$, "postProcessKeyEvent", 
589 function (e) {
590 }, "java.awt.event.KeyEvent");
591 Clazz.defineMethod (c$, "setAlwaysOnTop", 
592 function (alwaysOnTop) {
593 var oldAlwaysOnTop;
594 {
595 oldAlwaysOnTop = this.alwaysOnTop;
596 this.alwaysOnTop = alwaysOnTop;
597 }if (oldAlwaysOnTop != alwaysOnTop) {
598 if (this.isAlwaysOnTopSupported ()) {
599 }this.firePropertyChangeBool ("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop);
600 }}, "~B");
601 Clazz.defineMethod (c$, "isAlwaysOnTopSupported", 
602 function () {
603 return java.awt.Toolkit.getDefaultToolkit ().isAlwaysOnTopSupported ();
604 });
605 Clazz.defineMethod (c$, "isAlwaysOnTop", 
606 function () {
607 return this.alwaysOnTop;
608 });
609 Clazz.defineMethod (c$, "isActive", 
610 function () {
611 return false;
612 });
613 Clazz.defineMethod (c$, "isFocused", 
614 function () {
615 return swingjs.JSToolkit.isFocused (this);
616 });
617 Clazz.overrideMethod (c$, "getFocusTraversalKeys", 
618 function (id) {
619 return null;
620 }, "~N");
621 Clazz.defineMethod (c$, "setFocusCycleRoot", 
622 function (focusCycleRoot) {
623 }, "~B");
624 Clazz.defineMethod (c$, "isFocusCycleRoot", 
625 function () {
626 return true;
627 });
628 Clazz.overrideMethod (c$, "getFocusCycleRootAncestor", 
629 function () {
630 return null;
631 });
632 Clazz.defineMethod (c$, "isFocusableWindow", 
633 function () {
634 if (!this.getFocusableWindowState ()) {
635 return false;
636 }if (Clazz.instanceOf (this, java.awt.Frame) || Clazz.instanceOf (this, java.awt.Dialog)) {
637 return true;
638 }for (var owner = this.getOwner (); owner != null; owner = owner.getOwner ()) {
639 if (Clazz.instanceOf (owner, java.awt.Frame) || Clazz.instanceOf (owner, java.awt.Dialog)) {
640 return owner.isShowing ();
641 }}
642 return false;
643 });
644 Clazz.defineMethod (c$, "getFocusableWindowState", 
645 function () {
646 return this.focusableWindowState;
647 });
648 Clazz.defineMethod (c$, "setFocusableWindowState", 
649 function (focusableWindowState) {
650 var oldFocusableWindowState;
651 {
652 oldFocusableWindowState = this.focusableWindowState;
653 this.focusableWindowState = focusableWindowState;
654 }this.firePropertyChangeBool ("focusableWindowState", oldFocusableWindowState, focusableWindowState);
655 if (oldFocusableWindowState && !focusableWindowState && this.isFocused ()) {
656 for (var owner = this.getOwner (); owner != null; owner = owner.getOwner ()) {
657 }
658 }}, "~B");
659 Clazz.defineMethod (c$, "dispatchEventImpl", 
660 function (e) {
661 if (e.getID () == 101) {
662 this.invalidate ();
663 this.validate ();
664 }Clazz.superCall (this, java.awt.Window, "dispatchEventImpl", [e]);
665 }, "java.awt.AWTEvent");
666 Clazz.overrideMethod (c$, "postEvent", 
667 function (e) {
668 if (this.handleEvent (e)) {
669 e.consume ();
670 return true;
671 }return false;
672 }, "java.awt.Event");
673 Clazz.defineMethod (c$, "isShowing", 
674 function () {
675 return this.visible;
676 });
677 Clazz.defineMethod (c$, "applyResourceBundle", 
678 function (rb) {
679 this.applyComponentOrientation (java.awt.ComponentOrientation.getOrientation (rb));
680 }, "java.util.ResourceBundle");
681 Clazz.defineMethod (c$, "applyResourceBundle", 
682 function (rbName) {
683 this.applyResourceBundle (java.util.ResourceBundle.getBundle (rbName));
684 }, "~S");
685 Clazz.defineMethod (c$, "addOwnedWindow", 
686 function (weakWindow) {
687 if (weakWindow != null) {
688 {
689 if (!this.ownedWindowList.contains (weakWindow)) {
690 this.ownedWindowList.addElement (weakWindow);
691 }}}}, "java.awt.Window");
692 Clazz.defineMethod (c$, "removeOwnedWindow", 
693 function (weakWindow) {
694 if (weakWindow != null) {
695 this.ownedWindowList.removeElement (weakWindow);
696 }}, "java.awt.Window");
697 Clazz.defineMethod (c$, "connectOwnedWindow", 
698 function (child) {
699 child.parent = this;
700 this.addOwnedWindow (child);
701 }, "java.awt.Window");
702 Clazz.defineMethod (c$, "addToWindowList", 
703  function () {
704 var windowList = this.appContext.get (java.awt.Window);
705 if (windowList == null) {
706 windowList =  new java.util.Vector ();
707 this.appContext.put (java.awt.Window, windowList);
708 }windowList.add (this);
709 });
710 c$.removeFromWindowList = Clazz.defineMethod (c$, "removeFromWindowList", 
711  function (context, w) {
712 {
713 var windowList = context.get (java.awt.Window);
714 if (windowList != null) {
715 windowList.remove (w);
716 }}}, "jssun.awt.AppContext,java.awt.Window");
717 Clazz.defineMethod (c$, "getGraphicsConfiguration", 
718 function () {
719 if (this.graphicsConfig == null) this.graphicsConfig = swingjs.JSToolkit.getGraphicsConfiguration ();
720 return this.graphicsConfig;
721 });
722 Clazz.overrideMethod (c$, "resetGC", 
723 function () {
724 });
725 Clazz.defineMethod (c$, "setLocationRelativeTo", 
726 function (c) {
727 var root = null;
728 if (c != null) {
729 if (Clazz.instanceOf (c, java.awt.Window) || Clazz.instanceOf (c, java.applet.Applet)) {
730 root = c;
731 } else {
732 var parent;
733 for (parent = c.getParent (); parent != null; parent = parent.getParent ()) {
734 if (Clazz.instanceOf (parent, java.awt.Window) || Clazz.instanceOf (parent, java.applet.Applet)) {
735 root = parent;
736 break;
737 }}
738 }}if ((c != null && !c.isShowing ()) || root == null || !root.isShowing ()) {
739 var paneSize = this.getSize ();
740 var centerPoint = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment ().getCenterPoint ();
741 this.setLocation (centerPoint.x - Clazz.doubleToInt (paneSize.width / 2), centerPoint.y - Clazz.doubleToInt (paneSize.height / 2));
742 } else {
743 var invokerSize = c.getSize ();
744 var invokerScreenLocation = c.getLocationOnScreen ();
745 var windowBounds = this.getBounds ();
746 var dx = invokerScreenLocation.x + ((invokerSize.width - windowBounds.width) >> 1);
747 var dy = invokerScreenLocation.y + ((invokerSize.height - windowBounds.height) >> 1);
748 var ss = root.getGraphicsConfiguration ().getBounds ();
749 if (dy + windowBounds.height > ss.y + ss.height) {
750 dy = ss.y + ss.height - windowBounds.height;
751 if (invokerScreenLocation.x - ss.x + Clazz.doubleToInt (invokerSize.width / 2) < Clazz.doubleToInt (ss.width / 2)) {
752 dx = invokerScreenLocation.x + invokerSize.width;
753 } else {
754 dx = invokerScreenLocation.x - windowBounds.width;
755 }}if (dx + windowBounds.width > ss.x + ss.width) {
756 dx = ss.x + ss.width - windowBounds.width;
757 }if (dx < ss.x) dx = ss.x;
758 if (dy < ss.y) dy = ss.y;
759 this.setLocation (dx, dy);
760 }}, "java.awt.Component");
761 Clazz.defineMethod (c$, "deliverMouseWheelToAncestor", 
762 function (e) {
763 }, "java.awt.event.MouseWheelEvent");
764 Clazz.overrideMethod (c$, "dispatchMouseWheelToAncestor", 
765 function (e) {
766 return false;
767 }, "java.awt.event.MouseWheelEvent");
768 Clazz.defineMethod (c$, "getTemporaryLostComponent", 
769 function () {
770 return this.temporaryLostComponent;
771 });
772 Clazz.defineMethod (c$, "setTemporaryLostComponent", 
773 function (component) {
774 var previousComp = this.temporaryLostComponent;
775 if (component == null || component.canBeFocusOwner ()) {
776 this.temporaryLostComponent = component;
777 } else {
778 this.temporaryLostComponent = null;
779 }return previousComp;
780 }, "java.awt.Component");
781 Clazz.defineMethod (c$, "canContainFocusOwner", 
782 function (focusOwnerCandidate) {
783 return Clazz.superCall (this, java.awt.Window, "canContainFocusOwner", [focusOwnerCandidate]) && this.isFocusableWindow ();
784 }, "java.awt.Component");
785 Clazz.defineMethod (c$, "setBounds", 
786 function (r) {
787 this.setBounds (r.x, r.y, r.width, r.height);
788 }, "java.awt.Rectangle");
789 Clazz.overrideMethod (c$, "isRecursivelyVisible", 
790 function () {
791 return this.visible;
792 });
793 Clazz.defineMethod (c$, "getOpacity", 
794 function () {
795 {
796 return this.opacity;
797 }});
798 Clazz.defineMethod (c$, "setOpacity", 
799 function (opacity) {
800 {
801 if (opacity < 0.0 || opacity > 1.0) {
802 throw  new IllegalArgumentException ("The value of opacity should be in the range [0.0f .. 1.0f].");
803 }this.opacity = opacity;
804 }}, "~N");
805 Clazz.defineMethod (c$, "getShape", 
806 function () {
807 {
808 return this.shape;
809 }});
810 Clazz.defineMethod (c$, "setShape", 
811 function (shape) {
812 {
813 this.shape = shape;
814 }}, "java.awt.Shape");
815 Clazz.defineMethod (c$, "setOpaque", 
816 function (opaque) {
817 {
818 java.awt.Window.setLayersOpaque (this, opaque);
819 this.opaque = opaque;
820 var peer = this.getPeer ();
821 if (peer != null) {
822 peer.setOpaque (opaque);
823 }}}, "~B");
824 c$.setLayersOpaque = Clazz.defineMethod (c$, "setLayersOpaque", 
825  function (component, isOpaque) {
826 if (Clazz.instanceOf (component, javax.swing.RootPaneContainer)) {
827 var rpc = component;
828 var root = rpc.getRootPane ();
829 var lp = root.getLayeredPane ();
830 var c = root.getContentPane ();
831 var content = (Clazz.instanceOf (c, javax.swing.JComponent)) ? c : null;
832 lp.setOpaque (isOpaque);
833 root.setOpaque (isOpaque);
834 root.setDoubleBuffered (isOpaque);
835 if (content != null) {
836 content.setOpaque (isOpaque);
837 content.setDoubleBuffered (isOpaque);
838 var numChildren = content.getComponentCount ();
839 if (numChildren > 0) {
840 var child = content.getComponent (0);
841 if (Clazz.instanceOf (child, javax.swing.RootPaneContainer)) {
842 java.awt.Window.setLayersOpaque (child, isOpaque);
843 }}}}var bg = component.getBackground ();
844 var hasTransparentBg = java.awt.Window.TRANSPARENT_BACKGROUND_COLOR.equals (bg);
845 var container = null;
846 if (Clazz.instanceOf (component, java.awt.Container)) {
847 container = component;
848 }if (isOpaque) {
849 if (hasTransparentBg) {
850 var newColor = null;
851 if (container != null && container.preserveBackgroundColor != null) {
852 newColor = container.preserveBackgroundColor;
853 } else {
854 newColor =  new java.awt.Color (255, 255, 255);
855 }component.setBackground (newColor);
856 }} else {
857 if (!hasTransparentBg && container != null) {
858 container.preserveBackgroundColor = bg;
859 }component.setBackground (java.awt.Window.TRANSPARENT_BACKGROUND_COLOR);
860 }}, "java.awt.Component,~B");
861 Clazz.overrideMethod (c$, "getContainer", 
862 function () {
863 return null;
864 });
865 Clazz.overrideMethod (c$, "mixOnReshaping", 
866 function () {
867 });
868 Clazz.overrideMethod (c$, "getLocationOnWindow", 
869 function () {
870 return  new java.awt.Point (0, 0);
871 });
872 c$.$Window$1DisposeAction$ = function () {
873 Clazz.pu$h(self.c$);
874 c$ = Clazz.decorateAsClass (function () {
875 Clazz.prepareCallback (this, arguments);
876 Clazz.instantialize (this, arguments);
877 }, java.awt, "Window$1DisposeAction", null, Runnable);
878 Clazz.overrideMethod (c$, "run", 
879 function () {
880 var a;
881 {
882 a =  new Array (this.b$["java.awt.Window"].ownedWindowList.size ());
883 this.b$["java.awt.Window"].ownedWindowList.copyInto (a);
884 }for (var b = 0; b < a.length; b++) {
885 var c = (((a[b])));
886 if (c != null) {
887 c.disposeImpl ();
888 }}
889 this.b$["java.awt.Window"].hide ();
890 this.b$["java.awt.Window"].beforeFirstShow = true;
891 this.b$["java.awt.Window"].removeNotify ();
892 this.b$["java.awt.Window"].clearCurrentFocusCycleRootOnHide ();
893 });
894 c$ = Clazz.p0p ();
895 };
896 Clazz.defineStatics (c$,
897 "systemSyncLWRequests", false,
898 "OPENED", 0x01,
899 "base", "win",
900 "nameCounter", 0);
901 c$.allWindows = c$.prototype.allWindows =  new java.util.ArrayList ();
902 c$.TRANSPARENT_BACKGROUND_COLOR = c$.prototype.TRANSPARENT_BACKGROUND_COLOR =  new java.awt.Color (0, 0, 0, 0);
903 c$ = Clazz.decorateAsClass (function () {
904 this.focusRoot = null;
905 this.focusOwner = null;
906 Clazz.instantialize (this, arguments);
907 }, java.awt, "FocusManager");
908 });