1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.AbstractSpinnerModel"], "javax.swing.SpinnerListModel", ["java.lang.IllegalArgumentException", "java.util.Arrays"], function () {
3 c$ = Clazz.decorateAsClass (function () {
6 Clazz.instantialize (this, arguments);
7 }, javax.swing, "SpinnerListModel", javax.swing.AbstractSpinnerModel);
8 Clazz.makeConstructor (c$,
10 Clazz.superConstructor (this, javax.swing.SpinnerListModel, []);
11 if (values == null || values.size () == 0) {
12 throw new IllegalArgumentException ("SpinnerListModel(List) expects non-null non-empty List");
16 Clazz.makeConstructor (c$,
18 Clazz.superConstructor (this, javax.swing.SpinnerListModel, []);
19 if (values == null || values.length == 0) {
20 throw new IllegalArgumentException ("SpinnerListModel(Object[]) expects non-null non-empty Object[]");
21 }this.list = java.util.Arrays.asList (values);
24 Clazz.makeConstructor (c$,
26 this.construct ( Clazz.newArray (-1, ["empty"]));
28 Clazz.defineMethod (c$, "getList",
32 Clazz.defineMethod (c$, "setList",
34 if ((list == null) || (list.size () == 0)) {
35 throw new IllegalArgumentException ("invalid list");
36 }if (!list.equals (this.list)) {
39 this.fireStateChanged ();
40 }}, "java.util.List");
41 Clazz.overrideMethod (c$, "getValue",
43 return this.list.get (this.index);
45 Clazz.overrideMethod (c$, "setValue",
47 var index = this.list.indexOf (elt);
49 throw new IllegalArgumentException ("invalid sequence element");
50 } else if (index != this.index) {
52 this.fireStateChanged ();
54 Clazz.overrideMethod (c$, "getNextValue",
56 return (this.index >= (this.list.size () - 1)) ? null : this.list.get (this.index + 1);
58 Clazz.overrideMethod (c$, "getPreviousValue",
60 return (this.index <= 0) ? null : this.list.get (this.index - 1);
62 Clazz.defineMethod (c$, "findNextMatch",
63 function (substring) {
64 var max = this.list.size ();
67 }var counter = this.index;
69 var value = this.list.get (counter);
70 var string = value.toString ();
71 if (string != null && string.startsWith (substring)) {
73 }counter = (counter + 1) % max;
74 } while (counter != this.index);