1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.awt.Panel", "javax.swing.Popup", "$.SwingHeavyWeight", "java.awt.BorderLayout"], "javax.swing.PopupFactory", ["java.lang.Boolean", "$.IllegalArgumentException", "java.util.ArrayList", "$.HashMap", "java.applet.Applet", "java.awt.Container", "$.Insets", "$.Rectangle", "$.Toolkit", "$.Window", "java.awt.event.WindowAdapter", "javax.swing.ClientPropertyKey", "$.JApplet", "$.JComponent", "$.JDialog", "$.JFrame", "$.JLayeredPane", "$.JPanel", "$.JPopupMenu", "$.JRootPane", "$.JSeparator", "$.JToolTip", "$.JWindow", "$.MenuElement", "javax.swing.Popup.DefaultFrame", "$.HeavyWeightWindow", "javax.swing.RootPaneContainer", "$.SwingUtilities"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 Clazz.instantialize (this, arguments);
6 }, javax.swing, "PopupFactory");
7 c$.setSharedInstance = Clazz.defineMethod (c$, "setSharedInstance",
10 throw new IllegalArgumentException ("PopupFactory can not be null");
11 }javax.swing.SwingUtilities.appContextPut (javax.swing.PopupFactory.SharedInstanceKey, factory);
12 }, "javax.swing.PopupFactory");
13 c$.getSharedInstance = Clazz.defineMethod (c$, "getSharedInstance",
15 var factory = javax.swing.SwingUtilities.appContextGet (javax.swing.PopupFactory.SharedInstanceKey);
16 if (factory == null) {
17 factory = new javax.swing.PopupFactory ();
18 javax.swing.PopupFactory.setSharedInstance (factory);
21 Clazz.defineMethod (c$, "setPopupType",
23 this.popupType = type;
25 Clazz.defineMethod (c$, "getPopupType",
27 return this.popupType;
29 Clazz.defineMethod (c$, "getPopup",
30 function (owner, contents, x, y) {
31 if (contents == null) {
32 throw new IllegalArgumentException ("Popup.getPopup must be passed non-null contents");
33 }var popupType = this.getPopupType (owner, contents, x, y);
34 var popup = this.getPopup (owner, contents, x, y, popupType);
36 popup = this.getPopup (owner, contents, x, y, 2);
38 }, "java.awt.Component,java.awt.Component,~N,~N");
39 Clazz.defineMethod (c$, "getPopupType",
40 function (owner, contents, ownerX, ownerY) {
41 var popupType = this.getPopupType ();
42 if (owner == null || this.invokerInHeavyWeightPopup (owner)) {
44 } else if (popupType == 0 && !(Clazz.instanceOf (contents, javax.swing.JToolTip)) && !(Clazz.instanceOf (contents, javax.swing.JPopupMenu))) {
48 if (Clazz.instanceOf (c, javax.swing.JComponent)) {
49 if ((c).getClientProperty (javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP) === Boolean.TRUE) {
55 }, "java.awt.Component,java.awt.Component,~N,~N");
56 Clazz.defineMethod (c$, "getPopup",
57 function (owner, contents, ownerX, ownerY, popupType) {
60 return this.getLightWeightPopup (owner, contents, ownerX, ownerY);
62 return this.getMediumWeightPopup (owner, contents, ownerX, ownerY);
64 return this.getHeavyWeightPopup (owner, contents, ownerX, ownerY);
67 }, "java.awt.Component,java.awt.Component,~N,~N,~N");
68 Clazz.defineMethod (c$, "getLightWeightPopup",
69 function (owner, contents, ownerX, ownerY) {
70 return javax.swing.PopupFactory.LightWeightPopup.getLightWeightPopup (owner, contents, ownerX, ownerY);
71 }, "java.awt.Component,java.awt.Component,~N,~N");
72 Clazz.defineMethod (c$, "getMediumWeightPopup",
73 function (owner, contents, ownerX, ownerY) {
74 return javax.swing.PopupFactory.MediumWeightPopup.getMediumWeightPopup (owner, contents, ownerX, ownerY);
75 }, "java.awt.Component,java.awt.Component,~N,~N");
76 Clazz.defineMethod (c$, "getHeavyWeightPopup",
77 function (owner, contents, ownerX, ownerY) {
78 return javax.swing.PopupFactory.HeavyWeightPopup.getHeavyWeightPopup (owner, contents, ownerX, ownerY);
79 }, "java.awt.Component,java.awt.Component,~N,~N");
80 Clazz.defineMethod (c$, "invokerInHeavyWeightPopup",
84 for (parent = i.getParent (); parent != null; parent = parent.getParent ()) {
85 if (Clazz.instanceOf (parent, javax.swing.Popup.HeavyWeightWindow)) {
89 }, "java.awt.Component");
91 c$ = Clazz.declareType (javax.swing.PopupFactory, "HeavyWeightPopup", javax.swing.Popup);
92 c$.getHeavyWeightPopup = Clazz.defineMethod (c$, "getHeavyWeightPopup",
93 function (a, b, c, d) {
94 var e = (a != null) ? javax.swing.SwingUtilities.getWindowAncestor (a) : null;
97 f = javax.swing.PopupFactory.HeavyWeightPopup.getRecycledHeavyWeightPopup (e);
99 if (b != null && b.isFocusable ()) {
100 if (Clazz.instanceOf (b, javax.swing.JPopupMenu)) {
102 var i = h.getComponents ();
103 for (var j = 0; j < i.length; j++) {
104 if (!(Clazz.instanceOf (i[j], javax.swing.MenuElement)) && !(Clazz.instanceOf (i[j], javax.swing.JSeparator))) {
108 }}if (f == null || (f.getComponent ()).getFocusableWindowState () != g) {
111 }f = new javax.swing.PopupFactory.HeavyWeightPopup ();
112 }f.reset (a, b, c, d);
114 var h = f.getComponent ();
115 h.setFocusableWindowState (true);
116 h.setName ("###focusableSwingPopup###");
118 }, "java.awt.Component,java.awt.Component,~N,~N");
119 c$.getRecycledHeavyWeightPopup = Clazz.defineMethod (c$, "getRecycledHeavyWeightPopup",
123 var c = javax.swing.PopupFactory.HeavyWeightPopup.getHeavyWeightPopupCache ();
124 if (c.containsKey (a)) {
129 if ((d = b.size ()) > 0) {
134 }}, "java.awt.Window");
135 c$.getHeavyWeightPopupCache = Clazz.defineMethod (c$, "getHeavyWeightPopupCache",
138 var a = javax.swing.SwingUtilities.appContextGet (javax.swing.PopupFactory.HeavyWeightPopup.heavyWeightPopupCacheKey);
140 a = new java.util.HashMap (2);
141 javax.swing.SwingUtilities.appContextPut (javax.swing.PopupFactory.HeavyWeightPopup.heavyWeightPopupCacheKey, a);
144 c$.recycleHeavyWeightPopup = Clazz.defineMethod (c$, "recycleHeavyWeightPopup",
148 var c = javax.swing.SwingUtilities.getWindowAncestor (a.getComponent ());
149 var d = javax.swing.PopupFactory.HeavyWeightPopup.getHeavyWeightPopupCache ();
150 if (Clazz.instanceOf (c, javax.swing.Popup.DefaultFrame) || !(c).isVisible ()) {
153 } else if (d.containsKey (c)) {
156 b = new java.util.ArrayList ();
159 e.addWindowListener (((Clazz.isClassDefined ("javax.swing.PopupFactory$HeavyWeightPopup$1") ? 0 : javax.swing.PopupFactory.HeavyWeightPopup.$PopupFactory$HeavyWeightPopup$1$ ()), Clazz.innerTypeInstance (javax.swing.PopupFactory$HeavyWeightPopup$1, this, Clazz.cloneFinals ("e", e))));
160 }if (b.size () < 5) {
164 }}}, "javax.swing.PopupFactory.HeavyWeightPopup");
165 Clazz.defineMethod (c$, "hide",
167 Clazz.superCall (this, javax.swing.PopupFactory.HeavyWeightPopup, "hide", []);
168 javax.swing.PopupFactory.HeavyWeightPopup.recycleHeavyWeightPopup (this);
170 Clazz.defineMethod (c$, "dispose",
173 Clazz.defineMethod (c$, "_dispose",
175 Clazz.superCall (this, javax.swing.PopupFactory.HeavyWeightPopup, "dispose", []);
177 c$.$PopupFactory$HeavyWeightPopup$1$ = function () {
179 c$ = Clazz.declareAnonymous (javax.swing, "PopupFactory$HeavyWeightPopup$1", java.awt.event.WindowAdapter);
180 Clazz.overrideMethod (c$, "windowClosed",
184 var c = javax.swing.PopupFactory.HeavyWeightPopup.getHeavyWeightPopupCache ();
185 b = c.remove (this.f$.e);
187 for (var c = b.size () - 1; c >= 0; c--) {
188 (b.get (c))._dispose ();
190 }}, "java.awt.event.WindowEvent");
193 c$.heavyWeightPopupCacheKey = c$.prototype.heavyWeightPopupCacheKey = new Clazz._O ();
196 c$ = Clazz.decorateAsClass (function () {
200 Clazz.instantialize (this, arguments);
201 }, javax.swing.PopupFactory, "ContainerPopup", javax.swing.Popup);
202 Clazz.overrideMethod (c$, "hide",
204 var a = this.getComponent ();
206 var b = a.getParent ();
208 var c = a.getBounds ();
210 b.repaint (c.x, c.y, c.width, c.height);
213 Clazz.overrideMethod (c$, "pack",
215 var a = this.getComponent ();
217 a.setSize (a.getPreferredSize ());
219 Clazz.defineMethod (c$, "reset",
220 function (a, b, c, d) {
221 if ((Clazz.instanceOf (a, javax.swing.JFrame)) || (Clazz.instanceOf (a, javax.swing.JDialog)) || (Clazz.instanceOf (a, javax.swing.JWindow))) {
222 a = (a).getLayeredPane ();
223 }Clazz.superCall (this, javax.swing.PopupFactory.ContainerPopup, "reset", [a, b, c, d]);
227 }, "java.awt.Component,java.awt.Component,~N,~N");
228 Clazz.defineMethod (c$, "overlappedByOwnedWindow",
230 var a = this.getComponent ();
231 if (this.owner != null && a != null) {
232 var b = javax.swing.SwingUtilities.getWindowAncestor (this.owner);
235 }var c = b.getOwnedWindows ();
237 var d = a.getBounds ();
238 for (var e = 0; e < c.length; e++) {
240 if (f.isVisible () && d.intersects (f.getBounds ())) {
245 Clazz.defineMethod (c$, "fitsOnScreen",
247 var a = this.getComponent ();
248 if (this.owner != null && a != null) {
250 var c = a.getWidth ();
251 var d = a.getHeight ();
252 for (b = this.owner.getParent (); b != null; b = b.getParent ()) {
253 if (Clazz.instanceOf (b, javax.swing.JFrame) || Clazz.instanceOf (b, javax.swing.JDialog) || Clazz.instanceOf (b, javax.swing.JWindow)) {
254 var e = b.getBounds ();
255 var f = b.getInsets ();
258 e.width -= (f.left + f.right);
259 e.height -= (f.top + f.bottom);
260 var g = b.getGraphicsConfiguration ();
261 var h = this.getContainerPopupArea (g);
262 return e.intersection (h).contains (this.x, this.y, c, d);
263 } else if (Clazz.instanceOf (b, javax.swing.JApplet)) {
264 var e = b.getBounds ();
265 var f = b.getLocationOnScreen ();
268 return e.contains (this.x, this.y, c, d);
269 } else if (Clazz.instanceOf (b, java.awt.Window) || Clazz.instanceOf (b, java.applet.Applet)) {
274 Clazz.defineMethod (c$, "getContainerPopupArea",
277 var c = java.awt.Toolkit.getDefaultToolkit ();
281 d = c.getScreenInsets (a);
283 b = new java.awt.Rectangle (c.getScreenSize ());
284 d = new java.awt.Insets (0, 0, 0, 0);
287 b.width -= (d.left + d.right);
288 b.height -= (d.top + d.bottom);
290 }, "java.awt.GraphicsConfiguration");
293 c$ = Clazz.declareType (javax.swing.PopupFactory, "LightWeightPopup", javax.swing.PopupFactory.ContainerPopup);
294 c$.getLightWeightPopup = Clazz.defineMethod (c$, "getLightWeightPopup",
295 function (a, b, c, d) {
298 e = new javax.swing.PopupFactory.LightWeightPopup ();
299 }e.reset (a, b, c, d);
300 if (!e.fitsOnScreen () || e.overlappedByOwnedWindow ()) {
304 }, "java.awt.Component,java.awt.Component,~N,~N");
305 Clazz.defineMethod (c$, "hide",
307 Clazz.superCall (this, javax.swing.PopupFactory.LightWeightPopup, "hide", []);
308 var a = this.getComponent ();
311 Clazz.overrideMethod (c$, "show",
314 if (this.owner != null) {
315 a = (Clazz.instanceOf (this.owner, java.awt.Container) ? this.owner : this.owner.getParent ());
316 }for (var b = a; b != null; b = b.getParent ()) {
317 if (Clazz.instanceOf (b, javax.swing.JRootPane)) {
318 a = (b).getLayeredPane ();
319 } else if (Clazz.instanceOf (b, java.awt.Window)) {
323 } else if (Clazz.instanceOf (b, javax.swing.JApplet)) {
326 var c = javax.swing.SwingUtilities.convertScreenLocationToParent (a, this.x, this.y);
327 var d = this.getComponent ();
328 d.setLocation (c.x, c.y);
329 if (Clazz.instanceOf (a, javax.swing.JLayeredPane)) {
330 (a).add (d, javax.swing.JLayeredPane.POPUP_LAYER, 0);
334 Clazz.overrideMethod (c$, "createComponent",
336 var b = new javax.swing.JPanel ( new java.awt.BorderLayout (), true);
339 }, "java.awt.Component");
340 Clazz.defineMethod (c$, "reset",
341 function (a, b, c, d) {
342 Clazz.superCall (this, javax.swing.PopupFactory.LightWeightPopup, "reset", [a, b, c, d]);
343 var e = this.getComponent ();
344 e.setOpaque (b.isOpaque ());
345 e.setLocation (c, d);
349 }, "java.awt.Component,java.awt.Component,~N,~N");
350 c$.lightWeightPopupCacheKey = c$.prototype.lightWeightPopupCacheKey = new Clazz._O ();
353 c$ = Clazz.decorateAsClass (function () {
354 this.rootPane = null;
355 Clazz.instantialize (this, arguments);
356 }, javax.swing.PopupFactory, "MediumWeightPopup", javax.swing.PopupFactory.ContainerPopup);
357 c$.getMediumWeightPopup = Clazz.defineMethod (c$, "getMediumWeightPopup",
358 function (a, b, c, d) {
359 var e = javax.swing.PopupFactory.MediumWeightPopup.getRecycledMediumWeightPopup ();
361 e = new javax.swing.PopupFactory.MediumWeightPopup ();
362 }e.reset (a, b, c, d);
363 if (!e.fitsOnScreen () || e.overlappedByOwnedWindow ()) {
367 }, "java.awt.Component,java.awt.Component,~N,~N");
368 c$.getMediumWeightPopupCache = Clazz.defineMethod (c$, "getMediumWeightPopupCache",
370 var a = javax.swing.SwingUtilities.appContextGet (javax.swing.PopupFactory.MediumWeightPopup.mediumWeightPopupCacheKey);
372 a = new java.util.ArrayList ();
373 javax.swing.SwingUtilities.appContextPut (javax.swing.PopupFactory.MediumWeightPopup.mediumWeightPopupCacheKey, a);
376 c$.recycleMediumWeightPopup = Clazz.defineMethod (c$, "recycleMediumWeightPopup",
379 var b = javax.swing.PopupFactory.MediumWeightPopup.getMediumWeightPopupCache ();
382 }}}, "javax.swing.PopupFactory.MediumWeightPopup");
383 c$.getRecycledMediumWeightPopup = Clazz.defineMethod (c$, "getRecycledMediumWeightPopup",
386 var a = javax.swing.PopupFactory.MediumWeightPopup.getMediumWeightPopupCache ();
388 if ((b = a.size ()) > 0) {
394 Clazz.defineMethod (c$, "hide",
396 Clazz.superCall (this, javax.swing.PopupFactory.MediumWeightPopup, "hide", []);
397 this.rootPane.getContentPane ().removeAll ();
398 javax.swing.PopupFactory.MediumWeightPopup.recycleMediumWeightPopup (this);
400 Clazz.overrideMethod (c$, "show",
402 var a = this.getComponent ();
404 if (this.owner != null) {
405 b = this.owner.getParent ();
406 }while (!(Clazz.instanceOf (b, java.awt.Window) || Clazz.instanceOf (b, java.applet.Applet)) && (b != null)) {
409 if (Clazz.instanceOf (b, javax.swing.RootPaneContainer)) {
410 b = (b).getLayeredPane ();
411 var c = javax.swing.SwingUtilities.convertScreenLocationToParent (b, this.x, this.y);
412 a.setVisible (false);
413 a.setLocation (c.x, c.y);
414 (b).add (a, javax.swing.JLayeredPane.POPUP_LAYER, 0);
416 var c = javax.swing.SwingUtilities.convertScreenLocationToParent (b, this.x, this.y);
417 a.setLocation (c.x, c.y);
418 a.setVisible (false);
420 }a.setVisible (true);
422 Clazz.overrideMethod (c$, "createComponent",
424 var b = new javax.swing.PopupFactory.MediumWeightPopup.MediumWeightComponent ();
425 this.rootPane = new javax.swing.JRootPane ();
426 this.rootPane.setOpaque (true);
427 b.add (this.rootPane, "Center");
429 }, "java.awt.Component");
430 Clazz.defineMethod (c$, "reset",
431 function (a, b, c, d) {
432 Clazz.superCall (this, javax.swing.PopupFactory.MediumWeightPopup, "reset", [a, b, c, d]);
433 var e = this.getComponent ();
434 e.setLocation (c, d);
435 this.rootPane.getContentPane ().add (b, "Center");
439 }, "java.awt.Component,java.awt.Component,~N,~N");
441 c$ = Clazz.declareType (javax.swing.PopupFactory.MediumWeightPopup, "MediumWeightComponent", java.awt.Panel, javax.swing.SwingHeavyWeight);
442 Clazz.makeConstructor (c$,
444 Clazz.superConstructor (this, javax.swing.PopupFactory.MediumWeightPopup.MediumWeightComponent, [ new java.awt.BorderLayout ()]);
447 c$.mediumWeightPopupCacheKey = c$.prototype.mediumWeightPopupCacheKey = new Clazz._O ();
449 c$.SharedInstanceKey = c$.prototype.SharedInstanceKey = new Clazz._O ();
450 Clazz.defineStatics (c$,
452 "LIGHT_WEIGHT_POPUP", 0,
453 "MEDIUM_WEIGHT_POPUP", 1,
454 "HEAVY_WEIGHT_POPUP", 2);