X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2FSpinnerNumberModel.js;fp=site%2Fswingjs%2Fj2s%2Fjavax%2Fswing%2FSpinnerNumberModel.js;h=e00f5dce366ea46a71c1d7f59180d082779bceaf;hp=8e8acfcafbebb134df2e0a555a0939df8f44615b;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/javax/swing/SpinnerNumberModel.js b/site/swingjs/j2s/javax/swing/SpinnerNumberModel.js index 8e8acfc..e00f5dc 100644 --- a/site/swingjs/j2s/javax/swing/SpinnerNumberModel.js +++ b/site/swingjs/j2s/javax/swing/SpinnerNumberModel.js @@ -1,116 +1,116 @@ -Clazz.declarePackage ("javax.swing"); -Clazz.load (["javax.swing.AbstractSpinnerModel"], "javax.swing.SpinnerNumberModel", ["java.lang.Byte", "$.Double", "$.Float", "$.IllegalArgumentException", "$.Long", "$.Number", "$.Short"], function () { -c$ = Clazz.decorateAsClass (function () { -this.stepSize = null; -this.value = null; -this.minimum = null; -this.maximum = null; -Clazz.instantialize (this, arguments); -}, javax.swing, "SpinnerNumberModel", javax.swing.AbstractSpinnerModel); -Clazz.makeConstructor (c$, -function (value, minimum, maximum, stepSize) { -Clazz.superConstructor (this, javax.swing.SpinnerNumberModel, []); -if ((value == null) || (stepSize == null)) { -throw new IllegalArgumentException ("value and stepSize must be non-null"); -}if (!(((minimum == null) || (minimum.compareTo (value) <= 0)) && ((maximum == null) || (maximum.compareTo (value) >= 0)))) { -throw new IllegalArgumentException ("(minimum <= value <= maximum) is false"); -}this.value = value; -this.minimum = minimum; -this.maximum = maximum; -this.stepSize = stepSize; -}, "Number,Comparable,Comparable,Number"); -Clazz.makeConstructor (c$, -function (value, minimum, maximum, stepSize) { -this.construct ( new Integer (value), new Integer (minimum), new Integer (maximum), new Integer (stepSize)); -}, "~N,~N,~N,~N"); -Clazz.makeConstructor (c$, -function (value, minimum, maximum, stepSize) { -this.construct ( new Double (value), new Double (minimum), new Double (maximum), new Double (stepSize)); -}, "~N,~N,~N,~N"); -Clazz.makeConstructor (c$, -function () { -this.construct ( new Integer (0), null, null, new Integer (1)); -}); -Clazz.defineMethod (c$, "setMinimum", -function (minimum) { -if ((minimum == null) ? (this.minimum != null) : !minimum.equals (this.minimum)) { -this.minimum = minimum; -this.fireStateChanged (); -}}, "Comparable"); -Clazz.defineMethod (c$, "getMinimum", -function () { -return this.minimum; -}); -Clazz.defineMethod (c$, "setMaximum", -function (maximum) { -if ((maximum == null) ? (this.maximum != null) : !maximum.equals (this.maximum)) { -this.maximum = maximum; -this.fireStateChanged (); -}}, "Comparable"); -Clazz.defineMethod (c$, "getMaximum", -function () { -return this.maximum; -}); -Clazz.defineMethod (c$, "setStepSize", -function (stepSize) { -if (stepSize == null) { -throw new IllegalArgumentException ("null stepSize"); -}if (!stepSize.equals (this.stepSize)) { -this.stepSize = stepSize; -this.fireStateChanged (); -}}, "Number"); -Clazz.defineMethod (c$, "getStepSize", -function () { -return this.stepSize; -}); -Clazz.defineMethod (c$, "incrValue", - function (dir) { -var newValue; -if ((Clazz.instanceOf (this.value, Float)) || (Clazz.instanceOf (this.value, Double))) { -var v = this.value.doubleValue () + (this.stepSize.doubleValue () * dir); -if (Clazz.instanceOf (this.value, Double)) { -newValue = new Double (v); -} else { -newValue = new Float (v); -}} else { -var v = this.value.longValue () + (this.stepSize.longValue () * dir); -if (Clazz.instanceOf (this.value, Long)) { -newValue = new Long (v); -} else if (Clazz.instanceOf (this.value, Integer)) { -newValue = new Integer (v); -} else if (Clazz.instanceOf (this.value, Short)) { -newValue = new Short (v); -} else { -newValue = new Byte (v); -}}if ((this.maximum != null) && (this.maximum.compareTo (newValue) < 0)) { -return null; -}if ((this.minimum != null) && (this.minimum.compareTo (newValue) > 0)) { -return null; -} else { -return newValue; -}}, "~N"); -Clazz.overrideMethod (c$, "getNextValue", -function () { -return this.incrValue (1); -}); -Clazz.overrideMethod (c$, "getPreviousValue", -function () { -return this.incrValue (-1); -}); -Clazz.defineMethod (c$, "getNumber", -function () { -return this.value; -}); -Clazz.overrideMethod (c$, "getValue", -function () { -return this.value; -}); -Clazz.overrideMethod (c$, "setValue", -function (value) { -if ((value == null) || !(Clazz.instanceOf (value, Number))) { -throw new IllegalArgumentException ("illegal value"); -}if (!value.equals (this.value)) { -this.value = value; -this.fireStateChanged (); -}}, "~O"); -}); +Clazz.declarePackage ("javax.swing"); +Clazz.load (["javax.swing.AbstractSpinnerModel"], "javax.swing.SpinnerNumberModel", ["java.lang.Byte", "$.Double", "$.Float", "$.IllegalArgumentException", "$.Long", "$.Number", "$.Short"], function () { +c$ = Clazz.decorateAsClass (function () { +this.stepSize = null; +this.value = null; +this.minimum = null; +this.maximum = null; +Clazz.instantialize (this, arguments); +}, javax.swing, "SpinnerNumberModel", javax.swing.AbstractSpinnerModel); +Clazz.makeConstructor (c$, +function (value, minimum, maximum, stepSize) { +Clazz.superConstructor (this, javax.swing.SpinnerNumberModel, []); +if ((value == null) || (stepSize == null)) { +throw new IllegalArgumentException ("value and stepSize must be non-null"); +}if (!(((minimum == null) || (minimum.compareTo (value) <= 0)) && ((maximum == null) || (maximum.compareTo (value) >= 0)))) { +throw new IllegalArgumentException ("(minimum <= value <= maximum) is false"); +}this.value = value; +this.minimum = minimum; +this.maximum = maximum; +this.stepSize = stepSize; +}, "Number,Comparable,Comparable,Number"); +Clazz.makeConstructor (c$, +function (value, minimum, maximum, stepSize) { +this.construct ( new Integer (value), new Integer (minimum), new Integer (maximum), new Integer (stepSize)); +}, "~N,~N,~N,~N"); +Clazz.makeConstructor (c$, +function (value, minimum, maximum, stepSize) { +this.construct ( new Double (value), new Double (minimum), new Double (maximum), new Double (stepSize)); +}, "~N,~N,~N,~N"); +Clazz.makeConstructor (c$, +function () { +this.construct ( new Integer (0), null, null, new Integer (1)); +}); +Clazz.defineMethod (c$, "setMinimum", +function (minimum) { +if ((minimum == null) ? (this.minimum != null) : !minimum.equals (this.minimum)) { +this.minimum = minimum; +this.fireStateChanged (); +}}, "Comparable"); +Clazz.defineMethod (c$, "getMinimum", +function () { +return this.minimum; +}); +Clazz.defineMethod (c$, "setMaximum", +function (maximum) { +if ((maximum == null) ? (this.maximum != null) : !maximum.equals (this.maximum)) { +this.maximum = maximum; +this.fireStateChanged (); +}}, "Comparable"); +Clazz.defineMethod (c$, "getMaximum", +function () { +return this.maximum; +}); +Clazz.defineMethod (c$, "setStepSize", +function (stepSize) { +if (stepSize == null) { +throw new IllegalArgumentException ("null stepSize"); +}if (!stepSize.equals (this.stepSize)) { +this.stepSize = stepSize; +this.fireStateChanged (); +}}, "Number"); +Clazz.defineMethod (c$, "getStepSize", +function () { +return this.stepSize; +}); +Clazz.defineMethod (c$, "incrValue", + function (dir) { +var newValue; +if ((Clazz.instanceOf (this.value, Float)) || (Clazz.instanceOf (this.value, Double))) { +var v = this.value.doubleValue () + (this.stepSize.doubleValue () * dir); +if (Clazz.instanceOf (this.value, Double)) { +newValue = new Double (v); +} else { +newValue = new Float (v); +}} else { +var v = this.value.longValue () + (this.stepSize.longValue () * dir); +if (Clazz.instanceOf (this.value, Long)) { +newValue = new Long (v); +} else if (Clazz.instanceOf (this.value, Integer)) { +newValue = new Integer (v); +} else if (Clazz.instanceOf (this.value, Short)) { +newValue = new Short (v); +} else { +newValue = new Byte (v); +}}if ((this.maximum != null) && (this.maximum.compareTo (newValue) < 0)) { +return null; +}if ((this.minimum != null) && (this.minimum.compareTo (newValue) > 0)) { +return null; +} else { +return newValue; +}}, "~N"); +Clazz.overrideMethod (c$, "getNextValue", +function () { +return this.incrValue (1); +}); +Clazz.overrideMethod (c$, "getPreviousValue", +function () { +return this.incrValue (-1); +}); +Clazz.defineMethod (c$, "getNumber", +function () { +return this.value; +}); +Clazz.overrideMethod (c$, "getValue", +function () { +return this.value; +}); +Clazz.overrideMethod (c$, "setValue", +function (value) { +if ((value == null) || !(Clazz.instanceOf (value, Number))) { +throw new IllegalArgumentException ("illegal value"); +}if (!value.equals (this.value)) { +this.value = value; +this.fireStateChanged (); +}}, "~O"); +});