1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (null, "javax.swing.LayoutComparator", ["java.lang.ClassCastException", "java.util.LinkedList", "java.awt.Window"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.horizontal = true;
5 this.leftToRight = true;
6 Clazz.instantialize (this, arguments);
7 }, javax.swing, "LayoutComparator", null, [java.util.Comparator, java.io.Serializable]);
8 Clazz.defineMethod (c$, "setComponentOrientation",
9 function (orientation) {
10 this.horizontal = orientation.isHorizontal ();
11 this.leftToRight = orientation.isLeftToRight ();
12 }, "java.awt.ComponentOrientation");
13 Clazz.overrideMethod (c$, "compare",
19 }if (a.getParent () !== b.getParent ()) {
22 for (aAncestory = new java.util.LinkedList (); a != null; a = a.getParent ()) {
24 if (Clazz.instanceOf (a, java.awt.Window)) {
28 throw new ClassCastException ();
29 }for (bAncestory = new java.util.LinkedList (); b != null; b = b.getParent ()) {
31 if (Clazz.instanceOf (b, java.awt.Window)) {
35 throw new ClassCastException ();
36 }for (var aIter = aAncestory.listIterator (aAncestory.size ()), bIter = bAncestory.listIterator (bAncestory.size ()); ; ) {
37 if (aIter.hasPrevious ()) {
38 a = aIter.previous ();
41 }if (bIter.hasPrevious ()) {
42 b = bIter.previous ();
52 var zOrder = a.getParent ().getComponentZOrder (a) - b.getParent ().getComponentZOrder (b);
53 if (this.horizontal) {
54 if (this.leftToRight) {
55 if (Math.abs (ay - by) < 10) {
56 return (ax < bx) ? -1 : ((ax > bx) ? 1 : zOrder);
58 return (ay < by) ? -1 : 1;
60 if (Math.abs (ay - by) < 10) {
61 return (ax > bx) ? -1 : ((ax < bx) ? 1 : zOrder);
63 return (ay < by) ? -1 : 1;
65 if (this.leftToRight) {
66 if (Math.abs (ax - bx) < 10) {
67 return (ay < by) ? -1 : ((ay > by) ? 1 : zOrder);
69 return (ax < bx) ? -1 : 1;
71 if (Math.abs (ax - bx) < 10) {
72 return (ay < by) ? -1 : ((ay > by) ? 1 : zOrder);
74 return (ax > bx) ? -1 : 1;
76 Clazz.defineStatics (c$,