c55a0a0984cb3c060233533bda8d9ca775f497ed
[jalviewjs.git] / site / j2s / javax / swing / SwingUtilities.js
1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.awt.Frame", "java.awt.event.WindowListener", "javax.swing.SwingConstants"], "javax.swing.SwingUtilities", ["java.lang.Character", "$.Error", "$.Thread", "java.applet.Applet", "java.awt.Component", "$.Container", "$.EventQueue", "$.Point", "$.Rectangle", "$.Window", "java.awt.event.ActionEvent", "$.MouseEvent", "$.MouseWheelEvent", "javax.swing.JComponent", "javax.swing.JComponent.ActionStandin", "javax.swing.JRootPane", "$.RootPaneContainer", "javax.swing.event.MenuDragMouseEvent", "javax.swing.plaf.UIResource", "jssun.awt.AppContext", "jssun.swing.UIAction", "swingjs.api.Interface"], function () {
3 c$ = Clazz.declareType (javax.swing, "SwingUtilities", null, javax.swing.SwingConstants);
4 c$.installSwingDropTargetAsNecessary = Clazz.defineMethod (c$, "installSwingDropTargetAsNecessary", 
5 function (c, t) {
6 }, "java.awt.Component,javax.swing.TransferHandler");
7 c$.isRectangleContainingRectangle = Clazz.defineMethod (c$, "isRectangleContainingRectangle", 
8 function (a, b) {
9 if (b.x >= a.x && (b.x + b.width) <= (a.x + a.width) && b.y >= a.y && (b.y + b.height) <= (a.y + a.height)) {
10 return true;
11 }return false;
12 }, "java.awt.Rectangle,java.awt.Rectangle");
13 c$.getLocalBounds = Clazz.defineMethod (c$, "getLocalBounds", 
14 function (aComponent) {
15 var b =  new java.awt.Rectangle (aComponent.getBounds ());
16 b.x = b.y = 0;
17 return b;
18 }, "java.awt.Component");
19 c$.getWindowAncestor = Clazz.defineMethod (c$, "getWindowAncestor", 
20 function (c) {
21 for (var p = c.getParent (); p != null; p = p.getParent ()) {
22 if (Clazz.instanceOf (p, java.awt.Window)) {
23 return p;
24 }}
25 return null;
26 }, "java.awt.Component");
27 c$.convertScreenLocationToParent = Clazz.defineMethod (c$, "convertScreenLocationToParent", 
28 function (parent, x, y) {
29 for (var p = parent; p != null; p = p.getParent ()) {
30 if (Clazz.instanceOf (p, java.awt.Window)) {
31 var point =  new java.awt.Point (x, y);
32 javax.swing.SwingUtilities.convertPointFromScreen (point, parent);
33 return point;
34 }}
35 throw  new Error ("convertScreenLocationToParent: no window ancestor");
36 }, "java.awt.Container,~N,~N");
37 c$.convertPoint = Clazz.defineMethod (c$, "convertPoint", 
38 function (source, aPoint, destination) {
39 var p;
40 if (source == null && destination == null) return aPoint;
41 if (source == null) {
42 source = javax.swing.SwingUtilities.getWindowAncestor (destination);
43 if (source == null) throw  new Error ("Source component not connected to component tree hierarchy");
44 }p =  new java.awt.Point (aPoint);
45 javax.swing.SwingUtilities.convertPointToScreen (p, source);
46 if (destination == null) {
47 destination = javax.swing.SwingUtilities.getWindowAncestor (source);
48 if (destination == null) throw  new Error ("Destination component not connected to component tree hierarchy");
49 }javax.swing.SwingUtilities.convertPointFromScreen (p, destination);
50 return p;
51 }, "java.awt.Component,java.awt.Point,java.awt.Component");
52 c$.convertPoint = Clazz.defineMethod (c$, "convertPoint", 
53 function (source, x, y, destination) {
54 var point =  new java.awt.Point (x, y);
55 return javax.swing.SwingUtilities.convertPoint (source, point, destination);
56 }, "java.awt.Component,~N,~N,java.awt.Component");
57 c$.convertRectangle = Clazz.defineMethod (c$, "convertRectangle", 
58 function (source, aRectangle, destination) {
59 var point =  new java.awt.Point (aRectangle.x, aRectangle.y);
60 point = javax.swing.SwingUtilities.convertPoint (source, point, destination);
61 return  new java.awt.Rectangle (point.x, point.y, aRectangle.width, aRectangle.height);
62 }, "java.awt.Component,java.awt.Rectangle,java.awt.Component");
63 c$.getAncestorOfClass = Clazz.defineMethod (c$, "getAncestorOfClass", 
64 function (c, comp) {
65 if (comp == null || c == null) return null;
66 var parent = comp.getParent ();
67 while (parent != null && !(c.isInstance (parent))) parent = parent.getParent ();
68
69 return parent;
70 }, "Class,java.awt.Component");
71 c$.getAncestorNamed = Clazz.defineMethod (c$, "getAncestorNamed", 
72 function (name, comp) {
73 if (comp == null || name == null) return null;
74 var parent = comp.getParent ();
75 while (parent != null && !(name.equals (parent.getName ()))) parent = parent.getParent ();
76
77 return parent;
78 }, "~S,java.awt.Component");
79 c$.getDeepestComponentAt = Clazz.defineMethod (c$, "getDeepestComponentAt", 
80 function (parent, x, y) {
81 if (!parent.contains (x, y)) {
82 return null;
83 }if (Clazz.instanceOf (parent, java.awt.Container)) {
84 var components = (parent).getComponents ();
85 for (var i = 0; i < components.length; i++) {
86 var comp = components[i];
87 if (comp != null && comp.isVisible ()) {
88 var loc = comp.getLocation ();
89 if (Clazz.instanceOf (comp, java.awt.Container)) {
90 comp = javax.swing.SwingUtilities.getDeepestComponentAt (comp, x - loc.x, y - loc.y);
91 } else {
92 comp = comp.getComponentAt (x - loc.x, y - loc.y);
93 }if (comp != null && comp.isVisible ()) {
94 return comp;
95 }}}
96 }return parent;
97 }, "java.awt.Component,~N,~N");
98 c$.convertMouseEvent = Clazz.defineMethod (c$, "convertMouseEvent", 
99 function (source, sourceEvent, destination) {
100 var p = javax.swing.SwingUtilities.convertPoint (source,  new java.awt.Point (sourceEvent.getX (), sourceEvent.getY ()), destination);
101 var newSource;
102 if (destination != null) newSource = destination;
103  else newSource = source;
104 var newEvent;
105 if (Clazz.instanceOf (sourceEvent, java.awt.event.MouseWheelEvent)) {
106 var sourceWheelEvent = sourceEvent;
107 newEvent =  new java.awt.event.MouseWheelEvent (newSource, sourceWheelEvent.getID (), sourceWheelEvent.getWhen (), sourceWheelEvent.getModifiers (), p.x, p.y, sourceWheelEvent.getXOnScreen (), sourceWheelEvent.getYOnScreen (), sourceWheelEvent.getClickCount (), sourceWheelEvent.isPopupTrigger (), sourceWheelEvent.getScrollType (), sourceWheelEvent.getScrollAmount (), sourceWheelEvent.getWheelRotation ());
108 } else if (Clazz.instanceOf (sourceEvent, javax.swing.event.MenuDragMouseEvent)) {
109 var sourceMenuDragEvent = sourceEvent;
110 newEvent =  new javax.swing.event.MenuDragMouseEvent (newSource, sourceMenuDragEvent.getID (), sourceMenuDragEvent.getWhen (), sourceMenuDragEvent.getModifiers (), p.x, p.y, sourceMenuDragEvent.getXOnScreen (), sourceMenuDragEvent.getYOnScreen (), sourceMenuDragEvent.getClickCount (), sourceMenuDragEvent.isPopupTrigger (), sourceMenuDragEvent.getPath (), sourceMenuDragEvent.getMenuSelectionManager ());
111 } else {
112 newEvent =  new java.awt.event.MouseEvent (newSource, sourceEvent.getID (), sourceEvent.getWhen (), sourceEvent.getModifiers (), p.x, p.y, sourceEvent.getXOnScreen (), sourceEvent.getYOnScreen (), sourceEvent.getClickCount (), sourceEvent.isPopupTrigger (), 0);
113 }return newEvent;
114 }, "java.awt.Component,java.awt.event.MouseEvent,java.awt.Component");
115 c$.convertPointToScreen = Clazz.defineMethod (c$, "convertPointToScreen", 
116 function (p, c) {
117 var x;
118 var y;
119 do {
120 if (Clazz.instanceOf (c, javax.swing.JComponent)) {
121 x = (c).getX ();
122 y = (c).getY ();
123 } else if (Clazz.instanceOf (c, java.applet.Applet) || Clazz.instanceOf (c, java.awt.Window)) {
124 try {
125 var pp = c.getLocationOnScreen ();
126 x = pp.x;
127 y = pp.y;
128 } catch (icse) {
129 if (Clazz.exceptionOf (icse, java.awt.IllegalComponentStateException)) {
130 x = c.getX ();
131 y = c.getY ();
132 } else {
133 throw icse;
134 }
135 }
136 } else {
137 x = c.getX ();
138 y = c.getY ();
139 }p.x += x;
140 p.y += y;
141 if (Clazz.instanceOf (c, java.awt.Window) || Clazz.instanceOf (c, java.applet.Applet)) break;
142 c = c.getParent ();
143 } while (c != null);
144 }, "java.awt.Point,java.awt.Component");
145 c$.convertPointFromScreen = Clazz.defineMethod (c$, "convertPointFromScreen", 
146 function (p, c) {
147 var x;
148 var y;
149 do {
150 if (Clazz.instanceOf (c, javax.swing.JComponent)) {
151 x = (c).getX ();
152 y = (c).getY ();
153 } else if (Clazz.instanceOf (c, java.applet.Applet) || Clazz.instanceOf (c, java.awt.Window)) {
154 try {
155 var pp = c.getLocationOnScreen ();
156 x = pp.x;
157 y = pp.y;
158 } catch (icse) {
159 if (Clazz.exceptionOf (icse, java.awt.IllegalComponentStateException)) {
160 x = c.getX ();
161 y = c.getY ();
162 } else {
163 throw icse;
164 }
165 }
166 } else {
167 x = c.getX ();
168 y = c.getY ();
169 }p.x -= x;
170 p.y -= y;
171 if (Clazz.instanceOf (c, java.awt.Window) || Clazz.instanceOf (c, java.applet.Applet)) break;
172 c = c.getParent ();
173 } while (c != null);
174 }, "java.awt.Point,java.awt.Component");
175 c$.windowForComponent = Clazz.defineMethod (c$, "windowForComponent", 
176 function (c) {
177 return javax.swing.SwingUtilities.getWindowAncestor (c);
178 }, "java.awt.Component");
179 c$.isDescendingFrom = Clazz.defineMethod (c$, "isDescendingFrom", 
180 function (a, b) {
181 if (a === b) return true;
182 for (var p = a.getParent (); p != null; p = p.getParent ()) if (p === b) return true;
183
184 return false;
185 }, "java.awt.Component,java.awt.Component");
186 c$.computeIntersection = Clazz.defineMethod (c$, "computeIntersection", 
187 function (x, y, width, height, dest) {
188 var x1 = (x > dest.x) ? x : dest.x;
189 var x2 = ((x + width) < (dest.x + dest.width)) ? (x + width) : (dest.x + dest.width);
190 var y1 = (y > dest.y) ? y : dest.y;
191 var y2 = ((y + height) < (dest.y + dest.height) ? (y + height) : (dest.y + dest.height));
192 dest.x = x1;
193 dest.y = y1;
194 dest.width = x2 - x1;
195 dest.height = y2 - y1;
196 if (dest.width < 0 || dest.height < 0) {
197 dest.x = dest.y = dest.width = dest.height = 0;
198 }return dest;
199 }, "~N,~N,~N,~N,java.awt.Rectangle");
200 c$.computeUnion = Clazz.defineMethod (c$, "computeUnion", 
201 function (x, y, width, height, dest) {
202 var x1 = (x < dest.x) ? x : dest.x;
203 var x2 = ((x + width) > (dest.x + dest.width)) ? (x + width) : (dest.x + dest.width);
204 var y1 = (y < dest.y) ? y : dest.y;
205 var y2 = ((y + height) > (dest.y + dest.height)) ? (y + height) : (dest.y + dest.height);
206 dest.x = x1;
207 dest.y = y1;
208 dest.width = (x2 - x1);
209 dest.height = (y2 - y1);
210 return dest;
211 }, "~N,~N,~N,~N,java.awt.Rectangle");
212 c$.computeDifference = Clazz.defineMethod (c$, "computeDifference", 
213 function (rectA, rectB) {
214 if (rectB == null || !rectA.intersects (rectB) || javax.swing.SwingUtilities.isRectangleContainingRectangle (rectB, rectA)) {
215 return  new Array (0);
216 }var t =  new java.awt.Rectangle ();
217 var a = null;
218 var b = null;
219 var c = null;
220 var d = null;
221 var result;
222 var rectCount = 0;
223 if (javax.swing.SwingUtilities.isRectangleContainingRectangle (rectA, rectB)) {
224 t.x = rectA.x;
225 t.y = rectA.y;
226 t.width = rectB.x - rectA.x;
227 t.height = rectA.height;
228 if (t.width > 0 && t.height > 0) {
229 a =  new java.awt.Rectangle (t);
230 rectCount++;
231 }t.x = rectB.x;
232 t.y = rectA.y;
233 t.width = rectB.width;
234 t.height = rectB.y - rectA.y;
235 if (t.width > 0 && t.height > 0) {
236 b =  new java.awt.Rectangle (t);
237 rectCount++;
238 }t.x = rectB.x;
239 t.y = rectB.y + rectB.height;
240 t.width = rectB.width;
241 t.height = rectA.y + rectA.height - (rectB.y + rectB.height);
242 if (t.width > 0 && t.height > 0) {
243 c =  new java.awt.Rectangle (t);
244 rectCount++;
245 }t.x = rectB.x + rectB.width;
246 t.y = rectA.y;
247 t.width = rectA.x + rectA.width - (rectB.x + rectB.width);
248 t.height = rectA.height;
249 if (t.width > 0 && t.height > 0) {
250 d =  new java.awt.Rectangle (t);
251 rectCount++;
252 }} else {
253 if (rectB.x <= rectA.x && rectB.y <= rectA.y) {
254 if ((rectB.x + rectB.width) > (rectA.x + rectA.width)) {
255 t.x = rectA.x;
256 t.y = rectB.y + rectB.height;
257 t.width = rectA.width;
258 t.height = rectA.y + rectA.height - (rectB.y + rectB.height);
259 if (t.width > 0 && t.height > 0) {
260 a = t;
261 rectCount++;
262 }} else if ((rectB.y + rectB.height) > (rectA.y + rectA.height)) {
263 t.reshape ((rectB.x + rectB.width), rectA.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), rectA.height);
264 if (t.width > 0 && t.height > 0) {
265 a = t;
266 rectCount++;
267 }} else {
268 t.reshape ((rectB.x + rectB.width), rectA.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), (rectB.y + rectB.height) - rectA.y);
269 if (t.width > 0 && t.height > 0) {
270 a =  new java.awt.Rectangle (t);
271 rectCount++;
272 }t.reshape (rectA.x, (rectB.y + rectB.height), rectA.width, (rectA.y + rectA.height) - (rectB.y + rectB.height));
273 if (t.width > 0 && t.height > 0) {
274 b =  new java.awt.Rectangle (t);
275 rectCount++;
276 }}} else if (rectB.x <= rectA.x && (rectB.y + rectB.height) >= (rectA.y + rectA.height)) {
277 if ((rectB.x + rectB.width) > (rectA.x + rectA.width)) {
278 t.reshape (rectA.x, rectA.y, rectA.width, rectB.y - rectA.y);
279 if (t.width > 0 && t.height > 0) {
280 a = t;
281 rectCount++;
282 }} else {
283 t.reshape (rectA.x, rectA.y, rectA.width, rectB.y - rectA.y);
284 if (t.width > 0 && t.height > 0) {
285 a =  new java.awt.Rectangle (t);
286 rectCount++;
287 }t.reshape ((rectB.x + rectB.width), rectB.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), (rectA.y + rectA.height) - rectB.y);
288 if (t.width > 0 && t.height > 0) {
289 b =  new java.awt.Rectangle (t);
290 rectCount++;
291 }}} else if (rectB.x <= rectA.x) {
292 if ((rectB.x + rectB.width) >= (rectA.x + rectA.width)) {
293 t.reshape (rectA.x, rectA.y, rectA.width, rectB.y - rectA.y);
294 if (t.width > 0 && t.height > 0) {
295 a =  new java.awt.Rectangle (t);
296 rectCount++;
297 }t.reshape (rectA.x, (rectB.y + rectB.height), rectA.width, (rectA.y + rectA.height) - (rectB.y + rectB.height));
298 if (t.width > 0 && t.height > 0) {
299 b =  new java.awt.Rectangle (t);
300 rectCount++;
301 }} else {
302 t.reshape (rectA.x, rectA.y, rectA.width, rectB.y - rectA.y);
303 if (t.width > 0 && t.height > 0) {
304 a =  new java.awt.Rectangle (t);
305 rectCount++;
306 }t.reshape ((rectB.x + rectB.width), rectB.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), rectB.height);
307 if (t.width > 0 && t.height > 0) {
308 b =  new java.awt.Rectangle (t);
309 rectCount++;
310 }t.reshape (rectA.x, (rectB.y + rectB.height), rectA.width, (rectA.y + rectA.height) - (rectB.y + rectB.height));
311 if (t.width > 0 && t.height > 0) {
312 c =  new java.awt.Rectangle (t);
313 rectCount++;
314 }}} else if (rectB.x <= (rectA.x + rectA.width) && (rectB.x + rectB.width) > (rectA.x + rectA.width)) {
315 if (rectB.y <= rectA.y && (rectB.y + rectB.height) > (rectA.y + rectA.height)) {
316 t.reshape (rectA.x, rectA.y, rectB.x - rectA.x, rectA.height);
317 if (t.width > 0 && t.height > 0) {
318 a = t;
319 rectCount++;
320 }} else if (rectB.y <= rectA.y) {
321 t.reshape (rectA.x, rectA.y, rectB.x - rectA.x, (rectB.y + rectB.height) - rectA.y);
322 if (t.width > 0 && t.height > 0) {
323 a =  new java.awt.Rectangle (t);
324 rectCount++;
325 }t.reshape (rectA.x, (rectB.y + rectB.height), rectA.width, (rectA.y + rectA.height) - (rectB.y + rectB.height));
326 if (t.width > 0 && t.height > 0) {
327 b =  new java.awt.Rectangle (t);
328 rectCount++;
329 }} else if ((rectB.y + rectB.height) > (rectA.y + rectA.height)) {
330 t.reshape (rectA.x, rectA.y, rectA.width, rectB.y - rectA.y);
331 if (t.width > 0 && t.height > 0) {
332 a =  new java.awt.Rectangle (t);
333 rectCount++;
334 }t.reshape (rectA.x, rectB.y, rectB.x - rectA.x, (rectA.y + rectA.height) - rectB.y);
335 if (t.width > 0 && t.height > 0) {
336 b =  new java.awt.Rectangle (t);
337 rectCount++;
338 }} else {
339 t.reshape (rectA.x, rectA.y, rectA.width, rectB.y - rectA.y);
340 if (t.width > 0 && t.height > 0) {
341 a =  new java.awt.Rectangle (t);
342 rectCount++;
343 }t.reshape (rectA.x, rectB.y, rectB.x - rectA.x, rectB.height);
344 if (t.width > 0 && t.height > 0) {
345 b =  new java.awt.Rectangle (t);
346 rectCount++;
347 }t.reshape (rectA.x, (rectB.y + rectB.height), rectA.width, (rectA.y + rectA.height) - (rectB.y + rectB.height));
348 if (t.width > 0 && t.height > 0) {
349 c =  new java.awt.Rectangle (t);
350 rectCount++;
351 }}} else if (rectB.x >= rectA.x && (rectB.x + rectB.width) <= (rectA.x + rectA.width)) {
352 if (rectB.y <= rectA.y && (rectB.y + rectB.height) > (rectA.y + rectA.height)) {
353 t.reshape (rectA.x, rectA.y, rectB.x - rectA.x, rectA.height);
354 if (t.width > 0 && t.height > 0) {
355 a =  new java.awt.Rectangle (t);
356 rectCount++;
357 }t.reshape ((rectB.x + rectB.width), rectA.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), rectA.height);
358 if (t.width > 0 && t.height > 0) {
359 b =  new java.awt.Rectangle (t);
360 rectCount++;
361 }} else if (rectB.y <= rectA.y) {
362 t.reshape (rectA.x, rectA.y, rectB.x - rectA.x, rectA.height);
363 if (t.width > 0 && t.height > 0) {
364 a =  new java.awt.Rectangle (t);
365 rectCount++;
366 }t.reshape (rectB.x, (rectB.y + rectB.height), rectB.width, (rectA.y + rectA.height) - (rectB.y + rectB.height));
367 if (t.width > 0 && t.height > 0) {
368 b =  new java.awt.Rectangle (t);
369 rectCount++;
370 }t.reshape ((rectB.x + rectB.width), rectA.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), rectA.height);
371 if (t.width > 0 && t.height > 0) {
372 c =  new java.awt.Rectangle (t);
373 rectCount++;
374 }} else {
375 t.reshape (rectA.x, rectA.y, rectB.x - rectA.x, rectA.height);
376 if (t.width > 0 && t.height > 0) {
377 a =  new java.awt.Rectangle (t);
378 rectCount++;
379 }t.reshape (rectB.x, rectA.y, rectB.width, rectB.y - rectA.y);
380 if (t.width > 0 && t.height > 0) {
381 b =  new java.awt.Rectangle (t);
382 rectCount++;
383 }t.reshape ((rectB.x + rectB.width), rectA.y, (rectA.x + rectA.width) - (rectB.x + rectB.width), rectA.height);
384 if (t.width > 0 && t.height > 0) {
385 c =  new java.awt.Rectangle (t);
386 rectCount++;
387 }}}}result =  new Array (rectCount);
388 rectCount = 0;
389 if (a != null) result[rectCount++] = a;
390 if (b != null) result[rectCount++] = b;
391 if (c != null) result[rectCount++] = c;
392 if (d != null) result[rectCount++] = d;
393 return result;
394 }, "java.awt.Rectangle,java.awt.Rectangle");
395 c$.isLeftMouseButton = Clazz.defineMethod (c$, "isLeftMouseButton", 
396 function (anEvent) {
397 return ((anEvent.getModifiers () & 16) != 0);
398 }, "java.awt.event.MouseEvent");
399 c$.isMiddleMouseButton = Clazz.defineMethod (c$, "isMiddleMouseButton", 
400 function (anEvent) {
401 return ((anEvent.getModifiers () & 8) == 8);
402 }, "java.awt.event.MouseEvent");
403 c$.isRightMouseButton = Clazz.defineMethod (c$, "isRightMouseButton", 
404 function (anEvent) {
405 return ((anEvent.getModifiers () & 4) == 4);
406 }, "java.awt.event.MouseEvent");
407 c$.paintComponent = Clazz.defineMethod (c$, "paintComponent", 
408 function (g, c, p, x, y, w, h) {
409 javax.swing.SwingUtilities.getCellRendererPane (c, p).paintComponent (g, c, p, x, y, w, h, false);
410 }, "java.awt.Graphics,java.awt.Component,java.awt.Container,~N,~N,~N,~N");
411 c$.paintComponent = Clazz.defineMethod (c$, "paintComponent", 
412 function (g, c, p, r) {
413 javax.swing.SwingUtilities.paintComponent (g, c, p, r.x, r.y, r.width, r.height);
414 }, "java.awt.Graphics,java.awt.Component,java.awt.Container,java.awt.Rectangle");
415 c$.getCellRendererPane = Clazz.defineMethod (c$, "getCellRendererPane", 
416  function (c, p) {
417 var shell = c.getParent ();
418 if (Clazz.instanceOf (shell, javax.swing.CellRendererPane)) {
419 if (shell.getParent () !== p) {
420 p.add (shell);
421 }} else {
422 shell = swingjs.api.Interface.getInstance ("javax.swing.CellRendererPane", false);
423 shell.add (c);
424 p.add (shell);
425 }return shell;
426 }, "java.awt.Component,java.awt.Container");
427 c$.updateComponentTreeUI = Clazz.defineMethod (c$, "updateComponentTreeUI", 
428 function (c) {
429 javax.swing.SwingUtilities.updateComponentTreeUI0 (c);
430 c.invalidate ();
431 c.validate ();
432 c.repaint ();
433 }, "java.awt.Component");
434 c$.updateComponentTreeUI0 = Clazz.defineMethod (c$, "updateComponentTreeUI0", 
435  function (c) {
436 if (Clazz.instanceOf (c, javax.swing.JComponent)) {
437 var jc = c;
438 jc.updateUI ();
439 var jpm = jc.getComponentPopupMenu ();
440 if (jpm != null) {
441 javax.swing.SwingUtilities.updateComponentTreeUI (jpm);
442 }}var children = null;
443 if (Clazz.instanceOf (c, javax.swing.JMenu)) {
444 children = (c).getMenuComponents ();
445 } else if (Clazz.instanceOf (c, java.awt.Container)) {
446 children = (c).getComponents ();
447 }if (children != null) {
448 for (var i = 0; i < children.length; i++) {
449 javax.swing.SwingUtilities.updateComponentTreeUI0 (children[i]);
450 }
451 }}, "java.awt.Component");
452 c$.invokeLater = Clazz.defineMethod (c$, "invokeLater", 
453 function (doRun) {
454 java.awt.EventQueue.invokeLater (doRun);
455 }, "Runnable");
456 c$.invokeAndWait = Clazz.defineMethod (c$, "invokeAndWait", 
457 function (doRun) {
458 java.awt.EventQueue.invokeAndWait (doRun);
459 }, "Runnable");
460 c$.isEventDispatchThread = Clazz.defineMethod (c$, "isEventDispatchThread", 
461 function () {
462 return java.awt.EventQueue.isDispatchThread ();
463 });
464 c$.getRootPane = Clazz.defineMethod (c$, "getRootPane", 
465 function (c) {
466 if (Clazz.instanceOf (c, javax.swing.RootPaneContainer)) {
467 return (c).getRootPane ();
468 }for (; c != null; c = c.getParent ()) {
469 if (Clazz.instanceOf (c, javax.swing.JRootPane)) {
470 return c;
471 }}
472 return null;
473 }, "java.awt.Component");
474 c$.getRoot = Clazz.defineMethod (c$, "getRoot", 
475 function (c) {
476 var applet = null;
477 for (var p = c; p != null; p = p.getParent ()) {
478 if (Clazz.instanceOf (p, java.awt.Window)) {
479 return p;
480 }if (Clazz.instanceOf (p, java.applet.Applet)) {
481 applet = p;
482 }}
483 return applet;
484 }, "java.awt.Component");
485 c$.processKeyBindings = Clazz.defineMethod (c$, "processKeyBindings", 
486 function (event) {
487 if (event != null) {
488 if (event.isConsumed ()) {
489 return false;
490 }var component = event.getComponent ();
491 var pressed = (event.getID () == 401);
492 if (!javax.swing.SwingUtilities.isValidKeyEventForKeyBindings (event)) {
493 return false;
494 }while (component != null) {
495 if (Clazz.instanceOf (component, javax.swing.JComponent)) {
496 return (component).processKeyBindings (event, pressed);
497 }if ((Clazz.instanceOf (component, java.applet.Applet)) || (Clazz.instanceOf (component, java.awt.Window))) {
498 return javax.swing.JComponent.processKeyBindingsForAllComponents (event, component, pressed);
499 }component = component.getParent ();
500 }
501 }return false;
502 }, "java.awt.event.KeyEvent");
503 c$.isValidKeyEventForKeyBindings = Clazz.defineMethod (c$, "isValidKeyEventForKeyBindings", 
504 function (e) {
505 if (e.getID () == 400) {
506 var mod = e.getModifiers ();
507 if (((mod & 8) != 0) && ((mod & 2) == 0)) {
508 return false;
509 }}return true;
510 }, "java.awt.event.KeyEvent");
511 c$.notifyAction = Clazz.defineMethod (c$, "notifyAction", 
512 function (action, ks, event, sender, modifiers) {
513 if (action == null) {
514 return false;
515 }if (Clazz.instanceOf (action, jssun.swing.UIAction)) {
516 if (!(action).isEnabled (sender)) {
517 return false;
518 }} else if (!action.isEnabled ()) {
519 return false;
520 }var commandO;
521 var stayNull;
522 commandO = action.getValue ("ActionCommandKey");
523 if (commandO == null && (Clazz.instanceOf (action, javax.swing.JComponent.ActionStandin))) {
524 stayNull = true;
525 } else {
526 stayNull = false;
527 }var command;
528 if (commandO != null) {
529 command = commandO.toString ();
530 } else if (!stayNull && event.getKeyChar () != '\uffff') {
531 command = String.valueOf (event.getKeyChar ());
532 } else {
533 command = null;
534 }action.actionPerformed ( new java.awt.event.ActionEvent (sender, 1001, command, event.getWhen (), modifiers));
535 return true;
536 }, "javax.swing.Action,javax.swing.KeyStroke,java.awt.event.KeyEvent,~O,~N");
537 c$.replaceUIInputMap = Clazz.defineMethod (c$, "replaceUIInputMap", 
538 function (component, type, uiInputMap) {
539 var map = component.getInputMap (type, (uiInputMap != null));
540 while (map != null) {
541 var parent = map.getParent ();
542 if (parent == null || (Clazz.instanceOf (parent, javax.swing.plaf.UIResource))) {
543 map.setParent (uiInputMap);
544 return;
545 }map = parent;
546 }
547 }, "javax.swing.JComponent,~N,javax.swing.InputMap");
548 c$.replaceUIActionMap = Clazz.defineMethod (c$, "replaceUIActionMap", 
549 function (component, uiActionMap) {
550 var map = component.getActionMap ((uiActionMap != null));
551 ;while (map != null) {
552 var parent = map.getParent ();
553 if (parent == null || (Clazz.instanceOf (parent, javax.swing.plaf.UIResource))) {
554 map.setParent (uiActionMap);
555 return;
556 }map = parent;
557 }
558 }, "javax.swing.JComponent,javax.swing.ActionMap");
559 c$.getUIInputMap = Clazz.defineMethod (c$, "getUIInputMap", 
560 function (component, condition) {
561 var map = component.getInputMap (condition, false);
562 while (map != null) {
563 var parent = map.getParent ();
564 if (Clazz.instanceOf (parent, javax.swing.plaf.UIResource)) {
565 return parent;
566 }map = parent;
567 }
568 return null;
569 }, "javax.swing.JComponent,~N");
570 c$.getUIActionMap = Clazz.defineMethod (c$, "getUIActionMap", 
571 function (component) {
572 var map = component.getActionMap (false);
573 while (map != null) {
574 var parent = map.getParent ();
575 if (Clazz.instanceOf (parent, javax.swing.plaf.UIResource)) {
576 return parent;
577 }map = parent;
578 }
579 return null;
580 }, "javax.swing.JComponent");
581 c$.getSharedOwnerFrame = Clazz.defineMethod (c$, "getSharedOwnerFrame", 
582 function () {
583 var sharedOwnerFrame = javax.swing.SwingUtilities.appContextGet (javax.swing.SwingUtilities.sharedOwnerFrameKey);
584 if (sharedOwnerFrame == null) {
585 sharedOwnerFrame =  new javax.swing.SwingUtilities.SharedOwnerFrame ();
586 javax.swing.SwingUtilities.appContextPut (javax.swing.SwingUtilities.sharedOwnerFrameKey, sharedOwnerFrame);
587 }return sharedOwnerFrame;
588 });
589 c$.getSharedOwnerFrameShutdownListener = Clazz.defineMethod (c$, "getSharedOwnerFrameShutdownListener", 
590 function () {
591 var sharedOwnerFrame = javax.swing.SwingUtilities.getSharedOwnerFrame ();
592 return sharedOwnerFrame;
593 });
594 c$.appContextGet = Clazz.defineMethod (c$, "appContextGet", 
595 function (key) {
596 return jssun.awt.AppContext.getAppContext ().get (key);
597 }, "~O");
598 c$.appContextPut = Clazz.defineMethod (c$, "appContextPut", 
599 function (key, value) {
600 jssun.awt.AppContext.getAppContext ().put (key, value);
601 }, "~O,~O");
602 c$.appContextRemove = Clazz.defineMethod (c$, "appContextRemove", 
603 function (key) {
604 jssun.awt.AppContext.getAppContext ().remove (key);
605 }, "~O");
606 c$.loadSystemClass = Clazz.defineMethod (c$, "loadSystemClass", 
607 function (className) {
608 return Clazz._4Name (className, true, Thread.currentThread ().getContextClassLoader ());
609 }, "~S");
610 c$.isLeftToRight = Clazz.defineMethod (c$, "isLeftToRight", 
611 function (c) {
612 return c.getComponentOrientation ().isLeftToRight ();
613 }, "java.awt.Component");
614 c$.doesIconReferenceImage = Clazz.defineMethod (c$, "doesIconReferenceImage", 
615 function (icon, image) {
616 var iconImage = (icon != null && (Clazz.instanceOf (icon, javax.swing.ImageIcon))) ? (icon).getImage () : null;
617 return (iconImage === image);
618 }, "javax.swing.Icon,java.awt.Image");
619 c$.findDisplayedMnemonicIndex = Clazz.defineMethod (c$, "findDisplayedMnemonicIndex", 
620 function (text, mnemonic) {
621 if (text == null || mnemonic == 0) {
622 return -1;
623 }var uc = Character.toUpperCase (String.fromCharCode (mnemonic));
624 var lc = Character.toLowerCase (String.fromCharCode (mnemonic));
625 var uci = text.indexOf (uc);
626 var lci = text.indexOf (lc);
627 if (uci == -1) {
628 return lci;
629 } else if (lci == -1) {
630 return uci;
631 } else {
632 return (lci < uci) ? lci : uci;
633 }}, "~S,~N");
634 c$.calculateInnerArea = Clazz.defineMethod (c$, "calculateInnerArea", 
635 function (c, r) {
636 if (c == null) {
637 return null;
638 }var rect = r;
639 var insets = c.getInsets ();
640 if (rect == null) {
641 rect =  new java.awt.Rectangle ();
642 }rect.x = insets.left;
643 rect.y = insets.top;
644 rect.width = c.getWidth () - insets.left - insets.right;
645 rect.height = c.getHeight () - insets.top - insets.bottom;
646 return rect;
647 }, "javax.swing.JComponent,java.awt.Rectangle");
648 c$.updateRendererOrEditorUI = Clazz.defineMethod (c$, "updateRendererOrEditorUI", 
649 function (rendererOrEditor) {
650 if (rendererOrEditor == null) {
651 return;
652 }var component = null;
653 if (Clazz.instanceOf (rendererOrEditor, java.awt.Component)) {
654 component = rendererOrEditor;
655 }if (Clazz.instanceOf (rendererOrEditor, javax.swing.DefaultCellEditor)) {
656 component = (rendererOrEditor).getComponent ();
657 }if (component != null) {
658 javax.swing.SwingUtilities.updateComponentTreeUI (component);
659 }}, "~O");
660 Clazz.pu$h(self.c$);
661 c$ = Clazz.declareType (javax.swing.SwingUtilities, "SharedOwnerFrame", java.awt.Frame, java.awt.event.WindowListener);
662 Clazz.defineMethod (c$, "addNotify", 
663 function () {
664 Clazz.superCall (this, javax.swing.SwingUtilities.SharedOwnerFrame, "addNotify", []);
665 this.installListeners ();
666 });
667 Clazz.defineMethod (c$, "installListeners", 
668 function () {
669 var a = this.getOwnedWindows ();
670 for (var b = 0; b < a.length; b++) {
671 var c = a[b];
672 if (c != null) {
673 c.removeWindowListener (this);
674 c.addWindowListener (this);
675 }}
676 });
677 Clazz.overrideMethod (c$, "windowClosed", 
678 function (a) {
679 var b = this.getOwnedWindows ();
680 for (var c = 0; c < b.length; c++) {
681 var d = b[c];
682 if (d != null) {
683 if (d.isDisplayable ()) {
684 return;
685 }d.removeWindowListener (this);
686 }this.dispose ();
687 }
688 }, "java.awt.event.WindowEvent");
689 Clazz.overrideMethod (c$, "windowOpened", 
690 function (a) {
691 }, "java.awt.event.WindowEvent");
692 Clazz.overrideMethod (c$, "windowClosing", 
693 function (a) {
694 }, "java.awt.event.WindowEvent");
695 Clazz.overrideMethod (c$, "windowIconified", 
696 function (a) {
697 }, "java.awt.event.WindowEvent");
698 Clazz.overrideMethod (c$, "windowDeiconified", 
699 function (a) {
700 }, "java.awt.event.WindowEvent");
701 Clazz.overrideMethod (c$, "windowActivated", 
702 function (a) {
703 }, "java.awt.event.WindowEvent");
704 Clazz.overrideMethod (c$, "windowDeactivated", 
705 function (a) {
706 }, "java.awt.event.WindowEvent");
707 Clazz.defineMethod (c$, "show", 
708 function () {
709 });
710 Clazz.overrideMethod (c$, "dispose", 
711 function () {
712 });
713 c$ = Clazz.p0p ();
714 c$.sharedOwnerFrameKey = c$.prototype.sharedOwnerFrameKey =  new Clazz._O ();
715 });