Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / Container.js
1 Clazz.declarePackage ("java.awt");
2 Clazz.load (["java.awt.Component", "java.awt.event.AWTEventListener"], ["java.awt.LightweightDispatcher", "$.Container"], ["java.lang.ArrayIndexOutOfBoundsException", "$.IllegalArgumentException", "$.IllegalStateException", "java.util.ArrayList", "java.awt.AWTEventMulticaster", "$.Dimension", "$.GraphicsCallback", "$.Insets", "$.LayoutManager2", "$.Toolkit", "java.awt.event.ContainerEvent", "$.ContainerListener", "$.MouseEvent", "$.MouseWheelEvent", "java.awt.peer.ContainerPeer", "$.LightweightPeer"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.component = null;
5 this.layoutMgr = null;
6 this.dispatcher = null;
7 this.focusCycleRoot = false;
8 this.focusTraversalPolicyProvider = false;
9 this.containerListener = null;
10 this.listeningChildren = 0;
11 this.listeningBoundsChildren = 0;
12 this.descendantsCount = 0;
13 this.preserveBackgroundColor = null;
14 this.numOfHWComponents = 0;
15 this.numOfLWComponents = 0;
16 this.modalComp = null;
17 this.modalAppContext = null;
18 Clazz.instantialize (this, arguments);
19 }, java.awt, "Container", java.awt.Component);
20 Clazz.makeConstructor (c$, 
21 function () {
22 Clazz.superConstructor (this, java.awt.Container, []);
23 this.component =  new java.util.ArrayList ();
24 });
25 Clazz.defineMethod (c$, "initializeFocusTraversalKeys", 
26 function () {
27 });
28 Clazz.defineMethod (c$, "getComponentCount", 
29 function () {
30 return this.countComponents ();
31 });
32 Clazz.defineMethod (c$, "countComponents", 
33 function () {
34 return this.component.size ();
35 });
36 Clazz.defineMethod (c$, "getComponent", 
37 function (n) {
38 if ((n < 0) || (n >= this.component.size ())) {
39 throw  new ArrayIndexOutOfBoundsException ("No such child: " + n);
40 }return this.component.get (n);
41 }, "~N");
42 Clazz.defineMethod (c$, "getComponents", 
43 function () {
44 return this.getComponents_NoClientCode ();
45 });
46 Clazz.defineMethod (c$, "getComponents_NoClientCode", 
47 function () {
48 return this.component.toArray (java.awt.Container.EMPTY_ARRAY);
49 });
50 Clazz.defineMethod (c$, "getInsets", 
51 function () {
52 var peer = this.peer;
53 if (Clazz.instanceOf (peer, java.awt.peer.ContainerPeer)) {
54 var cpeer = peer;
55 return cpeer.getInsets ().clone ();
56 }return  new java.awt.Insets (0, 0, 0, 0);
57 });
58 Clazz.defineMethod (c$, "add", 
59 function (comp) {
60 return this.addImpl (comp, null, -1);
61 }, "java.awt.Component");
62 Clazz.defineMethod (c$, "add", 
63 function (name, comp) {
64 return this.addImpl (comp, name, -1);
65 }, "~S,java.awt.Component");
66 Clazz.defineMethod (c$, "add", 
67 function (comp, index) {
68 return this.addImpl (comp, null, index);
69 }, "java.awt.Component,~N");
70 Clazz.defineMethod (c$, "checkAddToSelf", 
71  function (comp) {
72 if (Clazz.instanceOf (comp, java.awt.Container)) {
73 for (var cn = this; cn != null; cn = cn.parent) {
74 if (cn === comp) {
75 throw  new IllegalArgumentException ("adding container's parent to itself");
76 }}
77 }}, "java.awt.Component");
78 Clazz.defineMethod (c$, "checkNotAWindow", 
79  function (comp) {
80 if (Clazz.instanceOf (comp, java.awt.Window)) {
81 throw  new IllegalArgumentException ("adding a window to a container");
82 }}, "java.awt.Component");
83 Clazz.defineMethod (c$, "removeDelicately", 
84  function (comp, newParent, newIndex) {
85 var index = this.getComponentZOrder (comp);
86 var needRemoveNotify = java.awt.Container.isRemoveNotifyNeeded (comp, this, newParent);
87 if (needRemoveNotify) {
88 comp.removeNotify ();
89 }if (newParent !== this) {
90 if (this.layoutMgr != null) {
91 this.layoutMgr.removeLayoutComponent (comp);
92 }this.adjustListeningChildren (32768, -comp.numListening (32768));
93 this.adjustListeningChildren (65536, -comp.numListening (65536));
94 this.adjustDescendants (-(comp.countHierarchyMembers ()));
95 comp.parent = null;
96 this.component.remove (index);
97 this.invalidateIfValid ();
98 } else {
99 this.component.remove (index);
100 this.component.add (newIndex, comp);
101 }if (comp.parent == null) {
102 if (this.containerListener != null || (this.eventMask & 2) != 0 || java.awt.Toolkit.enabledOnToolkit (2)) {
103 var e =  new java.awt.event.ContainerEvent (this, 301, comp);
104 this.dispatchEvent (e);
105 }comp.createHierarchyEvents (1400, comp, this, 1, java.awt.Toolkit.enabledOnToolkit (32768));
106 if (this.peer != null && this.layoutMgr == null && this.isVisible ()) {
107 this.updateCursorImmediately ();
108 }}return needRemoveNotify;
109 }, "java.awt.Component,java.awt.Container,~N");
110 Clazz.defineMethod (c$, "canContainFocusOwner", 
111 function (focusOwnerCandidate) {
112 if (!(this.isEnabled () && this.isDisplayable () && this.isVisible () && this.isFocusable ())) {
113 return false;
114 }{
115 if (this.parent != null) {
116 return this.parent.canContainFocusOwner (focusOwnerCandidate);
117 }}return true;
118 }, "java.awt.Component");
119 Clazz.defineMethod (c$, "hasHeavyweightDescendants", 
120 function () {
121 return this.numOfHWComponents > 0;
122 });
123 Clazz.defineMethod (c$, "hasLightweightDescendants", 
124 function () {
125 return this.numOfLWComponents > 0;
126 });
127 Clazz.defineMethod (c$, "getHeavyweightContainer", 
128 function () {
129 if (this.peer != null && !(Clazz.instanceOf (this.peer, java.awt.peer.LightweightPeer))) {
130 return this;
131 } else {
132 return this.getNativeContainer ();
133 }});
134 c$.isRemoveNotifyNeeded = Clazz.defineMethod (c$, "isRemoveNotifyNeeded", 
135  function (comp, oldContainer, newContainer) {
136 return false;
137 }, "java.awt.Component,java.awt.Container,java.awt.Container");
138 Clazz.defineMethod (c$, "setComponentZOrder", 
139 function (comp, index) {
140 {
141 var curParent = comp.parent;
142 var oldZindex = this.getComponentZOrder (comp);
143 if (curParent === this && index == oldZindex) {
144 return;
145 }var peerRecreated = (curParent != null) ? curParent.removeDelicately (comp, this, index) : false;
146 this.addDelicately (comp, curParent, index);
147 if (!peerRecreated && oldZindex != -1) {
148 comp.mixOnZOrderChanging (oldZindex, index);
149 }}}, "java.awt.Component,~N");
150 Clazz.defineMethod (c$, "reparentTraverse", 
151  function (parentPeer, child) {
152 this.checkTreeLock ();
153 for (var i = 0; i < child.getComponentCount (); i++) {
154 var comp = child.getComponent (i);
155 if (comp.isLightweight ()) {
156 if (Clazz.instanceOf (comp, java.awt.Container)) {
157 this.reparentTraverse (parentPeer, comp);
158 }} else {
159 comp.getPeer ().reparent (parentPeer);
160 }}
161 }, "java.awt.peer.ContainerPeer,java.awt.Container");
162 Clazz.defineMethod (c$, "reparentChild", 
163  function (comp) {
164 if (comp == null) {
165 return;
166 }if (comp.isLightweight ()) {
167 if (Clazz.instanceOf (comp, java.awt.Container)) {
168 this.reparentTraverse (this.getPeer (), comp);
169 }} else {
170 comp.getPeer ().reparent (this.getPeer ());
171 }}, "java.awt.Component");
172 Clazz.defineMethod (c$, "addDelicately", 
173  function (comp, curParent, index) {
174 this.checkTreeLock ();
175 if (curParent !== this) {
176 if (index == -1) {
177 this.component.add (comp);
178 } else {
179 this.component.add (index, comp);
180 }comp.parent = this;
181 this.adjustListeningChildren (32768, comp.numListening (32768));
182 this.adjustListeningChildren (65536, comp.numListening (65536));
183 this.adjustDescendants (comp.countHierarchyMembers ());
184 } else {
185 if (index < this.component.size ()) {
186 this.component.set (index, comp);
187 }}this.invalidateIfValid ();
188 if (this.peer != null) {
189 if (comp.peer == null) {
190 comp.addNotify ();
191 } else {
192 var newNativeContainer = this.getHeavyweightContainer ();
193 var oldNativeContainer = curParent.getHeavyweightContainer ();
194 if (oldNativeContainer !== newNativeContainer) {
195 newNativeContainer.reparentChild (comp);
196 }if (!comp.isLightweight () && this.isLightweight ()) {
197 comp.relocateComponent ();
198 }}}if (curParent !== this) {
199 if (this.layoutMgr != null) {
200 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
201 (this.layoutMgr).addLayoutComponent (comp, null);
202 } else {
203 this.layoutMgr.addLayoutComponent (null, comp);
204 }}if (this.containerListener != null || (this.eventMask & 2) != 0 || java.awt.Toolkit.enabledOnToolkit (2)) {
205 var e =  new java.awt.event.ContainerEvent (this, 300, comp);
206 this.dispatchEvent (e);
207 }comp.createHierarchyEvents (1400, comp, this, 1, java.awt.Toolkit.enabledOnToolkit (32768));
208 } else {
209 comp.createHierarchyEvents (1400, comp, this, 1400, java.awt.Toolkit.enabledOnToolkit (32768));
210 }if (this.peer != null && this.layoutMgr == null && this.isVisible ()) {
211 this.updateCursorImmediately ();
212 }}, "java.awt.Component,java.awt.Container,~N");
213 Clazz.defineMethod (c$, "checkTreeLock", 
214  function () {
215 });
216 Clazz.defineMethod (c$, "getComponentZOrder", 
217 function (comp) {
218 if (comp == null) {
219 return -1;
220 }{
221 if (comp.parent !== this) {
222 return -1;
223 }return this.component.indexOf (comp);
224 }}, "java.awt.Component");
225 Clazz.defineMethod (c$, "add", 
226 function (comp, constraints) {
227 this.addImpl (comp, constraints, -1);
228 }, "java.awt.Component,~O");
229 Clazz.defineMethod (c$, "add", 
230 function (comp, constraints, index) {
231 return this.addImpl (comp, constraints, index);
232 }, "java.awt.Component,~O,~N");
233 Clazz.defineMethod (c$, "addImpl", 
234 function (comp, constraints, index) {
235 return this.addImplSAEM (comp, constraints, index);
236 }, "java.awt.Component,~O,~N");
237 Clazz.defineMethod (c$, "addImplSAEM", 
238 function (comp, constraints, index) {
239 {
240 if (index > this.component.size () || (index < 0 && index != -1)) {
241 throw  new IllegalArgumentException ("illegal component position");
242 }this.checkAddToSelf (comp);
243 this.checkNotAWindow (comp);
244 if (comp.parent != null) {
245 comp.parent.remove (comp);
246 if (index > this.component.size ()) {
247 throw  new IllegalArgumentException ("illegal component position");
248 }}if (index == -1) {
249 this.component.add (comp);
250 } else {
251 this.component.add (index, comp);
252 }comp.parent = this;
253 this.adjustListeningChildren (32768, comp.numListening (32768));
254 this.adjustListeningChildren (65536, comp.numListening (65536));
255 this.adjustDescendants (comp.countHierarchyMembers ());
256 this.invalidateIfValid ();
257 if (this.peer != null) {
258 comp.addNotify ();
259 }if (this.layoutMgr != null) {
260 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
261 (this.layoutMgr).addLayoutComponent (comp, constraints);
262 } else if (Clazz.instanceOf (constraints, String)) {
263 this.layoutMgr.addLayoutComponent (constraints, comp);
264 }}if (this.containerListener != null || (this.eventMask & 2) != 0 || java.awt.Toolkit.enabledOnToolkit (2)) {
265 var e =  new java.awt.event.ContainerEvent (this, 300, comp);
266 this.dispatchEvent (e);
267 }comp.createHierarchyEvents (1400, comp, this, 1, java.awt.Toolkit.enabledOnToolkit (32768));
268 if (this.peer != null && this.layoutMgr == null && this.isVisible ()) {
269 this.updateCursorImmediately ();
270 }}return comp;
271 }, "java.awt.Component,~O,~N");
272 Clazz.defineMethod (c$, "checkGD", 
273 function (stringID) {
274 }, "~S");
275 Clazz.defineMethod (c$, "remove", 
276 function (index) {
277 this.removeInt (index);
278 }, "~N");
279 Clazz.defineMethod (c$, "removeInt", 
280 function (index) {
281 {
282 if (index < 0 || index >= this.component.size ()) {
283 throw  new ArrayIndexOutOfBoundsException (index);
284 }var comp = this.component.get (index);
285 if (this.peer != null) {
286 comp.removeNotify ();
287 }if (this.layoutMgr != null) {
288 this.layoutMgr.removeLayoutComponent (comp);
289 }this.adjustListeningChildren (32768, -comp.numListening (32768));
290 this.adjustListeningChildren (65536, -comp.numListening (65536));
291 this.adjustDescendants (-(comp.countHierarchyMembers ()));
292 comp.parent = null;
293 this.component.remove (index);
294 this.invalidateIfValid ();
295 if (this.containerListener != null || (this.eventMask & 2) != 0 || java.awt.Toolkit.enabledOnToolkit (2)) {
296 var e =  new java.awt.event.ContainerEvent (this, 301, comp);
297 this.dispatchEvent (e);
298 }comp.createHierarchyEvents (1400, comp, this, 1, java.awt.Toolkit.enabledOnToolkit (32768));
299 if (this.peer != null && this.layoutMgr == null && this.isVisible ()) {
300 this.updateCursorImmediately ();
301 }}}, "~N");
302 Clazz.defineMethod (c$, "remove", 
303 function (comp) {
304 this.removeChild (comp);
305 }, "java.awt.Component");
306 Clazz.defineMethod (c$, "removeChild", 
307 function (comp) {
308 {
309 if (comp.parent === this) {
310 var index = this.component.indexOf (comp);
311 if (index >= 0) {
312 this.remove (index);
313 }}}}, "java.awt.Component");
314 Clazz.defineMethod (c$, "removeAll", 
315 function () {
316 {
317 this.adjustListeningChildren (32768, -this.listeningChildren);
318 this.adjustListeningChildren (65536, -this.listeningBoundsChildren);
319 this.adjustDescendants (-this.descendantsCount);
320 while (!this.component.isEmpty ()) {
321 var comp = this.component.remove (this.component.size () - 1);
322 if (this.peer != null) {
323 comp.removeNotify ();
324 }if (this.layoutMgr != null) {
325 this.layoutMgr.removeLayoutComponent (comp);
326 }comp.parent = null;
327 if (this.containerListener != null || (this.eventMask & 2) != 0 || java.awt.Toolkit.enabledOnToolkit (2)) {
328 var e =  new java.awt.event.ContainerEvent (this, 301, comp);
329 this.dispatchEvent (e);
330 }comp.createHierarchyEvents (1400, comp, this, 1, java.awt.Toolkit.enabledOnToolkit (32768));
331 }
332 if (this.peer != null && this.layoutMgr == null && this.isVisible ()) {
333 this.updateCursorImmediately ();
334 }this.invalidateIfValid ();
335 }});
336 Clazz.defineMethod (c$, "numListening", 
337 function (mask) {
338 var superListening = this.numListeningMask (mask);
339 if (mask == 32768) {
340 return this.listeningChildren + superListening;
341 } else if (mask == 65536) {
342 return this.listeningBoundsChildren + superListening;
343 } else {
344 return superListening;
345 }}, "~N");
346 Clazz.defineMethod (c$, "adjustListeningChildren", 
347 function (mask, num) {
348 if (num == 0) return;
349 if ((mask & 32768) != 0) {
350 this.listeningChildren += num;
351 }if ((mask & 65536) != 0) {
352 this.listeningBoundsChildren += num;
353 }this.adjustListeningChildrenOnParent (mask, num);
354 }, "~N,~N");
355 Clazz.defineMethod (c$, "adjustDescendants", 
356 function (num) {
357 if (num == 0) return;
358 this.descendantsCount += num;
359 this.adjustDecendantsOnParent (num);
360 }, "~N");
361 Clazz.defineMethod (c$, "adjustDecendantsOnParent", 
362 function (num) {
363 if (this.parent != null) {
364 this.parent.adjustDescendants (num);
365 }}, "~N");
366 Clazz.defineMethod (c$, "countHierarchyMembers", 
367 function () {
368 return this.descendantsCount + 1;
369 });
370 Clazz.defineMethod (c$, "getListenersCount", 
371  function (id, enabledOnToolkit) {
372 if (enabledOnToolkit) {
373 return this.descendantsCount;
374 }switch (id) {
375 case 1400:
376 return this.listeningChildren;
377 case 1401:
378 case 1402:
379 return this.listeningBoundsChildren;
380 default:
381 return 0;
382 }
383 }, "~N,~B");
384 Clazz.defineMethod (c$, "createHierarchyEvents", 
385 function (id, changed, changedParent, changeFlags, enabledOnToolkit) {
386 var listeners = this.getListenersCount (id, enabledOnToolkit);
387 for (var count = listeners, i = 0; count > 0; i++) {
388 count -= this.component.get (i).createHierarchyEvents (id, changed, changedParent, changeFlags, enabledOnToolkit);
389 }
390 return listeners + this.createHierEventsComp (id, changed, changedParent, changeFlags, enabledOnToolkit);
391 }, "~N,java.awt.Component,java.awt.Container,~N,~B");
392 Clazz.defineMethod (c$, "createChildHierarchyEvents", 
393 function (id, changeFlags, enabledOnToolkit) {
394 if (this.component.isEmpty ()) {
395 return;
396 }var listeners = this.getListenersCount (id, enabledOnToolkit);
397 for (var count = listeners, i = 0; count > 0; i++) {
398 count -= this.component.get (i).createHierarchyEvents (id, this, this.parent, changeFlags, enabledOnToolkit);
399 }
400 }, "~N,~N,~B");
401 Clazz.defineMethod (c$, "getLayout", 
402 function () {
403 return this.layoutMgr;
404 });
405 Clazz.defineMethod (c$, "setLayout", 
406 function (mgr) {
407 this.layoutMgr = mgr;
408 this.invalidateIfValid ();
409 }, "java.awt.LayoutManager");
410 Clazz.overrideMethod (c$, "doLayout", 
411 function () {
412 this.layout ();
413 });
414 Clazz.overrideMethod (c$, "layout", 
415 function () {
416 var layoutMgr = this.layoutMgr;
417 if (layoutMgr != null) {
418 layoutMgr.layoutContainer (this);
419 }});
420 Clazz.overrideMethod (c$, "invalidate", 
421 function () {
422 var layoutMgr = this.layoutMgr;
423 if (Clazz.instanceOf (layoutMgr, java.awt.LayoutManager2)) {
424 var lm = layoutMgr;
425 lm.invalidateLayout (this);
426 }this.invalidateComp ();
427 });
428 Clazz.overrideMethod (c$, "validate", 
429 function () {
430 if (!this.isValid ()) {
431 var updateCur = false;
432 {
433 if (!this.isValid () && this.peer != null) {
434 var p = null;
435 if (Clazz.instanceOf (this.peer, java.awt.peer.ContainerPeer)) {
436 p = this.peer;
437 }if (p != null) {
438 p.beginValidate ();
439 }this.validateTree ();
440 if (p != null) {
441 p.endValidate ();
442 updateCur = this.isVisible ();
443 }}}if (updateCur) {
444 this.updateCursorImmediately ();
445 }}});
446 Clazz.defineMethod (c$, "validateTree", 
447 function () {
448 if (!this.isValid ()) {
449 if (Clazz.instanceOf (this.peer, java.awt.peer.ContainerPeer)) {
450 (this.peer).beginLayout ();
451 }this.doLayout ();
452 for (var i = 0; i < this.component.size (); i++) {
453 var comp = this.component.get (i);
454 if ((Clazz.instanceOf (comp, java.awt.Container)) && !(Clazz.instanceOf (comp, java.awt.Window)) && !comp.isValid ()) {
455 (comp).validateTree ();
456 } else {
457 comp.validate ();
458 }}
459 if (Clazz.instanceOf (this.peer, java.awt.peer.ContainerPeer)) {
460 (this.peer).endLayout ();
461 }}this.validateComponent ();
462 });
463 Clazz.defineMethod (c$, "invalidateTree", 
464 function () {
465 {
466 for (var i = 0; i < this.component.size (); i++) {
467 var comp = this.component.get (i);
468 if (Clazz.instanceOf (comp, java.awt.Container)) {
469 (comp).invalidateTree ();
470 } else {
471 comp.invalidateIfValid ();
472 }}
473 this.invalidateIfValid ();
474 }});
475 Clazz.overrideMethod (c$, "setFont", 
476 function (f) {
477 var oldfont = this.getFont ();
478 this.setFontComp (f);
479 var newfont = this.getFont ();
480 if (newfont !== oldfont && (oldfont == null || !oldfont.equals (newfont))) {
481 this.invalidateTree ();
482 }}, "java.awt.Font");
483 Clazz.overrideMethod (c$, "getPreferredSize", 
484 function () {
485 return this.preferredSize ();
486 });
487 Clazz.overrideMethod (c$, "preferredSize", 
488 function () {
489 var dim = this.prefSize;
490 if (dim == null || !(this.isPreferredSizeSet () || this.isValid ())) {
491 {
492 this.prefSize = (this.layoutMgr != null) ? this.layoutMgr.preferredLayoutSize (this) : this.prefSizeComp ();
493 dim = this.prefSize;
494 }}return (dim == null ? null :  new java.awt.Dimension (dim));
495 });
496 Clazz.overrideMethod (c$, "getMinimumSize", 
497 function () {
498 var dim = this.minSize;
499 if (dim == null || !(this.isMinimumSizeSet () || this.isValid ())) {
500 {
501 this.minSize = (this.layoutMgr != null) ? this.layoutMgr.minimumLayoutSize (this) : this.minimumSize ();
502 dim = this.minSize;
503 }}if (dim != null) {
504 return  new java.awt.Dimension (dim);
505 } else {
506 return dim;
507 }});
508 Clazz.overrideMethod (c$, "getMaximumSize", 
509 function () {
510 var dim = this.maxSize;
511 if (dim == null || !(this.isMaximumSizeSet () || this.isValid ())) {
512 {
513 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
514 var lm = this.layoutMgr;
515 this.maxSize = lm.maximumLayoutSize (this);
516 } else {
517 this.maxSize = this.getMaxSizeComp ();
518 }dim = this.maxSize;
519 }}if (dim != null) {
520 return  new java.awt.Dimension (dim);
521 } else {
522 return dim;
523 }});
524 Clazz.overrideMethod (c$, "getAlignmentX", 
525 function () {
526 var xAlign;
527 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
528 {
529 var lm = this.layoutMgr;
530 xAlign = lm.getLayoutAlignmentX (this);
531 }} else {
532 xAlign = this.getAlignmentXComp ();
533 }return xAlign;
534 });
535 Clazz.overrideMethod (c$, "getAlignmentY", 
536 function () {
537 var yAlign;
538 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
539 {
540 var lm = this.layoutMgr;
541 yAlign = lm.getLayoutAlignmentY (this);
542 }} else {
543 yAlign = this.getAlignmentYComp ();
544 }return yAlign;
545 });
546 Clazz.overrideMethod (c$, "paint", 
547 function (g) {
548 java.awt.GraphicsCallback.PaintCallback.getInstance ().runComponents (this.component.toArray (java.awt.Container.EMPTY_ARRAY), g, 2);
549 }, "java.awt.Graphics");
550 Clazz.overrideMethod (c$, "update", 
551 function (g) {
552 if (this.isShowing ()) {
553 g.clearRect (0, 0, this.width, this.height);
554 this.paint (g);
555 }}, "java.awt.Graphics");
556 Clazz.defineMethod (c$, "paintComponents", 
557 function (g) {
558 if (this.isShowing ()) {
559 java.awt.GraphicsCallback.PaintAllCallback.getInstance ().runComponents (this.component.toArray (java.awt.Container.EMPTY_ARRAY), g, 4);
560 }}, "java.awt.Graphics");
561 Clazz.overrideMethod (c$, "lightweightPaint", 
562 function (g) {
563 this.lwPaintComp (g);
564 this.paintHeavyweightComponents (g);
565 }, "java.awt.Graphics");
566 Clazz.overrideMethod (c$, "paintHeavyweightComponents", 
567 function (g) {
568 if (this.isShowing ()) {
569 java.awt.GraphicsCallback.PaintHeavyweightComponentsCallback.getInstance ().runComponents (this.component.toArray (java.awt.Container.EMPTY_ARRAY), g, 3);
570 }}, "java.awt.Graphics");
571 Clazz.defineMethod (c$, "addContainerListener", 
572 function (l) {
573 if (l == null) {
574 return;
575 }this.containerListener = java.awt.AWTEventMulticaster.add (this.containerListener, l);
576 this.newEventsOnly = true;
577 }, "java.awt.event.ContainerListener");
578 Clazz.defineMethod (c$, "removeContainerListener", 
579 function (l) {
580 if (l == null) {
581 return;
582 }this.containerListener = java.awt.AWTEventMulticaster.remove (this.containerListener, l);
583 }, "java.awt.event.ContainerListener");
584 Clazz.defineMethod (c$, "getContainerListeners", 
585 function () {
586 return (this.getListeners (java.awt.event.ContainerListener));
587 });
588 Clazz.overrideMethod (c$, "getListeners", 
589 function (listenerType) {
590 var l = null;
591 if (listenerType === java.awt.event.ContainerListener) {
592 l = this.containerListener;
593 } else {
594 return this.getListenersComp (listenerType);
595 }return java.awt.AWTEventMulticaster.getListeners (l, listenerType);
596 }, "Class");
597 Clazz.overrideMethod (c$, "eventEnabled", 
598 function (e) {
599 var id = e.getID ();
600 if (id == 300 || id == 301) {
601 if ((this.eventMask & 2) != 0 || this.containerListener != null) {
602 return true;
603 }return false;
604 }return this.eventTypeEnabled (e.id);
605 }, "java.awt.AWTEvent");
606 Clazz.overrideMethod (c$, "processEvent", 
607 function (e) {
608 this.processEventCont (e);
609 }, "java.awt.AWTEvent");
610 Clazz.defineMethod (c$, "processEventCont", 
611 function (e) {
612 if (Clazz.instanceOf (e, java.awt.event.ContainerEvent)) {
613 this.processContainerEvent (e);
614 return;
615 }this.processEventComp (e);
616 }, "java.awt.AWTEvent");
617 Clazz.defineMethod (c$, "processContainerEvent", 
618 function (e) {
619 var listener = this.containerListener;
620 if (listener != null) {
621 switch (e.getID ()) {
622 case 300:
623 listener.componentAdded (e);
624 break;
625 case 301:
626 listener.componentRemoved (e);
627 break;
628 }
629 }}, "java.awt.event.ContainerEvent");
630 Clazz.overrideMethod (c$, "dispatchEventImpl", 
631 function (e) {
632 if ((this.dispatcher != null) && this.dispatcher.dispatchEvent (e)) {
633 e.consume ();
634 if (this.peer != null) {
635 this.peer.handleEvent (e);
636 }return;
637 }this.dispatchEventImplComp (e);
638 {
639 switch (e.getID ()) {
640 case 101:
641 break;
642 case 100:
643 break;
644 default:
645 break;
646 }
647 }}, "java.awt.AWTEvent");
648 Clazz.defineMethod (c$, "dispatchEventToSelf", 
649 function (e) {
650 this.dispatchEventImplComp (e);
651 }, "java.awt.AWTEvent");
652 Clazz.defineMethod (c$, "getMouseEventTarget", 
653  function (x, y, includeSelf, filter, searchHeavyweights) {
654 {
655 if (arguments.length == 3) {
656 filter = java.awt.Container.MouseEventTargetFilter.FILTER;
657 searchHeavyWeights = false;
658 }
659 }var comp = null;
660 if (comp == null || comp === this) {
661 comp = this.getMouseEventTargetImpl (x, y, includeSelf, filter, false, searchHeavyweights);
662 }return comp;
663 }, "~N,~N,~B,java.awt.Container.EventTargetFilter,~B");
664 Clazz.defineMethod (c$, "getMouseEventTargetImpl", 
665  function (x, y, includeSelf, filter, searchHeavyweightChildren, searchHeavyweightDescendants) {
666 {
667 for (var i = 0; i < this.component.size (); i++) {
668 var comp = this.component.get (i);
669 if (comp != null && comp.visible && ((!searchHeavyweightChildren && Clazz.instanceOf (comp.peer, java.awt.peer.LightweightPeer)) || (searchHeavyweightChildren && !(Clazz.instanceOf (comp.peer, java.awt.peer.LightweightPeer)))) && comp.contains (x - comp.x, y - comp.y)) {
670 if (Clazz.instanceOf (comp, java.awt.Container)) {
671 var child = comp;
672 var deeper = child.getMouseEventTarget (x - child.x, y - child.y, includeSelf, filter, searchHeavyweightDescendants);
673 if (deeper != null) {
674 return deeper;
675 }} else {
676 if (filter.accept (comp)) {
677 return comp;
678 }}}}
679 var isPeerOK;
680 var isMouseOverMe;
681 isPeerOK = includeSelf;
682 isMouseOverMe = this.contains (x, y);
683 if (isMouseOverMe && isPeerOK && filter.accept (this)) {
684 return this;
685 }return null;
686 }}, "~N,~N,~B,java.awt.Container.EventTargetFilter,~B,~B");
687 Clazz.defineMethod (c$, "proxyEnableEvents", 
688 function (events) {
689 if (this.parent != null) {
690 this.parent.proxyEnableEvents (events);
691 }if (this.dispatcher != null) {
692 this.dispatcher.enableEvents (events);
693 }}, "~N");
694 Clazz.defineMethod (c$, "deliverEvent", 
695 function (e) {
696 var comp = this.getComponentAt (e.x, e.y);
697 if ((comp != null) && (comp !== this)) {
698 e.translate (-comp.x, -comp.y);
699 comp.deliverEvent (e);
700 } else {
701 this.postEvent (e);
702 }}, "java.awt.Event");
703 Clazz.defineMethod (c$, "getComponentAt", 
704 function (x, y) {
705 return this.locate (x, y);
706 }, "~N,~N");
707 Clazz.overrideMethod (c$, "locate", 
708 function (x, y) {
709 return this;
710 }, "~N,~N");
711 Clazz.defineMethod (c$, "getComponentAt", 
712 function (p) {
713 return this.getComponentAt (p.x, p.y);
714 }, "java.awt.Point");
715 Clazz.defineMethod (c$, "getMousePosition", 
716 function (allowChildren) {
717 return null;
718 }, "~B");
719 Clazz.overrideMethod (c$, "isSameOrAncestorOf", 
720 function (comp, allowChildren) {
721 return this === comp || (allowChildren && this.isParentOf (comp));
722 }, "java.awt.Component,~B");
723 Clazz.defineMethod (c$, "findComponentAt", 
724 function (x, y) {
725 {
726 return this.findComponentAt (x, y, true);
727 }}, "~N,~N");
728 Clazz.defineMethod (c$, "findComponentAt", 
729 function (x, y, ignoreEnabled) {
730 return null;
731 }, "~N,~N,~B");
732 Clazz.defineMethod (c$, "findComponentAt", 
733 function (p) {
734 return this.findComponentAt (p.x, p.y);
735 }, "java.awt.Point");
736 Clazz.defineMethod (c$, "addNotify", 
737 function () {
738 {
739 this.addNotifyComp ();
740 if (!(Clazz.instanceOf (this.peer, java.awt.peer.LightweightPeer))) {
741 this.setDispatcher ();
742 }for (var i = 0; i < this.component.size (); i++) {
743 this.component.get (i).addNotify ();
744 }
745 }});
746 Clazz.defineMethod (c$, "setDispatcher", 
747 function () {
748 this.dispatcher =  new java.awt.LightweightDispatcher (this);
749 });
750 Clazz.defineMethod (c$, "removeNotify", 
751 function () {
752 for (var i = this.component.size () - 1; i >= 0; i--) {
753 var comp = this.component.get (i);
754 if (comp != null) {
755 comp.setAutoFocusTransferOnDisposal (false);
756 comp.removeNotify ();
757 comp.setAutoFocusTransferOnDisposal (true);
758 }}
759 if (this.dispatcher != null) {
760 this.dispatcher.dispose ();
761 this.dispatcher = null;
762 }this.removeNotifyComp ();
763 });
764 Clazz.defineMethod (c$, "isAncestorOf", 
765 function (c) {
766 var p;
767 if (c == null || ((p = c.getParent ()) == null)) {
768 return false;
769 }while (p != null) {
770 if (p === this) {
771 return true;
772 }p = p.getParent ();
773 }
774 return false;
775 }, "java.awt.Component");
776 Clazz.overrideMethod (c$, "paramString", 
777 function () {
778 var str = this.paramStringComp ();
779 var layoutMgr = this.layoutMgr;
780 if (layoutMgr != null) {
781 str += ",layout=" + layoutMgr.getClass ().getName ();
782 }return str;
783 });
784 Clazz.defineMethod (c$, "setFocusTraversalKeys", 
785 function (id, keystrokes) {
786 }, "~N,java.util.Set");
787 Clazz.defineMethod (c$, "getFocusTraversalKeys", 
788 function (id) {
789 return null;
790 }, "~N");
791 Clazz.defineMethod (c$, "areFocusTraversalKeysSet", 
792 function (id) {
793 return false;
794 }, "~N");
795 Clazz.defineMethod (c$, "isFocusCycleRoot", 
796 function (container) {
797 if (this.isFocusCycleRoot () && container === this) {
798 return true;
799 } else {
800 return this.isFocusCycleRootComp (container);
801 }}, "java.awt.Container");
802 Clazz.overrideMethod (c$, "containsFocus", 
803 function () {
804 return false;
805 });
806 Clazz.defineMethod (c$, "isParentOf", 
807  function (comp) {
808 {
809 while (comp != null && comp !== this && !(Clazz.instanceOf (comp, java.awt.Window))) {
810 comp = comp.getParent ();
811 }
812 return (comp === this);
813 }}, "java.awt.Component");
814 Clazz.defineMethod (c$, "clearMostRecentFocusOwnerOnHide", 
815 function () {
816 });
817 Clazz.overrideMethod (c$, "clearCurrentFocusCycleRootOnHide", 
818 function () {
819 });
820 Clazz.defineMethod (c$, "getTraversalRoot", 
821 function () {
822 return null;
823 });
824 Clazz.defineMethod (c$, "isFocusCycleRoot", 
825 function () {
826 return this.focusCycleRoot;
827 });
828 Clazz.defineMethod (c$, "setFocusTraversalPolicyProvider", 
829 function (provider) {
830 var oldProvider;
831 {
832 oldProvider = this.focusTraversalPolicyProvider;
833 this.focusTraversalPolicyProvider = provider;
834 }this.firePropertyChangeBool ("focusTraversalPolicyProvider", oldProvider, provider);
835 }, "~B");
836 Clazz.defineMethod (c$, "isFocusTraversalPolicyProvider", 
837 function () {
838 return this.focusTraversalPolicyProvider;
839 });
840 Clazz.defineMethod (c$, "transferFocusDownCycle", 
841 function () {
842 });
843 Clazz.defineMethod (c$, "preProcessKeyEvent", 
844 function (e) {
845 var parent = this.parent;
846 if (parent != null) {
847 parent.preProcessKeyEvent (e);
848 }}, "java.awt.event.KeyEvent");
849 Clazz.defineMethod (c$, "postProcessKeyEvent", 
850 function (e) {
851 var parent = this.parent;
852 if (parent != null) {
853 parent.postProcessKeyEvent (e);
854 }}, "java.awt.event.KeyEvent");
855 Clazz.overrideMethod (c$, "postsOldMouseEvents", 
856 function () {
857 return true;
858 });
859 Clazz.defineMethod (c$, "applyComponentOrientation", 
860 function (o) {
861 this.applyCompOrientComp (o);
862 {
863 for (var i = 0; i < this.component.size (); i++) {
864 var comp = this.component.get (i);
865 comp.applyComponentOrientation (o);
866 }
867 }}, "java.awt.ComponentOrientation");
868 Clazz.defineMethod (c$, "addPropertyChangeListener", 
869 function (listener) {
870 this.addPropChangeListenerComp (listener);
871 }, "java.beans.PropertyChangeListener");
872 Clazz.defineMethod (c$, "addPropertyChangeListener", 
873 function (propertyName, listener) {
874 this.addPropChangeListComp (propertyName, listener);
875 }, "~S,java.beans.PropertyChangeListener");
876 Clazz.defineMethod (c$, "increaseComponentCount", 
877 function (c) {
878 if (!c.isDisplayable ()) {
879 throw  new IllegalStateException ("Peer does not exist while invoking the increaseComponentCount() method");
880 }var addHW = 0;
881 var addLW = 0;
882 if (Clazz.instanceOf (c, java.awt.Container)) {
883 addLW = (c).numOfLWComponents;
884 addHW = (c).numOfHWComponents;
885 }if (c.isLightweight ()) {
886 addLW++;
887 } else {
888 addHW++;
889 }for (var cont = this; cont != null; cont = cont.getContainer ()) {
890 cont.numOfLWComponents += addLW;
891 cont.numOfHWComponents += addHW;
892 }
893 }, "java.awt.Component");
894 Clazz.defineMethod (c$, "decreaseComponentCount", 
895 function (c) {
896 if (!c.isDisplayable ()) {
897 throw  new IllegalStateException ("Peer does not exist while invoking the decreaseComponentCount() method");
898 }var subHW = 0;
899 var subLW = 0;
900 if (Clazz.instanceOf (c, java.awt.Container)) {
901 subLW = (c).numOfLWComponents;
902 subHW = (c).numOfHWComponents;
903 }if (c.isLightweight ()) {
904 subLW++;
905 } else {
906 subHW++;
907 }for (var cont = this; cont != null; cont = cont.getContainer ()) {
908 cont.numOfLWComponents -= subLW;
909 cont.numOfHWComponents -= subHW;
910 }
911 }, "java.awt.Component");
912 Clazz.declareInterface (java.awt.Container, "EventTargetFilter");
913 Clazz.pu$h(self.c$);
914 c$ = Clazz.declareType (java.awt.Container, "MouseEventTargetFilter", null, java.awt.Container.EventTargetFilter);
915 Clazz.makeConstructor (c$, 
916  function () {
917 });
918 Clazz.overrideMethod (c$, "accept", 
919 function (a) {
920 return (a.eventMask & 32) != 0 || (a.eventMask & 16) != 0 || (a.eventMask & 131072) != 0 || a.mouseListener != null || a.mouseMotionListener != null || a.mouseWheelListener != null;
921 }, "java.awt.Component");
922 c$.FILTER = c$.prototype.FILTER =  new java.awt.Container.MouseEventTargetFilter ();
923 c$ = Clazz.p0p ();
924 c$.EMPTY_ARRAY = c$.prototype.EMPTY_ARRAY =  new Array (0);
925 Clazz.defineStatics (c$,
926 "INCLUDE_SELF", true,
927 "SEARCH_HEAVYWEIGHTS", true);
928 c$ = Clazz.decorateAsClass (function () {
929 this.nativeContainer = null;
930 this.mouseEventTarget = null;
931 this.targetLastEntered = null;
932 this.isMouseInNativeContainer = false;
933 this.eventMask = 0;
934 Clazz.instantialize (this, arguments);
935 }, java.awt, "LightweightDispatcher", null, java.awt.event.AWTEventListener);
936 Clazz.makeConstructor (c$, 
937 function (nativeContainer) {
938 this.nativeContainer = nativeContainer;
939 this.mouseEventTarget = null;
940 this.eventMask = 0;
941 }, "java.awt.Container");
942 Clazz.defineMethod (c$, "dispose", 
943 function () {
944 this.stopListeningForOtherDrags ();
945 this.mouseEventTarget = null;
946 });
947 Clazz.defineMethod (c$, "enableEvents", 
948 function (events) {
949 this.eventMask |= events;
950 }, "~N");
951 Clazz.defineMethod (c$, "dispatchEvent", 
952 function (e) {
953 var ret = false;
954 if (Clazz.instanceOf (e, java.awt.event.MouseEvent) && (this.eventMask & 131120) != 0) {
955 var me = e;
956 ret = this.processMouseEvent (me);
957 }return ret;
958 }, "java.awt.AWTEvent");
959 Clazz.defineMethod (c$, "isMouseGrab", 
960  function (e) {
961 var modifiers = e.getModifiersEx ();
962 if (e.getID () == 501 || e.getID () == 502) {
963 switch (e.getButton ()) {
964 case 1:
965 modifiers ^= 1024;
966 break;
967 case 2:
968 modifiers ^= 2048;
969 break;
970 case 3:
971 modifiers ^= 4096;
972 break;
973 }
974 }return ((modifiers & (7168)) != 0);
975 }, "java.awt.event.MouseEvent");
976 Clazz.defineMethod (c$, "processMouseEvent", 
977  function (e) {
978 var id = e.getID ();
979 var mouseOver = this.nativeContainer.getMouseEventTarget (e.getX (), e.getY (), true);
980 this.trackMouseEnterExit (mouseOver, e);
981 if (!this.isMouseGrab (e) && id != 500) {
982 this.mouseEventTarget = (mouseOver !== this.nativeContainer) ? mouseOver : null;
983 }if (this.mouseEventTarget != null) {
984 switch (id) {
985 case 504:
986 case 505:
987 break;
988 case 501:
989 this.retargetMouseEvent (this.mouseEventTarget, id, e);
990 break;
991 case 502:
992 this.retargetMouseEvent (this.mouseEventTarget, id, e);
993 break;
994 case 500:
995 if (mouseOver === this.mouseEventTarget) {
996 this.retargetMouseEvent (mouseOver, id, e);
997 }break;
998 case 503:
999 this.retargetMouseEvent (this.mouseEventTarget, id, e);
1000 break;
1001 case 506:
1002 if (this.isMouseGrab (e)) {
1003 this.retargetMouseEvent (this.mouseEventTarget, id, e);
1004 }break;
1005 case 507:
1006 this.retargetMouseEvent (mouseOver, id, e);
1007 break;
1008 }
1009 e.consume ();
1010 }return e.isConsumed ();
1011 }, "java.awt.event.MouseEvent");
1012 Clazz.defineMethod (c$, "trackMouseEnterExit", 
1013  function (targetOver, e) {
1014 var targetEnter = null;
1015 var id = e.getID ();
1016 if (id != 505 && id != 506 && id != 1500 && this.isMouseInNativeContainer == false) {
1017 this.isMouseInNativeContainer = true;
1018 this.startListeningForOtherDrags ();
1019 } else if (id == 505) {
1020 this.isMouseInNativeContainer = false;
1021 this.stopListeningForOtherDrags ();
1022 }if (this.isMouseInNativeContainer) {
1023 targetEnter = targetOver;
1024 }if (this.targetLastEntered === targetEnter) {
1025 return;
1026 }if (this.targetLastEntered != null) {
1027 this.retargetMouseEvent (this.targetLastEntered, 505, e);
1028 }if (id == 505) {
1029 e.consume ();
1030 }if (targetEnter != null) {
1031 this.retargetMouseEvent (targetEnter, 504, e);
1032 }if (id == 504) {
1033 e.consume ();
1034 }this.targetLastEntered = targetEnter;
1035 }, "java.awt.Component,java.awt.event.MouseEvent");
1036 Clazz.defineMethod (c$, "startListeningForOtherDrags", 
1037  function () {
1038 });
1039 Clazz.defineMethod (c$, "stopListeningForOtherDrags", 
1040  function () {
1041 });
1042 Clazz.overrideMethod (c$, "eventDispatched", 
1043 function (e) {
1044 var isForeignDrag = (Clazz.instanceOf (e, java.awt.event.MouseEvent)) && (e.id == 506) && (e.getSource () !== this.nativeContainer);
1045 if (!isForeignDrag) {
1046 return;
1047 }var srcEvent = e;
1048 var me;
1049 {
1050 var srcComponent = srcEvent.getComponent ();
1051 if (!srcComponent.isShowing ()) {
1052 return;
1053 }var c = this.nativeContainer;
1054 while ((c != null) && !(Clazz.instanceOf (c, java.awt.Window))) {
1055 c = c.getParent_NoClientCode ();
1056 }
1057 if ((c == null) || (c).isModalBlocked ()) {
1058 return;
1059 }me =  new java.awt.event.MouseEvent (this.nativeContainer, 1500, srcEvent.getWhen (), srcEvent.getModifiersEx () | srcEvent.getModifiers (), srcEvent.getX (), srcEvent.getY (), srcEvent.getXOnScreen (), srcEvent.getYOnScreen (), srcEvent.getClickCount (), srcEvent.isPopupTrigger (), srcEvent.getButton ());
1060 (srcEvent).copyPrivateDataInto (me);
1061 }var targetOver = this.nativeContainer.getMouseEventTarget (me.getX (), me.getY (), true);
1062 this.trackMouseEnterExit (targetOver, me);
1063 }, "java.awt.AWTEvent");
1064 Clazz.defineMethod (c$, "retargetMouseEvent", 
1065 function (target, id, e) {
1066 if (target == null) {
1067 return;
1068 }var x = e.getX ();
1069 var y = e.getY ();
1070 var component;
1071 for (component = target; component != null && component !== this.nativeContainer; component = component.getParent ()) {
1072 x -= component.x;
1073 y -= component.y;
1074 }
1075 var retargeted;
1076 if (component != null) {
1077 if (id == 507) {
1078 retargeted =  new java.awt.event.MouseWheelEvent (target, id, e.getWhen (), e.getModifiersEx () | e.getModifiers (), x, y, e.getXOnScreen (), e.getYOnScreen (), e.getClickCount (), e.isPopupTrigger (), (e).getScrollType (), (e).getScrollAmount (), (e).getWheelRotation ());
1079 } else {
1080 retargeted =  new java.awt.event.MouseEvent (target, id, e.getWhen (), e.getModifiersEx () | e.getModifiers (), x, y, e.getXOnScreen (), e.getYOnScreen (), e.getClickCount (), e.isPopupTrigger (), e.getButton ());
1081 }(e).copyPrivateDataInto (retargeted);
1082 if (target === this.nativeContainer) {
1083 (target).dispatchEventToSelf (retargeted);
1084 } else {
1085 if (this.nativeContainer.modalComp != null) {
1086 if ((this.nativeContainer.modalComp).isAncestorOf (target)) {
1087 target.dispatchEvent (retargeted);
1088 } else {
1089 e.consume ();
1090 }} else {
1091 target.dispatchEvent (retargeted);
1092 }}}}, "java.awt.Component,~N,java.awt.event.MouseEvent");
1093 Clazz.defineStatics (c$,
1094 "LWD_MOUSE_DRAGGED_OVER", 1500,
1095 "MOUSE_MASK", 131120);
1096 });