1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.lang.Enum"], "javax.swing.RowFilter", ["java.lang.IllegalArgumentException", "$.Number", "java.util.ArrayList", "$.Date", "java.util.regex.Pattern"], function () {
3 c$ = Clazz.declareType (javax.swing, "RowFilter");
4 c$.checkIndices = Clazz.defineMethod (c$, "checkIndices",
6 for (var i = columns.length - 1; i >= 0; i--) {
8 throw new IllegalArgumentException ("Index must be >= 0");
11 c$.regexFilter = Clazz.defineMethod (c$, "regexFilter",
12 function (regex, indices) {
13 return new javax.swing.RowFilter.RegexFilter (java.util.regex.Pattern.compile (regex), indices);
15 c$.dateFilter = Clazz.defineMethod (c$, "dateFilter",
16 function (type, date, indices) {
17 return new javax.swing.RowFilter.DateFilter (type, date.getTime (), indices);
18 }, "javax.swing.RowFilter.ComparisonType,java.util.Date,~A");
19 c$.numberFilter = Clazz.defineMethod (c$, "numberFilter",
20 function (type, number, indices) {
21 return new javax.swing.RowFilter.NumberFilter (type, number, indices);
22 }, "javax.swing.RowFilter.ComparisonType,Number,~A");
23 c$.orFilter = Clazz.defineMethod (c$, "orFilter",
25 return new javax.swing.RowFilter.OrFilter (filters);
27 c$.andFilter = Clazz.defineMethod (c$, "andFilter",
29 return new javax.swing.RowFilter.AndFilter (filters);
31 c$.notFilter = Clazz.defineMethod (c$, "notFilter",
33 return new javax.swing.RowFilter.NotFilter (filter);
34 }, "javax.swing.RowFilter");
36 c$ = Clazz.declareType (javax.swing.RowFilter, "ComparisonType", Enum);
37 Clazz.defineEnumConstant (c$, "BEFORE", 0, []);
38 Clazz.defineEnumConstant (c$, "AFTER", 1, []);
39 Clazz.defineEnumConstant (c$, "EQUAL", 2, []);
40 Clazz.defineEnumConstant (c$, "NOT_EQUAL", 3, []);
43 c$ = Clazz.declareType (javax.swing.RowFilter, "Entry");
44 Clazz.makeConstructor (c$,
47 Clazz.defineMethod (c$, "getStringValue",
49 var b = this.getValue (a);
50 return (b == null) ? "" : b.toString ();
54 c$ = Clazz.decorateAsClass (function () {
56 Clazz.instantialize (this, arguments);
57 }, javax.swing.RowFilter, "GeneralFilter", javax.swing.RowFilter);
58 Clazz.makeConstructor (c$,
60 Clazz.superConstructor (this, javax.swing.RowFilter.GeneralFilter, []);
61 javax.swing.RowFilter.checkIndices (a);
64 Clazz.defineMethod (c$, "include",
66 var b = a.getValueCount ();
67 if (this.columns.length > 0) {
68 for (var c = this.columns.length - 1; c >= 0; c--) {
69 var d = this.columns[c];
71 if (this.include (a, d)) {
76 if (this.include (a, b)) {
80 }, "javax.swing.RowFilter.Entry");
83 c$ = Clazz.decorateAsClass (function () {
85 Clazz.instantialize (this, arguments);
86 }, javax.swing.RowFilter, "RegexFilter", javax.swing.RowFilter.GeneralFilter);
87 Clazz.makeConstructor (c$,
89 Clazz.superConstructor (this, javax.swing.RowFilter.RegexFilter, [b]);
91 throw new IllegalArgumentException ("Pattern must be non-null");
92 }this.matcher = a.matcher ("");
93 }, "java.util.regex.Pattern,~A");
94 Clazz.defineMethod (c$, "include",
96 this.matcher.reset (a.getStringValue (b));
97 return this.matcher.find ();
98 }, "javax.swing.RowFilter.Entry,~N");
101 c$ = Clazz.decorateAsClass (function () {
104 Clazz.instantialize (this, arguments);
105 }, javax.swing.RowFilter, "DateFilter", javax.swing.RowFilter.GeneralFilter);
106 Clazz.makeConstructor (c$,
108 Clazz.superConstructor (this, javax.swing.RowFilter.DateFilter, [c]);
110 throw new IllegalArgumentException ("type must be non-null");
113 }, "javax.swing.RowFilter.ComparisonType,~N,~A");
114 Clazz.defineMethod (c$, "include",
116 var c = a.getValue (b);
117 if (Clazz.instanceOf (c, java.util.Date)) {
118 var d = (c).getTime ();
120 case javax.swing.RowFilter.ComparisonType.BEFORE:
121 return (d < this.date);
122 case javax.swing.RowFilter.ComparisonType.AFTER:
123 return (d > this.date);
124 case javax.swing.RowFilter.ComparisonType.EQUAL:
125 return (d == this.date);
126 case javax.swing.RowFilter.ComparisonType.NOT_EQUAL:
127 return (d != this.date);
132 }, "javax.swing.RowFilter.Entry,~N");
135 c$ = Clazz.decorateAsClass (function () {
136 this.isComparable = false;
139 Clazz.instantialize (this, arguments);
140 }, javax.swing.RowFilter, "NumberFilter", javax.swing.RowFilter.GeneralFilter);
141 Clazz.makeConstructor (c$,
143 Clazz.superConstructor (this, javax.swing.RowFilter.NumberFilter, [c]);
144 if (a == null || b == null) {
145 throw new IllegalArgumentException ("type and number must be non-null");
148 this.isComparable = (Clazz.instanceOf (b, Comparable));
149 }, "javax.swing.RowFilter.ComparisonType,Number,~A");
150 Clazz.defineMethod (c$, "include",
152 var c = a.getValue (b);
153 if (Clazz.instanceOf (c, Number)) {
156 var f = c.getClass ();
157 if (this.number.getClass () === f && this.isComparable) {
158 e = (this.number).compareTo (c);
160 e = this.longCompare (c);
161 }switch (this.type) {
162 case javax.swing.RowFilter.ComparisonType.BEFORE:
164 case javax.swing.RowFilter.ComparisonType.AFTER:
166 case javax.swing.RowFilter.ComparisonType.EQUAL:
168 case javax.swing.RowFilter.ComparisonType.NOT_EQUAL:
174 }, "javax.swing.RowFilter.Entry,~N");
177 c$ = Clazz.decorateAsClass (function () {
179 Clazz.instantialize (this, arguments);
180 }, javax.swing.RowFilter, "OrFilter", javax.swing.RowFilter);
181 Clazz.makeConstructor (c$,
183 Clazz.superConstructor (this, javax.swing.RowFilter.OrFilter, []);
184 this.filters = new java.util.ArrayList ();
185 for (var filter, $filter = a.iterator (); $filter.hasNext () && ((filter = $filter.next ()) || true);) {
186 if (filter == null) {
187 throw new IllegalArgumentException ("Filter must be non-null");
188 }this.filters.add (filter);
191 Clazz.defineMethod (c$, "include",
193 for (var filter, $filter = this.filters.iterator (); $filter.hasNext () && ((filter = $filter.next ()) || true);) {
194 if (filter.include (a)) {
198 }, "javax.swing.RowFilter.Entry");
201 c$ = Clazz.declareType (javax.swing.RowFilter, "AndFilter", javax.swing.RowFilter.OrFilter);
202 Clazz.overrideMethod (c$, "include",
204 for (var filter, $filter = this.filters.iterator (); $filter.hasNext () && ((filter = $filter.next ()) || true);) {
205 if (!filter.include (a)) {
209 }, "javax.swing.RowFilter.Entry");
212 c$ = Clazz.decorateAsClass (function () {
214 Clazz.instantialize (this, arguments);
215 }, javax.swing.RowFilter, "NotFilter", javax.swing.RowFilter);
216 Clazz.makeConstructor (c$,
218 Clazz.superConstructor (this, javax.swing.RowFilter.NotFilter, []);
220 throw new IllegalArgumentException ("filter must be non-null");
222 }, "javax.swing.RowFilter");
223 Clazz.defineMethod (c$, "include",
225 return !this.filter.include (a);
226 }, "javax.swing.RowFilter.Entry");