1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["javax.swing.BoundedRangeModel", "javax.swing.event.EventListenerList"], "javax.swing.DefaultBoundedRangeModel", ["java.lang.IllegalArgumentException", "javax.swing.event.ChangeEvent", "$.ChangeListener"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.changeEvent = null;
5 this.listenerList = null;
10 this.isAdjusting = false;
11 Clazz.instantialize (this, arguments);
12 }, javax.swing, "DefaultBoundedRangeModel", null, javax.swing.BoundedRangeModel);
13 Clazz.prepareFields (c$, function () {
14 this.listenerList = new javax.swing.event.EventListenerList ();
16 Clazz.makeConstructor (c$,
19 Clazz.makeConstructor (c$,
20 function (value, extent, min, max) {
21 if ((max >= min) && (value >= min) && ((value + extent) >= value) && ((value + extent) <= max)) {
27 throw new IllegalArgumentException ("invalid range properties");
29 Clazz.overrideMethod (c$, "getValue",
33 Clazz.overrideMethod (c$, "getExtent",
37 Clazz.overrideMethod (c$, "getMinimum",
41 Clazz.overrideMethod (c$, "getMaximum",
45 Clazz.overrideMethod (c$, "setValue",
47 n = Math.min (n, 2147483647 - this.extent);
48 var newValue = Math.max (n, this.min);
49 if (newValue + this.extent > this.max) {
50 newValue = this.max - this.extent;
51 }this.setRangeProperties (newValue, this.extent, this.min, this.max, this.isAdjusting);
53 Clazz.overrideMethod (c$, "setExtent",
55 var newExtent = Math.max (0, n);
56 if (this.value + newExtent > this.max) {
57 newExtent = this.max - this.value;
58 }this.setRangeProperties (this.value, newExtent, this.min, this.max, this.isAdjusting);
60 Clazz.overrideMethod (c$, "setMinimum",
62 var newMax = Math.max (n, this.max);
63 var newValue = Math.max (n, this.value);
64 var newExtent = Math.min (newMax - newValue, this.extent);
65 this.setRangeProperties (newValue, newExtent, n, newMax, this.isAdjusting);
67 Clazz.overrideMethod (c$, "setMaximum",
69 var newMin = Math.min (n, this.min);
70 var newExtent = Math.min (n - newMin, this.extent);
71 var newValue = Math.min (n - newExtent, this.value);
72 this.setRangeProperties (newValue, newExtent, newMin, n, this.isAdjusting);
74 Clazz.overrideMethod (c$, "setValueIsAdjusting",
76 this.setRangeProperties (this.value, this.extent, this.min, this.max, b);
78 Clazz.overrideMethod (c$, "getValueIsAdjusting",
80 return this.isAdjusting;
82 Clazz.overrideMethod (c$, "setRangeProperties",
83 function (newValue, newExtent, newMin, newMax, adjusting) {
84 if (newMin > newMax) {
86 }if (newValue > newMax) {
88 }if (newValue < newMin) {
90 }if ((newExtent + newValue) > newMax) {
91 newExtent = newMax - newValue;
94 }var isChange = (newValue != this.value) || (newExtent != this.extent) || (newMin != this.min) || (newMax != this.max) || (adjusting != this.isAdjusting);
96 this.value = newValue;
97 this.extent = newExtent;
100 this.isAdjusting = adjusting;
101 this.fireStateChanged ();
102 }}, "~N,~N,~N,~N,~B");
103 Clazz.overrideMethod (c$, "addChangeListener",
105 this.listenerList.add (javax.swing.event.ChangeListener, l);
106 }, "javax.swing.event.ChangeListener");
107 Clazz.overrideMethod (c$, "removeChangeListener",
109 this.listenerList.remove (javax.swing.event.ChangeListener, l);
110 }, "javax.swing.event.ChangeListener");
111 Clazz.defineMethod (c$, "getChangeListeners",
113 return this.listenerList.getListeners (javax.swing.event.ChangeListener);
115 Clazz.defineMethod (c$, "fireStateChanged",
117 var listeners = this.listenerList.getListenerList ();
118 for (var i = listeners.length - 2; i >= 0; i -= 2) {
119 if (listeners[i] === javax.swing.event.ChangeListener) {
120 if (this.changeEvent == null) {
121 this.changeEvent = new javax.swing.event.ChangeEvent (this);
122 }(listeners[i + 1]).stateChanged (this.changeEvent);
125 Clazz.overrideMethod (c$, "toString",
127 var modelString = "value=" + this.getValue () + ", " + "extent=" + this.getExtent () + ", " + "min=" + this.getMinimum () + ", " + "max=" + this.getMaximum () + ", " + "adj=" + this.getValueIsAdjusting ();
128 return this.getClass ().getName () + "[" + modelString + "]";
130 Clazz.defineMethod (c$, "getListeners",
131 function (listenerType) {
132 return this.listenerList.getListeners (listenerType);