1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.JComponent", "$.Scrollable", "javax.swing.event.ListSelectionListener"], "javax.swing.JList", ["java.lang.IllegalArgumentException", "java.awt.Component", "$.Dimension", "$.Point", "java.awt.event.MouseEvent", "javax.swing.AbstractListModel", "$.DefaultListSelectionModel", "$.JViewport", "$.SwingUtilities", "$.UIManager", "javax.swing.event.ListSelectionEvent", "javax.swing.text.Position"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.fixedCellWidth = -1;
5 this.fixedCellHeight = -1;
6 this.horizontalScrollIncrement = -1;
7 this.prototypeCellValue = null;
8 this.visibleRowCount = 8;
9 this.selectionForeground = null;
10 this.selectionBackground = null;
11 this.dragEnabled = false;
12 this.selectionModel = null;
13 this.dataModel = null;
14 this.cellRenderer = null;
15 this.selectionListener = null;
16 this.layoutOrientation = 0;
17 if (!Clazz.isClassDefined ("javax.swing.JList.ListSelectionHandler")) {
18 javax.swing.JList.$JList$ListSelectionHandler$ ();
20 Clazz.instantialize (this, arguments);
21 }, javax.swing, "JList", javax.swing.JComponent, javax.swing.Scrollable);
22 Clazz.makeConstructor (c$,
23 function (dataModel) {
24 Clazz.superConstructor (this, javax.swing.JList, []);
25 if (dataModel == null) {
26 throw new IllegalArgumentException ("dataModel must be non null");
27 }this.layoutOrientation = 0;
28 this.dataModel = dataModel;
29 this.selectionModel = this.createSelectionModel ();
30 this.setAutoscrolls (true);
31 this.setOpaque (true);
33 }, "javax.swing.ListModel");
34 Clazz.makeConstructor (c$,
36 this.construct (((Clazz.isClassDefined ("javax.swing.JList$1") ? 0 : javax.swing.JList.$JList$1$ ()), Clazz.innerTypeInstance (javax.swing.JList$1, this, Clazz.cloneFinals ("listData", listData))));
38 Clazz.makeConstructor (c$,
40 this.construct (((Clazz.isClassDefined ("javax.swing.JList$2") ? 0 : javax.swing.JList.$JList$2$ ()), Clazz.innerTypeInstance (javax.swing.JList$2, this, Clazz.cloneFinals ("listData", listData))));
41 }, "java.util.Vector");
42 Clazz.makeConstructor (c$,
44 this.construct (((Clazz.isClassDefined ("javax.swing.JList$3") ? 0 : javax.swing.JList.$JList$3$ ()), Clazz.innerTypeInstance (javax.swing.JList$3, this, null)));
46 Clazz.overrideMethod (c$, "getUI",
50 Clazz.overrideMethod (c$, "updateUI",
52 this.setUI (javax.swing.UIManager.getUI (this));
53 var renderer = this.getCellRenderer ();
54 if (Clazz.instanceOf (renderer, java.awt.Component)) {
55 javax.swing.SwingUtilities.updateComponentTreeUI (renderer);
57 Clazz.overrideMethod (c$, "getUIClassID",
61 Clazz.defineMethod (c$, "updateFixedCellSize",
63 var cr = this.getCellRenderer ();
64 var value = this.getPrototypeCellValue ();
65 if ((cr != null) && (value != null)) {
66 var c = cr.getListCellRendererComponent (this, value, 0, false, false);
68 c.setFont (this.getFont ());
69 var d = c.getPreferredSize ();
70 this.fixedCellWidth = d.width;
71 this.fixedCellHeight = d.height;
74 Clazz.defineMethod (c$, "getPrototypeCellValue",
76 return this.prototypeCellValue;
78 Clazz.defineMethod (c$, "setPrototypeCellValue",
79 function (prototypeCellValue) {
80 var oldValue = this.prototypeCellValue;
81 this.prototypeCellValue = prototypeCellValue;
82 if ((prototypeCellValue != null) && !prototypeCellValue.equals (oldValue)) {
83 this.updateFixedCellSize ();
84 }this.firePropertyChangeObject ("prototypeCellValue", oldValue, prototypeCellValue);
86 Clazz.defineMethod (c$, "getFixedCellWidth",
88 return this.fixedCellWidth;
90 Clazz.defineMethod (c$, "setFixedCellWidth",
92 var oldValue = this.fixedCellWidth;
93 this.fixedCellWidth = width;
94 this.firePropertyChangeInt ("fixedCellWidth", oldValue, this.fixedCellWidth);
96 Clazz.defineMethod (c$, "getFixedCellHeight",
98 return this.fixedCellHeight;
100 Clazz.defineMethod (c$, "setFixedCellHeight",
102 var oldValue = this.fixedCellHeight;
103 this.fixedCellHeight = height;
104 this.firePropertyChangeInt ("fixedCellHeight", oldValue, this.fixedCellHeight);
106 Clazz.defineMethod (c$, "getCellRenderer",
108 return this.cellRenderer;
110 Clazz.defineMethod (c$, "setCellRenderer",
111 function (cellRenderer) {
112 var oldValue = this.cellRenderer;
113 this.cellRenderer = cellRenderer;
114 if ((cellRenderer != null) && !cellRenderer.equals (oldValue)) {
115 this.updateFixedCellSize ();
116 }this.firePropertyChangeObject ("cellRenderer", oldValue, cellRenderer);
117 }, "javax.swing.ListCellRenderer");
118 Clazz.defineMethod (c$, "getSelectionForeground",
120 return this.selectionForeground;
122 Clazz.defineMethod (c$, "setSelectionForeground",
123 function (selectionForeground) {
124 var oldValue = this.selectionForeground;
125 this.selectionForeground = selectionForeground;
126 this.firePropertyChangeObject ("selectionForeground", oldValue, selectionForeground);
127 }, "java.awt.Color");
128 Clazz.defineMethod (c$, "getSelectionBackground",
130 return this.selectionBackground;
132 Clazz.defineMethod (c$, "setSelectionBackground",
133 function (selectionBackground) {
134 var oldValue = this.selectionBackground;
135 this.selectionBackground = selectionBackground;
136 this.firePropertyChangeObject ("selectionBackground", oldValue, selectionBackground);
137 }, "java.awt.Color");
138 Clazz.defineMethod (c$, "getVisibleRowCount",
140 return this.visibleRowCount;
142 Clazz.defineMethod (c$, "setVisibleRowCount",
143 function (visibleRowCount) {
144 var oldValue = this.visibleRowCount;
145 this.visibleRowCount = Math.max (0, visibleRowCount);
146 this.firePropertyChangeInt ("visibleRowCount", oldValue, visibleRowCount);
148 Clazz.defineMethod (c$, "getLayoutOrientation",
150 return this.layoutOrientation;
152 Clazz.defineMethod (c$, "setLayoutOrientation",
153 function (layoutOrientation) {
154 var oldValue = this.layoutOrientation;
155 switch (layoutOrientation) {
159 this.layoutOrientation = layoutOrientation;
160 this.firePropertyChangeInt ("layoutOrientation", oldValue, layoutOrientation);
163 throw new IllegalArgumentException ("layoutOrientation must be one of: VERTICAL, HORIZONTAL_WRAP or VERTICAL_WRAP");
166 Clazz.defineMethod (c$, "getFirstVisibleIndex",
168 var r = this.getVisibleRect ();
170 if (this.getComponentOrientation ().isLeftToRight ()) {
171 first = this.locationToIndex (r.getLocation ());
173 first = this.locationToIndex ( new java.awt.Point ((r.x + r.width) - 1, r.y));
175 var bounds = this.getCellBounds (first, first);
176 if (bounds != null) {
177 javax.swing.SwingUtilities.computeIntersection (r.x, r.y, r.width, r.height, bounds);
178 if (bounds.width == 0 || bounds.height == 0) {
182 Clazz.defineMethod (c$, "getLastVisibleIndex",
184 var leftToRight = this.getComponentOrientation ().isLeftToRight ();
185 var r = this.getVisibleRect ();
188 lastPoint = new java.awt.Point ((r.x + r.width) - 1, (r.y + r.height) - 1);
190 lastPoint = new java.awt.Point (r.x, (r.y + r.height) - 1);
191 }var location = this.locationToIndex (lastPoint);
192 if (location != -1) {
193 var bounds = this.getCellBounds (location, location);
194 if (bounds != null) {
195 javax.swing.SwingUtilities.computeIntersection (r.x, r.y, r.width, r.height, bounds);
196 if (bounds.width == 0 || bounds.height == 0) {
197 var isHorizontalWrap = (this.getLayoutOrientation () == 2);
198 var visibleLocation = isHorizontalWrap ? new java.awt.Point (lastPoint.x, r.y) : new java.awt.Point (r.x, lastPoint.y);
201 var lIndex = location;
205 visIndex = this.locationToIndex (visibleLocation);
206 if (visIndex != -1) {
207 bounds = this.getCellBounds (visIndex, visIndex);
208 if (visIndex != lIndex && bounds != null && bounds.contains (visibleLocation)) {
210 if (isHorizontalWrap) {
211 visibleLocation.y = bounds.y + bounds.height;
212 if (visibleLocation.y >= lastPoint.y) {
215 visibleLocation.x = bounds.x + bounds.width;
216 if (visibleLocation.x >= lastPoint.x) {
220 }}} while (visIndex != -1 && last != visIndex);
223 Clazz.defineMethod (c$, "ensureIndexIsVisible",
225 var cellBounds = this.getCellBounds (index, index);
226 if (cellBounds != null) {
227 this.scrollRectToVisible (cellBounds);
229 Clazz.defineMethod (c$, "setDragEnabled",
231 this.dragEnabled = b;
233 Clazz.defineMethod (c$, "getDragEnabled",
235 return this.dragEnabled;
237 Clazz.defineMethod (c$, "getNextMatch",
238 function (prefix, startIndex, bias) {
239 var model = this.getModel ();
240 var max = model.getSize ();
241 if (prefix == null) {
242 throw new IllegalArgumentException ();
243 }if (startIndex < 0 || startIndex >= max) {
244 throw new IllegalArgumentException ();
245 }prefix = prefix.toUpperCase ();
246 var increment = (bias === javax.swing.text.Position.Bias.Forward) ? 1 : -1;
247 var index = startIndex;
249 var o = model.getElementAt (index);
252 if (Clazz.instanceOf (o, String)) {
253 string = (o).toUpperCase ();
255 string = o.toString ();
256 if (string != null) {
257 string = string.toUpperCase ();
258 }}if (string != null && string.startsWith (prefix)) {
260 }}index = (index + increment + max) % max;
261 } while (index != startIndex);
263 }, "~S,~N,javax.swing.text.Position.Bias");
264 Clazz.defineMethod (c$, "getToolTipText",
267 var p = event.getPoint ();
268 var index = this.locationToIndex (p);
269 var r = this.getCellRenderer ();
271 if (index != -1 && r != null && (cellBounds = this.getCellBounds (index, index)) != null && cellBounds.contains (p.x, p.y)) {
272 var lsm = this.getSelectionModel ();
273 var rComponent = r.getListCellRendererComponent (this, this.getModel ().getElementAt (index), index, lsm.isSelectedIndex (index), (this.hasFocus () && (lsm.getLeadSelectionIndex () == index)));
274 if (Clazz.instanceOf (rComponent, javax.swing.JComponent)) {
276 p.translate (-cellBounds.x, -cellBounds.y);
277 newEvent = new java.awt.event.MouseEvent (rComponent, event.getID (), event.getWhen (), event.getModifiers (), p.x, p.y, event.getXOnScreen (), event.getYOnScreen (), event.getClickCount (), event.isPopupTrigger (), 0);
278 var tip = (rComponent).getToolTipText (newEvent);
281 }}}}return Clazz.superCall (this, javax.swing.JList, "getToolTipText", []);
282 }, "java.awt.event.MouseEvent");
283 Clazz.defineMethod (c$, "locationToIndex",
284 function (location) {
285 var ui = this.getUI ();
286 return (ui != null) ? ui.locationToIndex (this, location) : -1;
287 }, "java.awt.Point");
288 Clazz.defineMethod (c$, "indexToLocation",
290 var ui = this.getUI ();
291 return (ui != null) ? ui.indexToLocation (this, index) : null;
293 Clazz.defineMethod (c$, "getCellBounds",
294 function (index0, index1) {
295 var ui = this.getUI ();
296 return (ui != null) ? ui.getCellBounds (this, index0, index1) : null;
298 Clazz.defineMethod (c$, "getModel",
300 return this.dataModel;
302 Clazz.defineMethod (c$, "setModel",
305 throw new IllegalArgumentException ("model must be non null");
306 }var oldValue = this.dataModel;
307 this.dataModel = model;
308 this.firePropertyChangeObject ("model", oldValue, this.dataModel);
309 this.clearSelection ();
310 }, "javax.swing.ListModel");
311 Clazz.defineMethod (c$, "setListData",
312 function (listData) {
313 this.setModel (((Clazz.isClassDefined ("javax.swing.JList$4") ? 0 : javax.swing.JList.$JList$4$ ()), Clazz.innerTypeInstance (javax.swing.JList$4, this, Clazz.cloneFinals ("listData", listData))));
315 Clazz.defineMethod (c$, "setListData",
316 function (listData) {
317 this.setModel (((Clazz.isClassDefined ("javax.swing.JList$5") ? 0 : javax.swing.JList.$JList$5$ ()), Clazz.innerTypeInstance (javax.swing.JList$5, this, Clazz.cloneFinals ("listData", listData))));
318 }, "java.util.Vector");
319 Clazz.defineMethod (c$, "createSelectionModel",
321 return new javax.swing.DefaultListSelectionModel ();
323 Clazz.defineMethod (c$, "getSelectionModel",
325 return this.selectionModel;
327 Clazz.defineMethod (c$, "fireSelectionValueChanged",
328 function (firstIndex, lastIndex, isAdjusting) {
329 var listeners = this.listenerList.getListenerList ();
331 for (var i = listeners.length - 2; i >= 0; i -= 2) {
332 if (listeners[i] === javax.swing.event.ListSelectionListener) {
334 e = new javax.swing.event.ListSelectionEvent (this, firstIndex, lastIndex, isAdjusting);
335 }(listeners[i + 1]).valueChanged (e);
338 Clazz.defineMethod (c$, "addListSelectionListener",
339 function (listener) {
340 if (this.selectionListener == null) {
341 this.selectionListener = Clazz.innerTypeInstance (javax.swing.JList.ListSelectionHandler, this, null);
342 this.getSelectionModel ().addListSelectionListener (this.selectionListener);
343 }this.listenerList.add (javax.swing.event.ListSelectionListener, listener);
344 }, "javax.swing.event.ListSelectionListener");
345 Clazz.defineMethod (c$, "removeListSelectionListener",
346 function (listener) {
347 this.listenerList.remove (javax.swing.event.ListSelectionListener, listener);
348 }, "javax.swing.event.ListSelectionListener");
349 Clazz.defineMethod (c$, "getListSelectionListeners",
351 return this.listenerList.getListeners (javax.swing.event.ListSelectionListener);
353 Clazz.defineMethod (c$, "setSelectionModel",
354 function (selectionModel) {
355 if (selectionModel == null) {
356 throw new IllegalArgumentException ("selectionModel must be non null");
357 }if (this.selectionListener != null) {
358 this.selectionModel.removeListSelectionListener (this.selectionListener);
359 selectionModel.addListSelectionListener (this.selectionListener);
360 }var oldValue = this.selectionModel;
361 this.selectionModel = selectionModel;
362 this.firePropertyChangeObject ("selectionModel", oldValue, selectionModel);
363 }, "javax.swing.ListSelectionModel");
364 Clazz.defineMethod (c$, "setSelectionMode",
365 function (selectionMode) {
366 this.getSelectionModel ().setSelectionMode (selectionMode);
368 Clazz.defineMethod (c$, "getSelectionMode",
370 return this.getSelectionModel ().getSelectionMode ();
372 Clazz.defineMethod (c$, "getAnchorSelectionIndex",
374 return this.getSelectionModel ().getAnchorSelectionIndex ();
376 Clazz.defineMethod (c$, "getLeadSelectionIndex",
378 return this.getSelectionModel ().getLeadSelectionIndex ();
380 Clazz.defineMethod (c$, "getMinSelectionIndex",
382 return this.getSelectionModel ().getMinSelectionIndex ();
384 Clazz.defineMethod (c$, "getMaxSelectionIndex",
386 return this.getSelectionModel ().getMaxSelectionIndex ();
388 Clazz.defineMethod (c$, "isSelectedIndex",
390 return this.getSelectionModel ().isSelectedIndex (index);
392 Clazz.defineMethod (c$, "isSelectionEmpty",
394 return this.getSelectionModel ().isSelectionEmpty ();
396 Clazz.defineMethod (c$, "clearSelection",
398 this.getSelectionModel ().clearSelection ();
400 Clazz.defineMethod (c$, "setSelectionInterval",
401 function (anchor, lead) {
402 this.getSelectionModel ().setSelectionInterval (anchor, lead);
404 Clazz.defineMethod (c$, "addSelectionInterval",
405 function (anchor, lead) {
406 this.getSelectionModel ().addSelectionInterval (anchor, lead);
408 Clazz.defineMethod (c$, "removeSelectionInterval",
409 function (index0, index1) {
410 this.getSelectionModel ().removeSelectionInterval (index0, index1);
412 Clazz.defineMethod (c$, "setValueIsAdjusting",
414 this.getSelectionModel ().setValueIsAdjusting (b);
416 Clazz.defineMethod (c$, "getValueIsAdjusting",
418 return this.getSelectionModel ().getValueIsAdjusting ();
420 Clazz.defineMethod (c$, "getSelectedIndices",
422 var sm = this.getSelectionModel ();
423 var iMin = sm.getMinSelectionIndex ();
424 var iMax = sm.getMaxSelectionIndex ();
425 if ((iMin < 0) || (iMax < 0)) {
426 return Clazz.newIntArray (0, 0);
427 }var rvTmp = Clazz.newIntArray (1 + (iMax - iMin), 0);
429 for (var i = iMin; i <= iMax; i++) {
430 if (sm.isSelectedIndex (i)) {
433 var rv = Clazz.newIntArray (n, 0);
434 System.arraycopy (rvTmp, 0, rv, 0, n);
437 Clazz.defineMethod (c$, "setSelectedIndex",
439 if (index >= this.getModel ().getSize ()) {
441 }this.getSelectionModel ().setSelectionInterval (index, index);
443 Clazz.defineMethod (c$, "setSelectedIndices",
445 var sm = this.getSelectionModel ();
446 sm.clearSelection ();
447 var size = this.getModel ().getSize ();
448 for (var i = 0; i < indices.length; i++) {
449 if (indices[i] < size) {
450 sm.addSelectionInterval (indices[i], indices[i]);
453 Clazz.defineMethod (c$, "getSelectedValues",
455 var sm = this.getSelectionModel ();
456 var dm = this.getModel ();
457 var iMin = sm.getMinSelectionIndex ();
458 var iMax = sm.getMaxSelectionIndex ();
459 if ((iMin < 0) || (iMax < 0)) {
460 return new Array (0);
461 }var rvTmp = new Array (1 + (iMax - iMin));
463 for (var i = iMin; i <= iMax; i++) {
464 if (sm.isSelectedIndex (i)) {
465 rvTmp[n++] = dm.getElementAt (i);
467 var rv = new Array (n);
468 System.arraycopy (rvTmp, 0, rv, 0, n);
471 Clazz.defineMethod (c$, "getSelectedIndex",
473 return this.getMinSelectionIndex ();
475 Clazz.defineMethod (c$, "getSelectedValue",
477 var i = this.getMinSelectionIndex ();
478 return (i == -1) ? null : this.getModel ().getElementAt (i);
480 Clazz.defineMethod (c$, "setSelectedValue",
481 function (anObject, shouldScroll) {
482 if (anObject == null) this.setSelectedIndex (-1);
483 else if (!anObject.equals (this.getSelectedValue ())) {
486 var dm = this.getModel ();
487 for (i = 0, c = dm.getSize (); i < c; i++) if (anObject.equals (dm.getElementAt (i))) {
488 this.setSelectedIndex (i);
489 if (shouldScroll) this.ensureIndexIsVisible (i);
493 this.setSelectedIndex (-1);
496 Clazz.defineMethod (c$, "checkScrollableParameters",
497 function (visibleRect, orientation) {
498 if (visibleRect == null) {
499 throw new IllegalArgumentException ("visibleRect must be non-null");
500 }switch (orientation) {
505 throw new IllegalArgumentException ("orientation must be one of: VERTICAL, HORIZONTAL");
507 }, "java.awt.Rectangle,~N");
508 Clazz.overrideMethod (c$, "getPreferredScrollableViewportSize",
510 if (this.getLayoutOrientation () != 0) {
511 return this.getPreferredSize ();
512 }var insets = this.getInsets ();
513 var dx = insets.left + insets.right;
514 var dy = insets.top + insets.bottom;
515 var visibleRowCount = this.getVisibleRowCount ();
516 var fixedCellWidth = this.getFixedCellWidth ();
517 var fixedCellHeight = this.getFixedCellHeight ();
518 if ((fixedCellWidth > 0) && (fixedCellHeight > 0)) {
519 var width = fixedCellWidth + dx;
520 var height = (visibleRowCount * fixedCellHeight) + dy;
521 return new java.awt.Dimension (width, height);
522 } else if (this.getModel ().getSize () > 0) {
523 var width = this.getPreferredSize ().width;
525 var r = this.getCellBounds (0, 0);
527 height = (visibleRowCount * r.height) + dy;
530 }return new java.awt.Dimension (width, height);
532 fixedCellWidth = (fixedCellWidth > 0) ? fixedCellWidth : 256;
533 fixedCellHeight = (fixedCellHeight > 0) ? fixedCellHeight : 16;
534 return new java.awt.Dimension (fixedCellWidth, fixedCellHeight * visibleRowCount);
536 Clazz.overrideMethod (c$, "getScrollableUnitIncrement",
537 function (visibleRect, orientation, direction) {
538 this.checkScrollableParameters (visibleRect, orientation);
539 if (orientation == 1) {
540 var row = this.locationToIndex (visibleRect.getLocation ());
545 var r = this.getCellBounds (row, row);
546 return (r == null) ? 0 : r.height - (visibleRect.y - r.y);
548 var r = this.getCellBounds (row, row);
549 if ((r.y == visibleRect.y) && (row == 0)) {
551 } else if (r.y == visibleRect.y) {
552 var loc = r.getLocation ();
554 var prevIndex = this.locationToIndex (loc);
555 var prevR = this.getCellBounds (prevIndex, prevIndex);
556 if (prevR == null || prevR.y >= r.y) {
558 }return prevR.height;
560 return visibleRect.y - r.y;
561 }}}} else if (orientation == 0 && this.getLayoutOrientation () != 0) {
562 var leftToRight = this.getComponentOrientation ().isLeftToRight ();
566 leadingPoint = visibleRect.getLocation ();
568 leadingPoint = new java.awt.Point (visibleRect.x + visibleRect.width - 1, visibleRect.y);
569 }index = this.locationToIndex (leadingPoint);
571 var cellBounds = this.getCellBounds (index, index);
572 if (cellBounds != null && cellBounds.contains (leadingPoint)) {
573 var leadingVisibleEdge;
576 leadingVisibleEdge = visibleRect.x;
577 leadingCellEdge = cellBounds.x;
579 leadingVisibleEdge = visibleRect.x + visibleRect.width;
580 leadingCellEdge = cellBounds.x + cellBounds.width;
581 }if (leadingCellEdge != leadingVisibleEdge) {
583 return Math.abs (leadingVisibleEdge - leadingCellEdge);
584 } else if (leftToRight) {
585 return leadingCellEdge + cellBounds.width - leadingVisibleEdge;
587 return leadingVisibleEdge - cellBounds.x;
588 }}return cellBounds.width;
589 }}}var f = this.getFont ();
590 return (f != null) ? f.getSize () : 1;
591 }, "java.awt.Rectangle,~N,~N");
592 Clazz.overrideMethod (c$, "getScrollableBlockIncrement",
593 function (visibleRect, orientation, direction) {
594 this.checkScrollableParameters (visibleRect, orientation);
595 if (orientation == 1) {
596 var inc = visibleRect.height;
598 var last = this.locationToIndex ( new java.awt.Point (visibleRect.x, visibleRect.y + visibleRect.height - 1));
600 var lastRect = this.getCellBounds (last, last);
601 if (lastRect != null) {
602 inc = lastRect.y - visibleRect.y;
603 if ((inc == 0) && (last < this.getModel ().getSize () - 1)) {
604 inc = lastRect.height;
606 var newFirst = this.locationToIndex ( new java.awt.Point (visibleRect.x, visibleRect.y - visibleRect.height));
607 var first = this.getFirstVisibleIndex ();
608 if (newFirst != -1) {
610 first = this.locationToIndex (visibleRect.getLocation ());
611 }var newFirstRect = this.getCellBounds (newFirst, newFirst);
612 var firstRect = this.getCellBounds (first, first);
613 if ((newFirstRect != null) && (firstRect != null)) {
614 while ((newFirstRect.y + visibleRect.height < firstRect.y + firstRect.height) && (newFirstRect.y < firstRect.y)) {
616 newFirstRect = this.getCellBounds (newFirst, newFirst);
618 inc = visibleRect.y - newFirstRect.y;
619 if ((inc <= 0) && (newFirstRect.y > 0)) {
621 newFirstRect = this.getCellBounds (newFirst, newFirst);
622 if (newFirstRect != null) {
623 inc = visibleRect.y - newFirstRect.y;
625 } else if (orientation == 0 && this.getLayoutOrientation () != 0) {
626 var leftToRight = this.getComponentOrientation ().isLeftToRight ();
627 var inc = visibleRect.width;
629 var x = visibleRect.x + (leftToRight ? (visibleRect.width - 1) : 0);
630 var last = this.locationToIndex ( new java.awt.Point (x, visibleRect.y));
632 var lastRect = this.getCellBounds (last, last);
633 if (lastRect != null) {
635 inc = lastRect.x - visibleRect.x;
637 inc = visibleRect.x + visibleRect.width - (lastRect.x + lastRect.width);
639 inc += lastRect.width;
640 } else if ((inc == 0) && (last < this.getModel ().getSize () - 1)) {
641 inc = lastRect.width;
643 var x = visibleRect.x + (leftToRight ? -visibleRect.width : visibleRect.width - 1 + visibleRect.width);
644 var first = this.locationToIndex ( new java.awt.Point (x, visibleRect.y));
646 var firstRect = this.getCellBounds (first, first);
647 if (firstRect != null) {
648 var firstRight = firstRect.x + firstRect.width;
650 if ((firstRect.x < visibleRect.x - visibleRect.width) && (firstRight < visibleRect.x)) {
651 inc = visibleRect.x - firstRight;
653 inc = visibleRect.x - firstRect.x;
655 var visibleRight = visibleRect.x + visibleRect.width;
656 if ((firstRight > visibleRight + visibleRect.width) && (firstRect.x > visibleRight)) {
657 inc = firstRect.x - visibleRight;
659 inc = firstRight - visibleRight;
661 }return visibleRect.width;
662 }, "java.awt.Rectangle,~N,~N");
663 Clazz.overrideMethod (c$, "getScrollableTracksViewportWidth",
665 if (this.getLayoutOrientation () == 2 && this.getVisibleRowCount () <= 0) {
667 }if (Clazz.instanceOf (this.getParent (), javax.swing.JViewport)) {
668 return ((this.getParent ()).getWidth () > this.getPreferredSize ().width);
671 Clazz.overrideMethod (c$, "getScrollableTracksViewportHeight",
673 if (this.getLayoutOrientation () == 1 && this.getVisibleRowCount () <= 0) {
675 }if (Clazz.instanceOf (this.getParent (), javax.swing.JViewport)) {
676 return ((this.getParent ()).getHeight () > this.getPreferredSize ().height);
679 Clazz.defineMethod (c$, "paramString",
681 var selectionForegroundString = (this.selectionForeground != null ? this.selectionForeground.toString () : "");
682 var selectionBackgroundString = (this.selectionBackground != null ? this.selectionBackground.toString () : "");
683 return Clazz.superCall (this, javax.swing.JList, "paramString", []) + ",fixedCellHeight=" + this.fixedCellHeight + ",fixedCellWidth=" + this.fixedCellWidth + ",horizontalScrollIncrement=" + this.horizontalScrollIncrement + ",selectionBackground=" + selectionBackgroundString + ",selectionForeground=" + selectionForegroundString + ",visibleRowCount=" + this.visibleRowCount + ",layoutOrientation=" + this.layoutOrientation;
685 c$.$JList$ListSelectionHandler$ = function () {
687 c$ = Clazz.decorateAsClass (function () {
688 Clazz.prepareCallback (this, arguments);
689 Clazz.instantialize (this, arguments);
690 }, javax.swing.JList, "ListSelectionHandler", null, javax.swing.event.ListSelectionListener);
691 Clazz.overrideMethod (c$, "valueChanged",
693 this.b$["javax.swing.JList"].fireSelectionValueChanged (a.getFirstIndex (), a.getLastIndex (), a.getValueIsAdjusting ());
694 }, "javax.swing.event.ListSelectionEvent");
697 c$.$JList$1$ = function () {
699 c$ = Clazz.declareAnonymous (javax.swing, "JList$1", javax.swing.AbstractListModel);
700 Clazz.defineMethod (c$, "getSize",
702 return this.f$.listData.length;
704 Clazz.defineMethod (c$, "getElementAt",
706 return this.f$.listData[i];
710 c$.$JList$2$ = function () {
712 c$ = Clazz.declareAnonymous (javax.swing, "JList$2", javax.swing.AbstractListModel);
713 Clazz.defineMethod (c$, "getSize",
715 return this.f$.listData.size ();
717 Clazz.defineMethod (c$, "getElementAt",
719 return this.f$.listData.elementAt (i);
723 c$.$JList$3$ = function () {
725 c$ = Clazz.declareAnonymous (javax.swing, "JList$3", javax.swing.AbstractListModel);
726 Clazz.defineMethod (c$, "getSize",
730 Clazz.defineMethod (c$, "getElementAt",
732 return "No Data Model";
736 c$.$JList$4$ = function () {
738 c$ = Clazz.declareAnonymous (javax.swing, "JList$4", javax.swing.AbstractListModel);
739 Clazz.defineMethod (c$, "getSize",
741 return this.f$.listData.length;
743 Clazz.defineMethod (c$, "getElementAt",
745 return this.f$.listData[i];
749 c$.$JList$5$ = function () {
751 c$ = Clazz.declareAnonymous (javax.swing, "JList$5", javax.swing.AbstractListModel);
752 Clazz.defineMethod (c$, "getSize",
754 return this.f$.listData.size ();
756 Clazz.defineMethod (c$, "getElementAt",
758 return this.f$.listData.elementAt (i);
762 Clazz.defineStatics (c$,
763 "$uiClassID", "ListUI",
766 "HORIZONTAL_WRAP", 2);