JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / swingjs / j2s / javax / swing / DefaultRowSorter.js
1 Clazz.declarePackage ("javax.swing");\r
2 Clazz.load (["javax.swing.RowFilter", "$.RowSorter"], "javax.swing.DefaultRowSorter", ["java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException", "java.util.ArrayList", "$.Arrays", "$.Collections", "javax.swing.SortOrder"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.sortsOnUpdates = false;\r
5 this.viewToModel = null;\r
6 this.modelToView = null;\r
7 this.comparators = null;\r
8 this.$isSortable = null;\r
9 this.cachedSortKeys = null;\r
10 this.sortComparators = null;\r
11 this.filter = null;\r
12 this.filterEntry = null;\r
13 this.sortKeys = null;\r
14 this.$useToString = null;\r
15 this.sorted = false;\r
16 this.maxSortKeys = 0;\r
17 this.modelWrapper = null;\r
18 this.modelRowCount = 0;\r
19 if (!Clazz.isClassDefined ("javax.swing.DefaultRowSorter.FilterEntry")) {\r
20 javax.swing.DefaultRowSorter.$DefaultRowSorter$FilterEntry$ ();\r
21 }\r
22 Clazz.instantialize (this, arguments);\r
23 }, javax.swing, "DefaultRowSorter", javax.swing.RowSorter);\r
24 Clazz.makeConstructor (c$, \r
25 function () {\r
26 Clazz.superConstructor (this, javax.swing.DefaultRowSorter, []);\r
27 this.sortKeys = java.util.Collections.emptyList ();\r
28 this.maxSortKeys = 3;\r
29 });\r
30 Clazz.defineMethod (c$, "setModelWrapper", \r
31 function (modelWrapper) {\r
32 if (modelWrapper == null) {\r
33 throw  new IllegalArgumentException ("modelWrapper most be non-null");\r
34 }var last = this.modelWrapper;\r
35 this.modelWrapper = modelWrapper;\r
36 if (last != null) {\r
37 this.modelStructureChanged ();\r
38 } else {\r
39 this.modelRowCount = this.getModelWrapper ().getRowCount ();\r
40 }}, "javax.swing.DefaultRowSorter.ModelWrapper");\r
41 Clazz.defineMethod (c$, "getModelWrapper", \r
42 function () {\r
43 return this.modelWrapper;\r
44 });\r
45 Clazz.overrideMethod (c$, "getModel", \r
46 function () {\r
47 return this.getModelWrapper ().getModel ();\r
48 });\r
49 Clazz.defineMethod (c$, "setSortable", \r
50 function (column, sortable) {\r
51 this.checkColumn (column);\r
52 if (this.$isSortable == null) {\r
53 this.$isSortable =  Clazz.newBooleanArray (this.getModelWrapper ().getColumnCount (), false);\r
54 for (var i = this.$isSortable.length - 1; i >= 0; i--) {\r
55 this.$isSortable[i] = true;\r
56 }\r
57 }this.$isSortable[column] = sortable;\r
58 }, "~N,~B");\r
59 Clazz.defineMethod (c$, "isSortable", \r
60 function (column) {\r
61 this.checkColumn (column);\r
62 return (this.$isSortable == null) ? true : this.$isSortable[column];\r
63 }, "~N");\r
64 Clazz.overrideMethod (c$, "setSortKeys", \r
65 function (sortKeys) {\r
66 var old = this.sortKeys;\r
67 if (sortKeys != null && sortKeys.size () > 0) {\r
68 var max = this.getModelWrapper ().getColumnCount ();\r
69 for (var key, $key = sortKeys.iterator (); $key.hasNext () && ((key = $key.next ()) || true);) {\r
70 if (key == null || key.getColumn () < 0 || key.getColumn () >= max) {\r
71 throw  new IllegalArgumentException ("Invalid SortKey");\r
72 }}\r
73 this.sortKeys = java.util.Collections.unmodifiableList ( new java.util.ArrayList (sortKeys));\r
74 } else {\r
75 this.sortKeys = java.util.Collections.emptyList ();\r
76 }if (!this.sortKeys.equals (old)) {\r
77 this.fireSortOrderChanged ();\r
78 if (this.viewToModel == null) {\r
79 this.sort ();\r
80 } else {\r
81 this.sortExistingData ();\r
82 }}}, "java.util.List");\r
83 Clazz.overrideMethod (c$, "getSortKeys", \r
84 function () {\r
85 return this.sortKeys;\r
86 });\r
87 Clazz.defineMethod (c$, "setMaxSortKeys", \r
88 function (max) {\r
89 if (max < 1) {\r
90 throw  new IllegalArgumentException ("Invalid max");\r
91 }this.maxSortKeys = max;\r
92 }, "~N");\r
93 Clazz.defineMethod (c$, "getMaxSortKeys", \r
94 function () {\r
95 return this.maxSortKeys;\r
96 });\r
97 Clazz.defineMethod (c$, "setSortsOnUpdates", \r
98 function (sortsOnUpdates) {\r
99 this.sortsOnUpdates = sortsOnUpdates;\r
100 }, "~B");\r
101 Clazz.defineMethod (c$, "getSortsOnUpdates", \r
102 function () {\r
103 return this.sortsOnUpdates;\r
104 });\r
105 Clazz.defineMethod (c$, "setRowFilter", \r
106 function (filter) {\r
107 this.filter = filter;\r
108 this.sort ();\r
109 }, "javax.swing.RowFilter");\r
110 Clazz.defineMethod (c$, "getRowFilter", \r
111 function () {\r
112 return this.filter;\r
113 });\r
114 Clazz.overrideMethod (c$, "toggleSortOrder", \r
115 function (column) {\r
116 this.checkColumn (column);\r
117 if (this.isSortable (column)) {\r
118 var keys =  new java.util.ArrayList (this.getSortKeys ());\r
119 var sortKey;\r
120 var sortIndex;\r
121 for (sortIndex = keys.size () - 1; sortIndex >= 0; sortIndex--) {\r
122 if (keys.get (sortIndex).getColumn () == column) {\r
123 break;\r
124 }}\r
125 if (sortIndex == -1) {\r
126 sortKey =  new javax.swing.RowSorter.SortKey (column, javax.swing.SortOrder.ASCENDING);\r
127 keys.add (0, sortKey);\r
128 } else if (sortIndex == 0) {\r
129 keys.set (0, this.toggle (keys.get (0)));\r
130 } else {\r
131 keys.remove (sortIndex);\r
132 keys.add (0,  new javax.swing.RowSorter.SortKey (column, javax.swing.SortOrder.ASCENDING));\r
133 }if (keys.size () > this.getMaxSortKeys ()) {\r
134 keys = keys.subList (0, this.getMaxSortKeys ());\r
135 }this.setSortKeys (keys);\r
136 }}, "~N");\r
137 Clazz.defineMethod (c$, "toggle", \r
138  function (key) {\r
139 if (key.getSortOrder () === javax.swing.SortOrder.ASCENDING) {\r
140 return  new javax.swing.RowSorter.SortKey (key.getColumn (), javax.swing.SortOrder.DESCENDING);\r
141 }return  new javax.swing.RowSorter.SortKey (key.getColumn (), javax.swing.SortOrder.ASCENDING);\r
142 }, "javax.swing.RowSorter.SortKey");\r
143 Clazz.overrideMethod (c$, "convertRowIndexToView", \r
144 function (index) {\r
145 if (this.modelToView == null) {\r
146 if (index < 0 || index >= this.getModelWrapper ().getRowCount ()) {\r
147 throw  new IndexOutOfBoundsException ("Invalid index");\r
148 }return index;\r
149 }return this.modelToView[index];\r
150 }, "~N");\r
151 Clazz.overrideMethod (c$, "convertRowIndexToModel", \r
152 function (index) {\r
153 if (this.viewToModel == null) {\r
154 if (index < 0 || index >= this.getModelWrapper ().getRowCount ()) {\r
155 throw  new IndexOutOfBoundsException ("Invalid index");\r
156 }return index;\r
157 }return this.viewToModel[index].modelIndex;\r
158 }, "~N");\r
159 Clazz.defineMethod (c$, "isUnsorted", \r
160  function () {\r
161 var keys = this.getSortKeys ();\r
162 var keySize = keys.size ();\r
163 return (keySize == 0 || keys.get (0).getSortOrder () === javax.swing.SortOrder.UNSORTED);\r
164 });\r
165 Clazz.defineMethod (c$, "sortExistingData", \r
166  function () {\r
167 var lastViewToModel = this.getViewToModelAsInts (this.viewToModel);\r
168 this.updateUseToString ();\r
169 this.cacheSortKeys (this.getSortKeys ());\r
170 if (this.isUnsorted ()) {\r
171 if (this.getRowFilter () == null) {\r
172 this.viewToModel = null;\r
173 this.modelToView = null;\r
174 } else {\r
175 var included = 0;\r
176 for (var i = 0; i < this.modelToView.length; i++) {\r
177 if (this.modelToView[i] != -1) {\r
178 this.viewToModel[included].modelIndex = i;\r
179 this.modelToView[i] = included++;\r
180 }}\r
181 }} else {\r
182 java.util.Arrays.sort (this.viewToModel);\r
183 this.setModelToViewFromViewToModel (false);\r
184 }this.fireRowSorterChanged (lastViewToModel);\r
185 });\r
186 Clazz.defineMethod (c$, "sort", \r
187 function () {\r
188 this.sorted = true;\r
189 var lastViewToModel = this.getViewToModelAsInts (this.viewToModel);\r
190 this.updateUseToString ();\r
191 if (this.isUnsorted ()) {\r
192 this.cachedSortKeys =  new Array (0);\r
193 if (this.getRowFilter () == null) {\r
194 if (this.viewToModel != null) {\r
195 this.viewToModel = null;\r
196 this.modelToView = null;\r
197 } else {\r
198 return;\r
199 }} else {\r
200 this.initializeFilteredMapping ();\r
201 }} else {\r
202 this.cacheSortKeys (this.getSortKeys ());\r
203 if (this.getRowFilter () != null) {\r
204 this.initializeFilteredMapping ();\r
205 } else {\r
206 this.createModelToView (this.getModelWrapper ().getRowCount ());\r
207 this.createViewToModel (this.getModelWrapper ().getRowCount ());\r
208 }java.util.Arrays.sort (this.viewToModel);\r
209 this.setModelToViewFromViewToModel (false);\r
210 }this.fireRowSorterChanged (lastViewToModel);\r
211 });\r
212 Clazz.defineMethod (c$, "updateUseToString", \r
213  function () {\r
214 var i = this.getModelWrapper ().getColumnCount ();\r
215 if (this.$useToString == null || this.$useToString.length != i) {\r
216 this.$useToString =  Clazz.newBooleanArray (i, false);\r
217 }for (--i; i >= 0; i--) {\r
218 this.$useToString[i] = this.useToString (i);\r
219 }\r
220 });\r
221 Clazz.defineMethod (c$, "initializeFilteredMapping", \r
222  function () {\r
223 var rowCount = this.getModelWrapper ().getRowCount ();\r
224 var i;\r
225 var j;\r
226 var excludedCount = 0;\r
227 this.createModelToView (rowCount);\r
228 for (i = 0; i < rowCount; i++) {\r
229 if (this.include (i)) {\r
230 this.modelToView[i] = i - excludedCount;\r
231 } else {\r
232 this.modelToView[i] = -1;\r
233 excludedCount++;\r
234 }}\r
235 this.createViewToModel (rowCount - excludedCount);\r
236 for (i = 0, j = 0; i < rowCount; i++) {\r
237 if (this.modelToView[i] != -1) {\r
238 this.viewToModel[j++].modelIndex = i;\r
239 }}\r
240 });\r
241 Clazz.defineMethod (c$, "createModelToView", \r
242  function (rowCount) {\r
243 if (this.modelToView == null || this.modelToView.length != rowCount) {\r
244 this.modelToView =  Clazz.newIntArray (rowCount, 0);\r
245 }}, "~N");\r
246 Clazz.defineMethod (c$, "createViewToModel", \r
247  function (rowCount) {\r
248 var recreateFrom = 0;\r
249 if (this.viewToModel != null) {\r
250 recreateFrom = Math.min (rowCount, this.viewToModel.length);\r
251 if (this.viewToModel.length != rowCount) {\r
252 var oldViewToModel = this.viewToModel;\r
253 this.viewToModel =  new Array (rowCount);\r
254 System.arraycopy (oldViewToModel, 0, this.viewToModel, 0, recreateFrom);\r
255 }} else {\r
256 this.viewToModel =  new Array (rowCount);\r
257 }var i;\r
258 for (i = 0; i < recreateFrom; i++) {\r
259 this.viewToModel[i].modelIndex = i;\r
260 }\r
261 for (i = recreateFrom; i < rowCount; i++) {\r
262 this.viewToModel[i] =  new javax.swing.DefaultRowSorter.Row (this, i);\r
263 }\r
264 }, "~N");\r
265 Clazz.defineMethod (c$, "cacheSortKeys", \r
266  function (keys) {\r
267 var keySize = keys.size ();\r
268 this.sortComparators =  new Array (keySize);\r
269 for (var i = 0; i < keySize; i++) {\r
270 this.sortComparators[i] = this.getComparator0 (keys.get (i).getColumn ());\r
271 }\r
272 this.cachedSortKeys = keys.toArray ( new Array (keySize));\r
273 }, "java.util.List");\r
274 Clazz.defineMethod (c$, "useToString", \r
275 function (column) {\r
276 return (this.getComparator (column) == null);\r
277 }, "~N");\r
278 Clazz.defineMethod (c$, "setModelToViewFromViewToModel", \r
279  function (unsetFirst) {\r
280 var i;\r
281 if (unsetFirst) {\r
282 for (i = this.modelToView.length - 1; i >= 0; i--) {\r
283 this.modelToView[i] = -1;\r
284 }\r
285 }for (i = this.viewToModel.length - 1; i >= 0; i--) {\r
286 this.modelToView[this.viewToModel[i].modelIndex] = i;\r
287 }\r
288 }, "~B");\r
289 Clazz.defineMethod (c$, "getViewToModelAsInts", \r
290  function (viewToModel) {\r
291 if (viewToModel != null) {\r
292 var viewToModelI =  Clazz.newIntArray (viewToModel.length, 0);\r
293 for (var i = viewToModel.length - 1; i >= 0; i--) {\r
294 viewToModelI[i] = viewToModel[i].modelIndex;\r
295 }\r
296 return viewToModelI;\r
297 }return  Clazz.newIntArray (0, 0);\r
298 }, "~A");\r
299 Clazz.defineMethod (c$, "setComparator", \r
300 function (column, comparator) {\r
301 this.checkColumn (column);\r
302 if (this.comparators == null) {\r
303 this.comparators =  new Array (this.getModelWrapper ().getColumnCount ());\r
304 }this.comparators[column] = comparator;\r
305 }, "~N,java.util.Comparator");\r
306 Clazz.defineMethod (c$, "getComparator", \r
307 function (column) {\r
308 this.checkColumn (column);\r
309 if (this.comparators != null) {\r
310 return this.comparators[column];\r
311 }return null;\r
312 }, "~N");\r
313 Clazz.defineMethod (c$, "getComparator0", \r
314  function (column) {\r
315 var comparator = this.getComparator (column);\r
316 if (comparator != null) {\r
317 return comparator;\r
318 }return null;\r
319 }, "~N");\r
320 Clazz.defineMethod (c$, "getFilterEntry", \r
321  function (modelIndex) {\r
322 if (this.filterEntry == null) {\r
323 this.filterEntry = Clazz.innerTypeInstance (javax.swing.DefaultRowSorter.FilterEntry, this, null);\r
324 }this.filterEntry.modelIndex = modelIndex;\r
325 return this.filterEntry;\r
326 }, "~N");\r
327 Clazz.overrideMethod (c$, "getViewRowCount", \r
328 function () {\r
329 if (this.viewToModel != null) {\r
330 return this.viewToModel.length;\r
331 }return this.getModelWrapper ().getRowCount ();\r
332 });\r
333 Clazz.overrideMethod (c$, "getModelRowCount", \r
334 function () {\r
335 return this.getModelWrapper ().getRowCount ();\r
336 });\r
337 Clazz.defineMethod (c$, "allChanged", \r
338  function () {\r
339 this.modelToView = null;\r
340 this.viewToModel = null;\r
341 this.comparators = null;\r
342 this.$isSortable = null;\r
343 if (this.isUnsorted ()) {\r
344 this.sort ();\r
345 } else {\r
346 this.setSortKeys (null);\r
347 }});\r
348 Clazz.overrideMethod (c$, "modelStructureChanged", \r
349 function () {\r
350 this.allChanged ();\r
351 this.modelRowCount = this.getModelWrapper ().getRowCount ();\r
352 });\r
353 Clazz.overrideMethod (c$, "allRowsChanged", \r
354 function () {\r
355 this.modelRowCount = this.getModelWrapper ().getRowCount ();\r
356 this.sort ();\r
357 });\r
358 Clazz.overrideMethod (c$, "rowsInserted", \r
359 function (firstRow, endRow) {\r
360 this.checkAgainstModel (firstRow, endRow);\r
361 var newModelRowCount = this.getModelWrapper ().getRowCount ();\r
362 if (endRow >= newModelRowCount) {\r
363 throw  new IndexOutOfBoundsException ("Invalid range");\r
364 }this.modelRowCount = newModelRowCount;\r
365 if (this.shouldOptimizeChange (firstRow, endRow)) {\r
366 this.rowsInserted0 (firstRow, endRow);\r
367 }}, "~N,~N");\r
368 Clazz.overrideMethod (c$, "rowsDeleted", \r
369 function (firstRow, endRow) {\r
370 this.checkAgainstModel (firstRow, endRow);\r
371 if (firstRow >= this.modelRowCount || endRow >= this.modelRowCount) {\r
372 throw  new IndexOutOfBoundsException ("Invalid range");\r
373 }this.modelRowCount = this.getModelWrapper ().getRowCount ();\r
374 if (this.shouldOptimizeChange (firstRow, endRow)) {\r
375 this.rowsDeleted0 (firstRow, endRow);\r
376 }}, "~N,~N");\r
377 Clazz.defineMethod (c$, "rowsUpdated", \r
378 function (firstRow, endRow) {\r
379 this.checkAgainstModel (firstRow, endRow);\r
380 if (firstRow >= this.modelRowCount || endRow >= this.modelRowCount) {\r
381 throw  new IndexOutOfBoundsException ("Invalid range");\r
382 }if (this.getSortsOnUpdates ()) {\r
383 if (this.shouldOptimizeChange (firstRow, endRow)) {\r
384 this.rowsUpdated0 (firstRow, endRow);\r
385 }} else {\r
386 this.sorted = false;\r
387 }}, "~N,~N");\r
388 Clazz.defineMethod (c$, "rowsUpdated", \r
389 function (firstRow, endRow, column) {\r
390 this.checkColumn (column);\r
391 this.rowsUpdated (firstRow, endRow);\r
392 }, "~N,~N,~N");\r
393 Clazz.defineMethod (c$, "checkAgainstModel", \r
394  function (firstRow, endRow) {\r
395 if (firstRow > endRow || firstRow < 0 || endRow < 0 || firstRow > this.modelRowCount) {\r
396 throw  new IndexOutOfBoundsException ("Invalid range");\r
397 }}, "~N,~N");\r
398 Clazz.defineMethod (c$, "include", \r
399  function (row) {\r
400 var filter = this.getRowFilter ();\r
401 if (filter != null) {\r
402 return filter.include (this.getFilterEntry (row));\r
403 }return true;\r
404 }, "~N");\r
405 Clazz.defineMethod (c$, "isTransformed", \r
406  function () {\r
407 return (this.viewToModel != null);\r
408 });\r
409 Clazz.defineMethod (c$, "insertInOrder", \r
410  function (toAdd, current) {\r
411 var last = 0;\r
412 var index;\r
413 var max = toAdd.size ();\r
414 for (var i = 0; i < max; i++) {\r
415 index = java.util.Arrays.binarySearch (current, toAdd.get (i));\r
416 if (index < 0) {\r
417 index = -1 - index;\r
418 }System.arraycopy (current, last, this.viewToModel, last + i, index - last);\r
419 this.viewToModel[index + i] = toAdd.get (i);\r
420 last = index;\r
421 }\r
422 System.arraycopy (current, last, this.viewToModel, last + max, current.length - last);\r
423 }, "java.util.List,~A");\r
424 Clazz.defineMethod (c$, "shouldOptimizeChange", \r
425  function (firstRow, lastRow) {\r
426 if (!this.isTransformed ()) {\r
427 return false;\r
428 }if (!this.sorted || (lastRow - firstRow) > Clazz.doubleToInt (this.viewToModel.length / 10)) {\r
429 this.sort ();\r
430 return false;\r
431 }return true;\r
432 }, "~N,~N");\r
433 Clazz.defineMethod (c$, "rowsInserted0", \r
434  function (firstRow, lastRow) {\r
435 var oldViewToModel = this.getViewToModelAsInts (this.viewToModel);\r
436 var i;\r
437 var delta = (lastRow - firstRow) + 1;\r
438 var added =  new java.util.ArrayList (delta);\r
439 for (i = firstRow; i <= lastRow; i++) {\r
440 if (this.include (i)) {\r
441 added.add ( new javax.swing.DefaultRowSorter.Row (this, i));\r
442 }}\r
443 var viewIndex;\r
444 for (i = this.modelToView.length - 1; i >= firstRow; i--) {\r
445 viewIndex = this.modelToView[i];\r
446 if (viewIndex != -1) {\r
447 this.viewToModel[viewIndex].modelIndex += delta;\r
448 }}\r
449 if (added.size () > 0) {\r
450 java.util.Collections.sort (added);\r
451 var lastViewToModel = this.viewToModel;\r
452 this.viewToModel =  new Array (this.viewToModel.length + added.size ());\r
453 this.insertInOrder (added, lastViewToModel);\r
454 }this.createModelToView (this.getModelWrapper ().getRowCount ());\r
455 this.setModelToViewFromViewToModel (true);\r
456 this.fireRowSorterChanged (oldViewToModel);\r
457 }, "~N,~N");\r
458 Clazz.defineMethod (c$, "rowsDeleted0", \r
459  function (firstRow, lastRow) {\r
460 var oldViewToModel = this.getViewToModelAsInts (this.viewToModel);\r
461 var removedFromView = 0;\r
462 var i;\r
463 var viewIndex;\r
464 for (i = firstRow; i <= lastRow; i++) {\r
465 viewIndex = this.modelToView[i];\r
466 if (viewIndex != -1) {\r
467 removedFromView++;\r
468 this.viewToModel[viewIndex] = null;\r
469 }}\r
470 var delta = lastRow - firstRow + 1;\r
471 for (i = this.modelToView.length - 1; i > lastRow; i--) {\r
472 viewIndex = this.modelToView[i];\r
473 if (viewIndex != -1) {\r
474 this.viewToModel[viewIndex].modelIndex -= delta;\r
475 }}\r
476 if (removedFromView > 0) {\r
477 var newViewToModel =  new Array (this.viewToModel.length - removedFromView);\r
478 var newIndex = 0;\r
479 var last = 0;\r
480 for (i = 0; i < this.viewToModel.length; i++) {\r
481 if (this.viewToModel[i] == null) {\r
482 System.arraycopy (this.viewToModel, last, newViewToModel, newIndex, i - last);\r
483 newIndex += (i - last);\r
484 last = i + 1;\r
485 }}\r
486 System.arraycopy (this.viewToModel, last, newViewToModel, newIndex, this.viewToModel.length - last);\r
487 this.viewToModel = newViewToModel;\r
488 }this.createModelToView (this.getModelWrapper ().getRowCount ());\r
489 this.setModelToViewFromViewToModel (true);\r
490 this.fireRowSorterChanged (oldViewToModel);\r
491 }, "~N,~N");\r
492 Clazz.defineMethod (c$, "rowsUpdated0", \r
493  function (firstRow, lastRow) {\r
494 var oldViewToModel = this.getViewToModelAsInts (this.viewToModel);\r
495 var i;\r
496 var j;\r
497 var delta = lastRow - firstRow + 1;\r
498 var modelIndex;\r
499 if (this.getRowFilter () == null) {\r
500 var updated =  new Array (delta);\r
501 for (j = 0, i = firstRow; i <= lastRow; i++, j++) {\r
502 updated[j] = this.viewToModel[this.modelToView[i]];\r
503 }\r
504 java.util.Arrays.sort (updated);\r
505 var intermediary =  new Array (this.viewToModel.length - delta);\r
506 for (i = 0, j = 0; i < this.viewToModel.length; i++) {\r
507 modelIndex = this.viewToModel[i].modelIndex;\r
508 if (modelIndex < firstRow || modelIndex > lastRow) {\r
509 intermediary[j++] = this.viewToModel[i];\r
510 }}\r
511 this.insertInOrder (java.util.Arrays.asList (updated), intermediary);\r
512 this.setModelToViewFromViewToModel (false);\r
513 } else {\r
514 var updated =  new java.util.ArrayList (delta);\r
515 var newlyVisible = 0;\r
516 var newlyHidden = 0;\r
517 var effected = 0;\r
518 for (i = firstRow; i <= lastRow; i++) {\r
519 if (this.modelToView[i] == -1) {\r
520 if (this.include (i)) {\r
521 updated.add ( new javax.swing.DefaultRowSorter.Row (this, i));\r
522 newlyVisible++;\r
523 }} else {\r
524 if (!this.include (i)) {\r
525 newlyHidden++;\r
526 } else {\r
527 updated.add (this.viewToModel[this.modelToView[i]]);\r
528 }this.modelToView[i] = -2;\r
529 effected++;\r
530 }}\r
531 java.util.Collections.sort (updated);\r
532 var intermediary =  new Array (this.viewToModel.length - effected);\r
533 for (i = 0, j = 0; i < this.viewToModel.length; i++) {\r
534 modelIndex = this.viewToModel[i].modelIndex;\r
535 if (this.modelToView[modelIndex] != -2) {\r
536 intermediary[j++] = this.viewToModel[i];\r
537 }}\r
538 if (newlyVisible != newlyHidden) {\r
539 this.viewToModel =  new Array (this.viewToModel.length + newlyVisible - newlyHidden);\r
540 }this.insertInOrder (updated, intermediary);\r
541 this.setModelToViewFromViewToModel (true);\r
542 }this.fireRowSorterChanged (oldViewToModel);\r
543 }, "~N,~N");\r
544 Clazz.defineMethod (c$, "checkColumn", \r
545  function (column) {\r
546 if (column < 0 || column >= this.getModelWrapper ().getColumnCount ()) {\r
547 throw  new IndexOutOfBoundsException ("column beyond range of TableModel");\r
548 }}, "~N");\r
549 c$.$DefaultRowSorter$FilterEntry$ = function () {\r
550 Clazz.pu$h(self.c$);\r
551 c$ = Clazz.decorateAsClass (function () {\r
552 Clazz.prepareCallback (this, arguments);\r
553 this.modelIndex = 0;\r
554 Clazz.instantialize (this, arguments);\r
555 }, javax.swing.DefaultRowSorter, "FilterEntry", javax.swing.RowFilter.Entry);\r
556 Clazz.overrideMethod (c$, "getModel", \r
557 function () {\r
558 return this.b$["javax.swing.DefaultRowSorter"].getModelWrapper ().getModel ();\r
559 });\r
560 Clazz.overrideMethod (c$, "getValueCount", \r
561 function () {\r
562 return this.b$["javax.swing.DefaultRowSorter"].getModelWrapper ().getColumnCount ();\r
563 });\r
564 Clazz.overrideMethod (c$, "getValue", \r
565 function (a) {\r
566 return this.b$["javax.swing.DefaultRowSorter"].getModelWrapper ().getValueAt (this.modelIndex, a);\r
567 }, "~N");\r
568 Clazz.overrideMethod (c$, "getStringValue", \r
569 function (a) {\r
570 return this.b$["javax.swing.DefaultRowSorter"].getModelWrapper ().getStringValueAt (this.modelIndex, a);\r
571 }, "~N");\r
572 Clazz.overrideMethod (c$, "getIdentifier", \r
573 function () {\r
574 return this.b$["javax.swing.DefaultRowSorter"].getModelWrapper ().getIdentifier (this.modelIndex);\r
575 });\r
576 c$ = Clazz.p0p ();\r
577 };\r
578 Clazz.pu$h(self.c$);\r
579 c$ = Clazz.declareType (javax.swing.DefaultRowSorter, "ModelWrapper");\r
580 Clazz.makeConstructor (c$, \r
581 function () {\r
582 });\r
583 Clazz.defineMethod (c$, "getStringValueAt", \r
584 function (a, b) {\r
585 var c = this.getValueAt (a, b);\r
586 if (c == null) {\r
587 return "";\r
588 }var d = c.toString ();\r
589 if (d == null) {\r
590 return "";\r
591 }return d;\r
592 }, "~N,~N");\r
593 c$ = Clazz.p0p ();\r
594 Clazz.pu$h(self.c$);\r
595 c$ = Clazz.decorateAsClass (function () {\r
596 this.sorter = null;\r
597 this.modelIndex = 0;\r
598 Clazz.instantialize (this, arguments);\r
599 }, javax.swing.DefaultRowSorter, "Row", null, Comparable);\r
600 Clazz.makeConstructor (c$, \r
601 function (a, b) {\r
602 this.sorter = a;\r
603 this.modelIndex = b;\r
604 }, "javax.swing.DefaultRowSorter,~N");\r
605 Clazz.overrideMethod (c$, "compareTo", \r
606 function (a) {\r
607 return this.sorter.compare (this.modelIndex, a.modelIndex);\r
608 }, "javax.swing.DefaultRowSorter.Row");\r
609 c$ = Clazz.p0p ();\r
610 });\r