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 () {
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$,
22 Clazz.superConstructor (this, java.awt.Container, []);
23 this.component = new java.util.ArrayList ();
25 Clazz.defineMethod (c$, "initializeFocusTraversalKeys",
28 Clazz.defineMethod (c$, "getComponentCount",
30 return this.countComponents ();
32 Clazz.defineMethod (c$, "countComponents",
34 return this.component.size ();
36 Clazz.defineMethod (c$, "getComponent",
38 if ((n < 0) || (n >= this.component.size ())) {
39 throw new ArrayIndexOutOfBoundsException ("No such child: " + n);
40 }return this.component.get (n);
42 Clazz.defineMethod (c$, "getComponents",
44 return this.getComponents_NoClientCode ();
46 Clazz.defineMethod (c$, "getComponents_NoClientCode",
48 return this.component.toArray (java.awt.Container.EMPTY_ARRAY);
50 Clazz.defineMethod (c$, "getInsets",
53 if (Clazz.instanceOf (peer, java.awt.peer.ContainerPeer)) {
55 return cpeer.getInsets ().clone ();
56 }return new java.awt.Insets (0, 0, 0, 0);
58 Clazz.defineMethod (c$, "add",
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",
72 if (Clazz.instanceOf (comp, java.awt.Container)) {
73 for (var cn = this; cn != null; cn = cn.parent) {
75 throw new IllegalArgumentException ("adding container's parent to itself");
77 }}, "java.awt.Component");
78 Clazz.defineMethod (c$, "checkNotAWindow",
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) {
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 ()));
96 this.component.remove (index);
97 this.invalidateIfValid ();
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 ())) {
115 if (this.parent != null) {
116 return this.parent.canContainFocusOwner (focusOwnerCandidate);
118 }, "java.awt.Component");
119 Clazz.defineMethod (c$, "hasHeavyweightDescendants",
121 return this.numOfHWComponents > 0;
123 Clazz.defineMethod (c$, "hasLightweightDescendants",
125 return this.numOfLWComponents > 0;
127 Clazz.defineMethod (c$, "getHeavyweightContainer",
129 if (this.peer != null && !(Clazz.instanceOf (this.peer, java.awt.peer.LightweightPeer))) {
132 return this.getNativeContainer ();
134 c$.isRemoveNotifyNeeded = Clazz.defineMethod (c$, "isRemoveNotifyNeeded",
135 function (comp, oldContainer, newContainer) {
137 }, "java.awt.Component,java.awt.Container,java.awt.Container");
138 Clazz.defineMethod (c$, "setComponentZOrder",
139 function (comp, index) {
141 var curParent = comp.parent;
142 var oldZindex = this.getComponentZOrder (comp);
143 if (curParent === this && index == oldZindex) {
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);
159 comp.getPeer ().reparent (parentPeer);
161 }, "java.awt.peer.ContainerPeer,java.awt.Container");
162 Clazz.defineMethod (c$, "reparentChild",
166 }if (comp.isLightweight ()) {
167 if (Clazz.instanceOf (comp, java.awt.Container)) {
168 this.reparentTraverse (this.getPeer (), comp);
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) {
177 this.component.add (comp);
179 this.component.add (index, comp);
181 this.adjustListeningChildren (32768, comp.numListening (32768));
182 this.adjustListeningChildren (65536, comp.numListening (65536));
183 this.adjustDescendants (comp.countHierarchyMembers ());
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) {
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);
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));
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",
216 Clazz.defineMethod (c$, "getComponentZOrder",
221 if (comp.parent !== this) {
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) {
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");
249 this.component.add (comp);
251 this.component.add (index, comp);
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) {
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 ();
271 }, "java.awt.Component,~O,~N");
272 Clazz.defineMethod (c$, "checkGD",
273 function (stringID) {
275 Clazz.defineMethod (c$, "remove",
277 this.removeInt (index);
279 Clazz.defineMethod (c$, "removeInt",
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 ()));
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 ();
302 Clazz.defineMethod (c$, "remove",
304 this.removeChild (comp);
305 }, "java.awt.Component");
306 Clazz.defineMethod (c$, "removeChild",
309 if (comp.parent === this) {
310 var index = this.component.indexOf (comp);
313 }}}}, "java.awt.Component");
314 Clazz.defineMethod (c$, "removeAll",
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);
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));
332 if (this.peer != null && this.layoutMgr == null && this.isVisible ()) {
333 this.updateCursorImmediately ();
334 }this.invalidateIfValid ();
336 Clazz.defineMethod (c$, "numListening",
338 var superListening = this.numListeningMask (mask);
340 return this.listeningChildren + superListening;
341 } else if (mask == 65536) {
342 return this.listeningBoundsChildren + superListening;
344 return superListening;
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);
355 Clazz.defineMethod (c$, "adjustDescendants",
357 if (num == 0) return;
358 this.descendantsCount += num;
359 this.adjustDecendantsOnParent (num);
361 Clazz.defineMethod (c$, "adjustDecendantsOnParent",
363 if (this.parent != null) {
364 this.parent.adjustDescendants (num);
366 Clazz.defineMethod (c$, "countHierarchyMembers",
368 return this.descendantsCount + 1;
370 Clazz.defineMethod (c$, "getListenersCount",
371 function (id, enabledOnToolkit) {
372 if (enabledOnToolkit) {
373 return this.descendantsCount;
376 return this.listeningChildren;
379 return this.listeningBoundsChildren;
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);
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 ()) {
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);
401 Clazz.defineMethod (c$, "getLayout",
403 return this.layoutMgr;
405 Clazz.defineMethod (c$, "setLayout",
407 this.layoutMgr = mgr;
408 this.invalidateIfValid ();
409 }, "java.awt.LayoutManager");
410 Clazz.overrideMethod (c$, "doLayout",
414 Clazz.overrideMethod (c$, "layout",
416 var layoutMgr = this.layoutMgr;
417 if (layoutMgr != null) {
418 layoutMgr.layoutContainer (this);
420 Clazz.overrideMethod (c$, "invalidate",
422 var layoutMgr = this.layoutMgr;
423 if (Clazz.instanceOf (layoutMgr, java.awt.LayoutManager2)) {
425 lm.invalidateLayout (this);
426 }this.invalidateComp ();
428 Clazz.overrideMethod (c$, "validate",
430 if (!this.isValid ()) {
431 var updateCur = false;
433 if (!this.isValid () && this.peer != null) {
435 if (Clazz.instanceOf (this.peer, java.awt.peer.ContainerPeer)) {
439 }this.validateTree ();
442 updateCur = this.isVisible ();
444 this.updateCursorImmediately ();
446 Clazz.defineMethod (c$, "validateTree",
448 if (!this.isValid ()) {
449 if (Clazz.instanceOf (this.peer, java.awt.peer.ContainerPeer)) {
450 (this.peer).beginLayout ();
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 ();
459 if (Clazz.instanceOf (this.peer, java.awt.peer.ContainerPeer)) {
460 (this.peer).endLayout ();
461 }}this.validateComponent ();
463 Clazz.defineMethod (c$, "invalidateTree",
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 ();
471 comp.invalidateIfValid ();
473 this.invalidateIfValid ();
475 Clazz.overrideMethod (c$, "setFont",
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",
485 return this.preferredSize ();
487 Clazz.overrideMethod (c$, "preferredSize",
489 var dim = this.prefSize;
490 if (dim == null || !(this.isPreferredSizeSet () || this.isValid ())) {
492 this.prefSize = (this.layoutMgr != null) ? this.layoutMgr.preferredLayoutSize (this) : this.prefSizeComp ();
494 }}return (dim == null ? null : new java.awt.Dimension (dim));
496 Clazz.overrideMethod (c$, "getMinimumSize",
498 var dim = this.minSize;
499 if (dim == null || !(this.isMinimumSizeSet () || this.isValid ())) {
501 this.minSize = (this.layoutMgr != null) ? this.layoutMgr.minimumLayoutSize (this) : this.minimumSize ();
504 return new java.awt.Dimension (dim);
508 Clazz.overrideMethod (c$, "getMaximumSize",
510 var dim = this.maxSize;
511 if (dim == null || !(this.isMaximumSizeSet () || this.isValid ())) {
513 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
514 var lm = this.layoutMgr;
515 this.maxSize = lm.maximumLayoutSize (this);
517 this.maxSize = this.getMaxSizeComp ();
520 return new java.awt.Dimension (dim);
524 Clazz.overrideMethod (c$, "getAlignmentX",
527 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
529 var lm = this.layoutMgr;
530 xAlign = lm.getLayoutAlignmentX (this);
532 xAlign = this.getAlignmentXComp ();
535 Clazz.overrideMethod (c$, "getAlignmentY",
538 if (Clazz.instanceOf (this.layoutMgr, java.awt.LayoutManager2)) {
540 var lm = this.layoutMgr;
541 yAlign = lm.getLayoutAlignmentY (this);
543 yAlign = this.getAlignmentYComp ();
546 Clazz.overrideMethod (c$, "paint",
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",
552 if (this.isShowing ()) {
553 g.clearRect (0, 0, this.width, this.height);
555 }}, "java.awt.Graphics");
556 Clazz.defineMethod (c$, "paintComponents",
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",
563 this.lwPaintComp (g);
564 this.paintHeavyweightComponents (g);
565 }, "java.awt.Graphics");
566 Clazz.overrideMethod (c$, "paintHeavyweightComponents",
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",
575 }this.containerListener = java.awt.AWTEventMulticaster.add (this.containerListener, l);
576 this.newEventsOnly = true;
577 }, "java.awt.event.ContainerListener");
578 Clazz.defineMethod (c$, "removeContainerListener",
582 }this.containerListener = java.awt.AWTEventMulticaster.remove (this.containerListener, l);
583 }, "java.awt.event.ContainerListener");
584 Clazz.defineMethod (c$, "getContainerListeners",
586 return (this.getListeners (java.awt.event.ContainerListener));
588 Clazz.overrideMethod (c$, "getListeners",
589 function (listenerType) {
591 if (listenerType === java.awt.event.ContainerListener) {
592 l = this.containerListener;
594 return this.getListenersComp (listenerType);
595 }return java.awt.AWTEventMulticaster.getListeners (l, listenerType);
597 Clazz.overrideMethod (c$, "eventEnabled",
600 if (id == 300 || id == 301) {
601 if ((this.eventMask & 2) != 0 || this.containerListener != null) {
604 }return this.eventTypeEnabled (e.id);
605 }, "java.awt.AWTEvent");
606 Clazz.overrideMethod (c$, "processEvent",
608 this.processEventCont (e);
609 }, "java.awt.AWTEvent");
610 Clazz.defineMethod (c$, "processEventCont",
612 if (Clazz.instanceOf (e, java.awt.event.ContainerEvent)) {
613 this.processContainerEvent (e);
615 }this.processEventComp (e);
616 }, "java.awt.AWTEvent");
617 Clazz.defineMethod (c$, "processContainerEvent",
619 var listener = this.containerListener;
620 if (listener != null) {
621 switch (e.getID ()) {
623 listener.componentAdded (e);
626 listener.componentRemoved (e);
629 }}, "java.awt.event.ContainerEvent");
630 Clazz.overrideMethod (c$, "dispatchEventImpl",
632 if ((this.dispatcher != null) && this.dispatcher.dispatchEvent (e)) {
634 if (this.peer != null) {
635 this.peer.handleEvent (e);
637 }this.dispatchEventImplComp (e);
639 switch (e.getID ()) {
647 }}, "java.awt.AWTEvent");
648 Clazz.defineMethod (c$, "dispatchEventToSelf",
650 this.dispatchEventImplComp (e);
651 }, "java.awt.AWTEvent");
652 Clazz.defineMethod (c$, "getMouseEventTarget",
653 function (x, y, includeSelf, filter, searchHeavyweights) {
655 if (arguments.length == 3) {
656 filter = java.awt.Container.MouseEventTargetFilter.FILTER;
657 searchHeavyWeights = false;
660 if (comp == null || comp === this) {
661 comp = this.getMouseEventTargetImpl (x, y, includeSelf, filter, false, searchHeavyweights);
663 }, "~N,~N,~B,java.awt.Container.EventTargetFilter,~B");
664 Clazz.defineMethod (c$, "getMouseEventTargetImpl",
665 function (x, y, includeSelf, filter, searchHeavyweightChildren, searchHeavyweightDescendants) {
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)) {
672 var deeper = child.getMouseEventTarget (x - child.x, y - child.y, includeSelf, filter, searchHeavyweightDescendants);
673 if (deeper != null) {
676 if (filter.accept (comp)) {
681 isPeerOK = includeSelf;
682 isMouseOverMe = this.contains (x, y);
683 if (isMouseOverMe && isPeerOK && filter.accept (this)) {
686 }}, "~N,~N,~B,java.awt.Container.EventTargetFilter,~B,~B");
687 Clazz.defineMethod (c$, "proxyEnableEvents",
689 if (this.parent != null) {
690 this.parent.proxyEnableEvents (events);
691 }if (this.dispatcher != null) {
692 this.dispatcher.enableEvents (events);
694 Clazz.defineMethod (c$, "deliverEvent",
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);
702 }}, "java.awt.Event");
703 Clazz.defineMethod (c$, "getComponentAt",
705 return this.locate (x, y);
707 Clazz.overrideMethod (c$, "locate",
711 Clazz.defineMethod (c$, "getComponentAt",
713 return this.getComponentAt (p.x, p.y);
714 }, "java.awt.Point");
715 Clazz.defineMethod (c$, "getMousePosition",
716 function (allowChildren) {
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",
726 return this.findComponentAt (x, y, true);
728 Clazz.defineMethod (c$, "findComponentAt",
729 function (x, y, ignoreEnabled) {
732 Clazz.defineMethod (c$, "findComponentAt",
734 return this.findComponentAt (p.x, p.y);
735 }, "java.awt.Point");
736 Clazz.defineMethod (c$, "addNotify",
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 ();
746 Clazz.defineMethod (c$, "setDispatcher",
748 this.dispatcher = new java.awt.LightweightDispatcher (this);
750 Clazz.defineMethod (c$, "removeNotify",
752 for (var i = this.component.size () - 1; i >= 0; i--) {
753 var comp = this.component.get (i);
755 comp.setAutoFocusTransferOnDisposal (false);
756 comp.removeNotify ();
757 comp.setAutoFocusTransferOnDisposal (true);
759 if (this.dispatcher != null) {
760 this.dispatcher.dispose ();
761 this.dispatcher = null;
762 }this.removeNotifyComp ();
764 Clazz.defineMethod (c$, "isAncestorOf",
767 if (c == null || ((p = c.getParent ()) == null)) {
775 }, "java.awt.Component");
776 Clazz.overrideMethod (c$, "paramString",
778 var str = this.paramStringComp ();
779 var layoutMgr = this.layoutMgr;
780 if (layoutMgr != null) {
781 str += ",layout=" + layoutMgr.getClass ().getName ();
784 Clazz.defineMethod (c$, "setFocusTraversalKeys",
785 function (id, keystrokes) {
786 }, "~N,java.util.Set");
787 Clazz.defineMethod (c$, "getFocusTraversalKeys",
791 Clazz.defineMethod (c$, "areFocusTraversalKeysSet",
795 Clazz.defineMethod (c$, "isFocusCycleRoot",
796 function (container) {
797 if (this.isFocusCycleRoot () && container === this) {
800 return this.isFocusCycleRootComp (container);
801 }}, "java.awt.Container");
802 Clazz.overrideMethod (c$, "containsFocus",
806 Clazz.defineMethod (c$, "isParentOf",
809 while (comp != null && comp !== this && !(Clazz.instanceOf (comp, java.awt.Window))) {
810 comp = comp.getParent ();
812 return (comp === this);
813 }}, "java.awt.Component");
814 Clazz.defineMethod (c$, "clearMostRecentFocusOwnerOnHide",
817 Clazz.overrideMethod (c$, "clearCurrentFocusCycleRootOnHide",
820 Clazz.defineMethod (c$, "getTraversalRoot",
824 Clazz.defineMethod (c$, "isFocusCycleRoot",
826 return this.focusCycleRoot;
828 Clazz.defineMethod (c$, "setFocusTraversalPolicyProvider",
829 function (provider) {
832 oldProvider = this.focusTraversalPolicyProvider;
833 this.focusTraversalPolicyProvider = provider;
834 }this.firePropertyChangeBool ("focusTraversalPolicyProvider", oldProvider, provider);
836 Clazz.defineMethod (c$, "isFocusTraversalPolicyProvider",
838 return this.focusTraversalPolicyProvider;
840 Clazz.defineMethod (c$, "transferFocusDownCycle",
843 Clazz.defineMethod (c$, "preProcessKeyEvent",
845 var parent = this.parent;
846 if (parent != null) {
847 parent.preProcessKeyEvent (e);
848 }}, "java.awt.event.KeyEvent");
849 Clazz.defineMethod (c$, "postProcessKeyEvent",
851 var parent = this.parent;
852 if (parent != null) {
853 parent.postProcessKeyEvent (e);
854 }}, "java.awt.event.KeyEvent");
855 Clazz.overrideMethod (c$, "postsOldMouseEvents",
859 Clazz.defineMethod (c$, "applyComponentOrientation",
861 this.applyCompOrientComp (o);
863 for (var i = 0; i < this.component.size (); i++) {
864 var comp = this.component.get (i);
865 comp.applyComponentOrientation (o);
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",
878 if (!c.isDisplayable ()) {
879 throw new IllegalStateException ("Peer does not exist while invoking the increaseComponentCount() method");
882 if (Clazz.instanceOf (c, java.awt.Container)) {
883 addLW = (c).numOfLWComponents;
884 addHW = (c).numOfHWComponents;
885 }if (c.isLightweight ()) {
889 }for (var cont = this; cont != null; cont = cont.getContainer ()) {
890 cont.numOfLWComponents += addLW;
891 cont.numOfHWComponents += addHW;
893 }, "java.awt.Component");
894 Clazz.defineMethod (c$, "decreaseComponentCount",
896 if (!c.isDisplayable ()) {
897 throw new IllegalStateException ("Peer does not exist while invoking the decreaseComponentCount() method");
900 if (Clazz.instanceOf (c, java.awt.Container)) {
901 subLW = (c).numOfLWComponents;
902 subHW = (c).numOfHWComponents;
903 }if (c.isLightweight ()) {
907 }for (var cont = this; cont != null; cont = cont.getContainer ()) {
908 cont.numOfLWComponents -= subLW;
909 cont.numOfHWComponents -= subHW;
911 }, "java.awt.Component");
912 Clazz.declareInterface (java.awt.Container, "EventTargetFilter");
914 c$ = Clazz.declareType (java.awt.Container, "MouseEventTargetFilter", null, java.awt.Container.EventTargetFilter);
915 Clazz.makeConstructor (c$,
918 Clazz.overrideMethod (c$, "accept",
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 ();
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;
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;
941 }, "java.awt.Container");
942 Clazz.defineMethod (c$, "dispose",
944 this.stopListeningForOtherDrags ();
945 this.mouseEventTarget = null;
947 Clazz.defineMethod (c$, "enableEvents",
949 this.eventMask |= events;
951 Clazz.defineMethod (c$, "dispatchEvent",
954 if (Clazz.instanceOf (e, java.awt.event.MouseEvent) && (this.eventMask & 131120) != 0) {
956 ret = this.processMouseEvent (me);
958 }, "java.awt.AWTEvent");
959 Clazz.defineMethod (c$, "isMouseGrab",
961 var modifiers = e.getModifiersEx ();
962 if (e.getID () == 501 || e.getID () == 502) {
963 switch (e.getButton ()) {
974 }return ((modifiers & (7168)) != 0);
975 }, "java.awt.event.MouseEvent");
976 Clazz.defineMethod (c$, "processMouseEvent",
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) {
989 this.retargetMouseEvent (this.mouseEventTarget, id, e);
992 this.retargetMouseEvent (this.mouseEventTarget, id, e);
995 if (mouseOver === this.mouseEventTarget) {
996 this.retargetMouseEvent (mouseOver, id, e);
999 this.retargetMouseEvent (this.mouseEventTarget, id, e);
1002 if (this.isMouseGrab (e)) {
1003 this.retargetMouseEvent (this.mouseEventTarget, id, e);
1006 this.retargetMouseEvent (mouseOver, id, e);
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) {
1026 }if (this.targetLastEntered != null) {
1027 this.retargetMouseEvent (this.targetLastEntered, 505, e);
1030 }if (targetEnter != null) {
1031 this.retargetMouseEvent (targetEnter, 504, e);
1034 }this.targetLastEntered = targetEnter;
1035 }, "java.awt.Component,java.awt.event.MouseEvent");
1036 Clazz.defineMethod (c$, "startListeningForOtherDrags",
1039 Clazz.defineMethod (c$, "stopListeningForOtherDrags",
1042 Clazz.overrideMethod (c$, "eventDispatched",
1044 var isForeignDrag = (Clazz.instanceOf (e, java.awt.event.MouseEvent)) && (e.id == 506) && (e.getSource () !== this.nativeContainer);
1045 if (!isForeignDrag) {
1050 var srcComponent = srcEvent.getComponent ();
1051 if (!srcComponent.isShowing ()) {
1053 }var c = this.nativeContainer;
1054 while ((c != null) && !(Clazz.instanceOf (c, java.awt.Window))) {
1055 c = c.getParent_NoClientCode ();
1057 if ((c == null) || (c).isModalBlocked ()) {
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) {
1071 for (component = target; component != null && component !== this.nativeContainer; component = component.getParent ()) {
1076 if (component != null) {
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 ());
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);
1085 if (this.nativeContainer.modalComp != null) {
1086 if ((this.nativeContainer.modalComp).isAncestorOf (target)) {
1087 target.dispatchEvent (retargeted);
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);