1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.AbstractSpinnerModel"], "javax.swing.SpinnerNumberModel", ["java.lang.Byte", "$.Double", "$.Float", "$.IllegalArgumentException", "$.Long", "$.Number", "$.Short"], function () {
3 c$ = Clazz.decorateAsClass (function () {
8 Clazz.instantialize (this, arguments);
9 }, javax.swing, "SpinnerNumberModel", javax.swing.AbstractSpinnerModel);
10 Clazz.makeConstructor (c$,
11 function (value, minimum, maximum, stepSize) {
12 Clazz.superConstructor (this, javax.swing.SpinnerNumberModel, []);
13 if ((value == null) || (stepSize == null)) {
14 throw new IllegalArgumentException ("value and stepSize must be non-null");
15 }if (!(((minimum == null) || (minimum.compareTo (value) <= 0)) && ((maximum == null) || (maximum.compareTo (value) >= 0)))) {
16 throw new IllegalArgumentException ("(minimum <= value <= maximum) is false");
18 this.minimum = minimum;
19 this.maximum = maximum;
20 this.stepSize = stepSize;
21 }, "Number,Comparable,Comparable,Number");
22 Clazz.makeConstructor (c$,
23 function (value, minimum, maximum, stepSize) {
24 this.construct ( new Integer (value), new Integer (minimum), new Integer (maximum), new Integer (stepSize));
26 Clazz.makeConstructor (c$,
27 function (value, minimum, maximum, stepSize) {
28 this.construct ( new Double (value), new Double (minimum), new Double (maximum), new Double (stepSize));
30 Clazz.makeConstructor (c$,
32 this.construct ( new Integer (0), null, null, new Integer (1));
34 Clazz.defineMethod (c$, "setMinimum",
36 if ((minimum == null) ? (this.minimum != null) : !minimum.equals (this.minimum)) {
37 this.minimum = minimum;
38 this.fireStateChanged ();
40 Clazz.defineMethod (c$, "getMinimum",
44 Clazz.defineMethod (c$, "setMaximum",
46 if ((maximum == null) ? (this.maximum != null) : !maximum.equals (this.maximum)) {
47 this.maximum = maximum;
48 this.fireStateChanged ();
50 Clazz.defineMethod (c$, "getMaximum",
54 Clazz.defineMethod (c$, "setStepSize",
56 if (stepSize == null) {
57 throw new IllegalArgumentException ("null stepSize");
58 }if (!stepSize.equals (this.stepSize)) {
59 this.stepSize = stepSize;
60 this.fireStateChanged ();
62 Clazz.defineMethod (c$, "getStepSize",
66 Clazz.defineMethod (c$, "incrValue",
69 if ((Clazz.instanceOf (this.value, Float)) || (Clazz.instanceOf (this.value, Double))) {
70 var v = this.value.doubleValue () + (this.stepSize.doubleValue () * dir);
71 if (Clazz.instanceOf (this.value, Double)) {
72 newValue = new Double (v);
74 newValue = new Float (v);
76 var v = this.value.longValue () + (this.stepSize.longValue () * dir);
77 if (Clazz.instanceOf (this.value, Long)) {
78 newValue = new Long (v);
79 } else if (Clazz.instanceOf (this.value, Integer)) {
80 newValue = new Integer (v);
81 } else if (Clazz.instanceOf (this.value, Short)) {
82 newValue = new Short (v);
84 newValue = new Byte (v);
85 }}if ((this.maximum != null) && (this.maximum.compareTo (newValue) < 0)) {
87 }if ((this.minimum != null) && (this.minimum.compareTo (newValue) > 0)) {
92 Clazz.overrideMethod (c$, "getNextValue",
94 return this.incrValue (1);
96 Clazz.overrideMethod (c$, "getPreviousValue",
98 return this.incrValue (-1);
100 Clazz.defineMethod (c$, "getNumber",
104 Clazz.overrideMethod (c$, "getValue",
108 Clazz.overrideMethod (c$, "setValue",
110 if ((value == null) || !(Clazz.instanceOf (value, Number))) {
111 throw new IllegalArgumentException ("illegal value");
112 }if (!value.equals (this.value)) {
114 this.fireStateChanged ();