1 Clazz.declarePackage ("javax.swing");
\r
2 Clazz.load (["java.awt.Adjustable", "javax.swing.JComponent", "javax.swing.event.ChangeListener"], "javax.swing.JScrollBar", ["java.lang.IllegalArgumentException", "java.awt.Dimension", "java.awt.event.AdjustmentEvent", "$.AdjustmentListener", "javax.swing.BoundedRangeModel", "$.DefaultBoundedRangeModel", "$.UIManager"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.fwdAdjustmentEvents = null;
\r
6 this.orientation = 0;
\r
7 this.unitIncrement = 0;
\r
8 this.blockIncrement = 0;
\r
9 if (!Clazz.isClassDefined ("javax.swing.JScrollBar.ModelListener")) {
\r
10 javax.swing.JScrollBar.$JScrollBar$ModelListener$ ();
\r
12 Clazz.instantialize (this, arguments);
\r
13 }, javax.swing, "JScrollBar", javax.swing.JComponent, java.awt.Adjustable);
\r
14 Clazz.prepareFields (c$, function () {
\r
15 this.fwdAdjustmentEvents = Clazz.innerTypeInstance (javax.swing.JScrollBar.ModelListener, this, null);
\r
17 Clazz.defineMethod (c$, "checkOrientation",
\r
18 function (orientation) {
\r
19 switch (orientation) {
\r
24 throw new IllegalArgumentException ("orientation must be one of: VERTICAL, HORIZONTAL");
\r
27 Clazz.makeConstructor (c$,
\r
28 function (orientation, value, extent, min, max) {
\r
29 Clazz.superConstructor (this, javax.swing.JScrollBar, []);
\r
30 this.checkOrientation (orientation);
\r
31 this.unitIncrement = 1;
\r
32 this.blockIncrement = (extent == 0) ? 1 : extent;
\r
33 this.orientation = orientation;
\r
34 this.model = new javax.swing.DefaultBoundedRangeModel (value, extent, min, max);
\r
35 this.model.addChangeListener (this.fwdAdjustmentEvents);
\r
36 this.setRequestFocusEnabled (false);
\r
38 }, "~N,~N,~N,~N,~N");
\r
39 Clazz.makeConstructor (c$,
\r
40 function (orientation) {
\r
41 this.construct (orientation, 0, 10, 0, 100);
\r
43 Clazz.makeConstructor (c$,
\r
47 Clazz.overrideMethod (c$, "getUI",
\r
51 Clazz.overrideMethod (c$, "updateUI",
\r
53 this.setUI (javax.swing.UIManager.getUI (this));
\r
55 Clazz.overrideMethod (c$, "getUIClassID",
\r
57 return "ScrollBarUI";
\r
59 Clazz.overrideMethod (c$, "getOrientation",
\r
61 return this.orientation;
\r
63 Clazz.defineMethod (c$, "setOrientation",
\r
64 function (orientation) {
\r
65 this.checkOrientation (orientation);
\r
66 var oldValue = this.orientation;
\r
67 this.orientation = orientation;
\r
68 this.firePropertyChangeInt ("orientation", oldValue, orientation);
\r
69 if (orientation != oldValue) {
\r
72 Clazz.defineMethod (c$, "getModel",
\r
76 Clazz.defineMethod (c$, "setModel",
\r
77 function (newModel) {
\r
78 var oldModel = this.model;
\r
79 if (this.model != null) {
\r
80 this.model.removeChangeListener (this.fwdAdjustmentEvents);
\r
81 }this.model = newModel;
\r
82 if (this.model != null) {
\r
83 this.model.addChangeListener (this.fwdAdjustmentEvents);
\r
84 }this.firePropertyChangeObject ("model", oldModel, this.model);
\r
85 }, "javax.swing.BoundedRangeModel");
\r
86 Clazz.defineMethod (c$, "getUnitIncrement",
\r
87 function (direction) {
\r
88 return this.unitIncrement;
\r
90 Clazz.overrideMethod (c$, "setUnitIncrement",
\r
91 function (unitIncrement) {
\r
92 var oldValue = this.unitIncrement;
\r
93 this.unitIncrement = unitIncrement;
\r
94 this.firePropertyChangeInt ("unitIncrement", oldValue, unitIncrement);
\r
96 Clazz.defineMethod (c$, "getBlockIncrement",
\r
97 function (direction) {
\r
98 return this.blockIncrement;
\r
100 Clazz.overrideMethod (c$, "setBlockIncrement",
\r
101 function (blockIncrement) {
\r
102 var oldValue = this.blockIncrement;
\r
103 this.blockIncrement = blockIncrement;
\r
104 this.firePropertyChangeInt ("blockIncrement", oldValue, blockIncrement);
\r
106 Clazz.defineMethod (c$, "getUnitIncrement",
\r
108 return this.unitIncrement;
\r
110 Clazz.defineMethod (c$, "getBlockIncrement",
\r
112 return this.blockIncrement;
\r
114 Clazz.overrideMethod (c$, "getValue",
\r
116 return this.getModel ().getValue ();
\r
118 Clazz.overrideMethod (c$, "setValue",
\r
120 var m = this.getModel ();
\r
121 m.setValue (value);
\r
123 Clazz.overrideMethod (c$, "getVisibleAmount",
\r
125 return this.getModel ().getExtent ();
\r
127 Clazz.overrideMethod (c$, "setVisibleAmount",
\r
128 function (extent) {
\r
129 this.getModel ().setExtent (extent);
\r
131 Clazz.overrideMethod (c$, "getMinimum",
\r
133 return this.getModel ().getMinimum ();
\r
135 Clazz.overrideMethod (c$, "setMinimum",
\r
136 function (minimum) {
\r
137 this.getModel ().setMinimum (minimum);
\r
139 Clazz.overrideMethod (c$, "getMaximum",
\r
141 return this.getModel ().getMaximum ();
\r
143 Clazz.overrideMethod (c$, "setMaximum",
\r
144 function (maximum) {
\r
145 this.getModel ().setMaximum (maximum);
\r
147 Clazz.defineMethod (c$, "getValueIsAdjusting",
\r
149 return this.getModel ().getValueIsAdjusting ();
\r
151 Clazz.defineMethod (c$, "setValueIsAdjusting",
\r
153 var m = this.getModel ();
\r
154 m.setValueIsAdjusting (b);
\r
156 Clazz.defineMethod (c$, "setValues",
\r
157 function (newValue, newExtent, newMin, newMax) {
\r
158 var m = this.getModel ();
\r
159 m.setRangeProperties (newValue, newExtent, newMin, newMax, m.getValueIsAdjusting ());
\r
161 Clazz.overrideMethod (c$, "addAdjustmentListener",
\r
163 this.listenerList.add (java.awt.event.AdjustmentListener, l);
\r
164 }, "java.awt.event.AdjustmentListener");
\r
165 Clazz.overrideMethod (c$, "removeAdjustmentListener",
\r
167 this.listenerList.remove (java.awt.event.AdjustmentListener, l);
\r
168 }, "java.awt.event.AdjustmentListener");
\r
169 Clazz.defineMethod (c$, "getAdjustmentListeners",
\r
171 return this.listenerList.getListeners (java.awt.event.AdjustmentListener);
\r
173 Clazz.defineMethod (c$, "fireAdjustmentValueChanged",
\r
174 function (id, type, value) {
\r
175 this.fireAdjustmentValueChanged (id, type, value, this.getValueIsAdjusting ());
\r
177 Clazz.defineMethod (c$, "fireAdjustmentValueChanged",
\r
178 function (id, type, value, isAdjusting) {
\r
179 var listeners = this.listenerList.getListenerList ();
\r
181 for (var i = listeners.length - 2; i >= 0; i -= 2) {
\r
182 if (listeners[i] === java.awt.event.AdjustmentListener) {
\r
184 e = new java.awt.event.AdjustmentEvent (this, id, type, value, isAdjusting);
\r
185 }(listeners[i + 1]).adjustmentValueChanged (e);
\r
188 Clazz.overrideMethod (c$, "getMinimumSize",
\r
190 var pref = this.getPreferredSize ();
\r
191 if (this.orientation == 1) {
\r
192 return new java.awt.Dimension (pref.width, 5);
\r
194 return new java.awt.Dimension (5, pref.height);
\r
196 Clazz.overrideMethod (c$, "getMaximumSize",
\r
198 var pref = this.getPreferredSize ();
\r
199 if (this.getOrientation () == 1) {
\r
200 return new java.awt.Dimension (pref.width, 32767);
\r
202 return new java.awt.Dimension (32767, pref.height);
\r
204 Clazz.defineMethod (c$, "setEnabled",
\r
206 Clazz.superCall (this, javax.swing.JScrollBar, "setEnabled", [x]);
\r
207 var children = this.getComponents ();
\r
208 for (var i = 0; i < children.length; i++) {
\r
209 children[i].setEnabled (x);
\r
212 Clazz.defineMethod (c$, "paramString",
\r
214 var orientationString = (this.orientation == 0 ? "HORIZONTAL" : "VERTICAL");
\r
215 return Clazz.superCall (this, javax.swing.JScrollBar, "paramString", []) + ",blockIncrement=" + this.blockIncrement + ",orientation=" + orientationString + ",unitIncrement=" + this.unitIncrement;
\r
217 c$.$JScrollBar$ModelListener$ = function () {
\r
218 Clazz.pu$h(self.c$);
\r
219 c$ = Clazz.decorateAsClass (function () {
\r
220 Clazz.prepareCallback (this, arguments);
\r
221 Clazz.instantialize (this, arguments);
\r
222 }, javax.swing.JScrollBar, "ModelListener", null, javax.swing.event.ChangeListener);
\r
223 Clazz.overrideMethod (c$, "stateChanged",
\r
225 var b = a.getSource ();
\r
226 if (Clazz.instanceOf (b, javax.swing.BoundedRangeModel)) {
\r
230 var f = e.getValue ();
\r
231 var g = e.getValueIsAdjusting ();
\r
232 this.b$["javax.swing.JScrollBar"].fireAdjustmentValueChanged (c, d, f, g);
\r
233 }}, "javax.swing.event.ChangeEvent");
\r
236 Clazz.defineStatics (c$,
\r
237 "$uiClassID", "ScrollBarUI");
\r