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