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