82b52eee731596590c032ae4b0f0eec86d2ae198
[jalviewjs.git] / site / swingjs / j2s / javax / swing / Popup.js
1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.awt.Frame", "javax.swing.JWindow"], "javax.swing.Popup", ["java.lang.IllegalArgumentException", "java.awt.Toolkit", "$.Window", "javax.swing.SwingUtilities", "jssun.awt.SunToolkit"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.component = null;
5 Clazz.instantialize (this, arguments);
6 }, javax.swing, "Popup");
7 Clazz.makeConstructor (c$, 
8 function (owner, contents, x, y) {
9 this.construct ();
10 if (contents == null) {
11 throw  new IllegalArgumentException ("Contents must be non-null");
12 }this.reset (owner, contents, x, y);
13 }, "java.awt.Component,java.awt.Component,~N,~N");
14 Clazz.makeConstructor (c$, 
15 function () {
16 });
17 Clazz.defineMethod (c$, "show", 
18 function () {
19 var component = this.getComponent ();
20 if (component != null) {
21 component.show ();
22 }});
23 Clazz.defineMethod (c$, "hide", 
24 function () {
25 var component = this.getComponent ();
26 if (Clazz.instanceOf (component, javax.swing.JWindow)) {
27 component.hide ();
28 (component).getContentPane ().removeAll ();
29 }this.dispose ();
30 });
31 Clazz.defineMethod (c$, "dispose", 
32 function () {
33 var component = this.getComponent ();
34 var window = javax.swing.SwingUtilities.getWindowAncestor (component);
35 if (Clazz.instanceOf (component, javax.swing.JWindow)) {
36 (component).dispose ();
37 component = null;
38 }if (Clazz.instanceOf (window, javax.swing.Popup.DefaultFrame)) {
39 window.dispose ();
40 }});
41 Clazz.defineMethod (c$, "reset", 
42 function (owner, contents, ownerX, ownerY) {
43 if (this.getComponent () == null) {
44 this.component = this.createComponent (owner);
45 }var c = this.getComponent ();
46 if (Clazz.instanceOf (c, javax.swing.JWindow)) {
47 var component = this.getComponent ();
48 component.setLocation (ownerX, ownerY);
49 component.getContentPane ().add (contents, "Center");
50 contents.invalidate ();
51 if (component.isVisible ()) {
52 this.pack ();
53 }}}, "java.awt.Component,java.awt.Component,~N,~N");
54 Clazz.defineMethod (c$, "pack", 
55 function () {
56 var component = this.getComponent ();
57 if (Clazz.instanceOf (component, java.awt.Window)) {
58 (component).pack ();
59 }});
60 Clazz.defineMethod (c$, "getParentWindow", 
61  function (owner) {
62 var window = null;
63 if (Clazz.instanceOf (owner, java.awt.Window)) {
64 window = owner;
65 } else if (owner != null) {
66 window = javax.swing.SwingUtilities.getWindowAncestor (owner);
67 }if (window == null) {
68 window =  new javax.swing.Popup.DefaultFrame ();
69 }return window;
70 }, "java.awt.Component");
71 Clazz.defineMethod (c$, "createComponent", 
72 function (owner) {
73 return  new javax.swing.Popup.HeavyWeightWindow (this.getParentWindow (owner));
74 }, "java.awt.Component");
75 Clazz.defineMethod (c$, "getComponent", 
76 function () {
77 return this.component;
78 });
79 Clazz.pu$h(self.c$);
80 c$ = Clazz.declareType (javax.swing.Popup, "HeavyWeightWindow", javax.swing.JWindow);
81 Clazz.makeConstructor (c$, 
82 function (a) {
83 Clazz.superConstructor (this, javax.swing.Popup.HeavyWeightWindow, [a]);
84 this.setFocusableWindowState (false);
85 var b = java.awt.Toolkit.getDefaultToolkit ();
86 if (Clazz.instanceOf (b, jssun.awt.SunToolkit)) {
87 (b).setOverrideRedirect (this);
88 }this.getRootPane ().setUseTrueDoubleBuffering (false);
89 try {
90 this.setAlwaysOnTop (true);
91 } catch (se) {
92 if (Clazz.exceptionOf (se, SecurityException)) {
93 } else {
94 throw se;
95 }
96 }
97 }, "java.awt.Window");
98 Clazz.overrideMethod (c$, "update", 
99 function (a) {
100 this.paint (a);
101 }, "java.awt.Graphics");
102 Clazz.defineMethod (c$, "show", 
103 function () {
104 this.pack ();
105 if (this.getWidth () > 0 && this.getHeight () > 0) {
106 Clazz.superCall (this, javax.swing.Popup.HeavyWeightWindow, "show", []);
107 }});
108 c$ = Clazz.p0p ();
109 Clazz.pu$h(self.c$);
110 c$ = Clazz.declareType (javax.swing.Popup, "DefaultFrame", java.awt.Frame);
111 c$ = Clazz.p0p ();
112 });