d8c0d9abdac334d4bd09e6c642aeb51bec623534
[jalviewjs.git] / site / j2s / javax / swing / text / BoxView.js
1 Clazz.declarePackage ("javax.swing.text");
2 Clazz.load (["javax.swing.text.CompositeView"], "javax.swing.text.BoxView", ["java.lang.IllegalArgumentException", "java.awt.Rectangle", "javax.swing.SizeRequirements", "javax.swing.text.Position"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.majorAxis = 0;
5 this.majorSpan = 0;
6 this.minorSpan = 0;
7 this.majorReqValid = false;
8 this.minorReqValid = false;
9 this.majorRequest = null;
10 this.minorRequest = null;
11 this.majorAllocValid = false;
12 this.majorOffsets = null;
13 this.majorSpans = null;
14 this.minorAllocValid = false;
15 this.minorOffsets = null;
16 this.minorSpans = null;
17 this.tempRect = null;
18 Clazz.instantialize (this, arguments);
19 }, javax.swing.text, "BoxView", javax.swing.text.CompositeView);
20 Clazz.makeConstructor (c$, 
21 function (elem, axis) {
22 Clazz.superConstructor (this, javax.swing.text.BoxView, [elem]);
23 this.tempRect =  new java.awt.Rectangle ();
24 this.majorAxis = axis;
25 this.majorOffsets =  Clazz.newIntArray (0, 0);
26 this.majorSpans =  Clazz.newIntArray (0, 0);
27 this.majorReqValid = false;
28 this.majorAllocValid = false;
29 this.minorOffsets =  Clazz.newIntArray (0, 0);
30 this.minorSpans =  Clazz.newIntArray (0, 0);
31 this.minorReqValid = false;
32 this.minorAllocValid = false;
33 }, "javax.swing.text.Element,~N");
34 Clazz.defineMethod (c$, "getAxis", 
35 function () {
36 return this.majorAxis;
37 });
38 Clazz.defineMethod (c$, "setAxis", 
39 function (axis) {
40 var axisChanged = (axis != this.majorAxis);
41 this.majorAxis = axis;
42 if (axisChanged) {
43 this.preferenceChanged (null, true, true);
44 }}, "~N");
45 Clazz.defineMethod (c$, "layoutChanged", 
46 function (axis) {
47 if (axis == this.majorAxis) {
48 this.majorAllocValid = false;
49 } else {
50 this.minorAllocValid = false;
51 }}, "~N");
52 Clazz.defineMethod (c$, "isLayoutValid", 
53 function (axis) {
54 if (axis == this.majorAxis) {
55 return this.majorAllocValid;
56 } else {
57 return this.minorAllocValid;
58 }}, "~N");
59 Clazz.defineMethod (c$, "paintChild", 
60 function (g, alloc, index) {
61 var child = this.getView (index);
62 child.paint (g, alloc);
63 }, "java.awt.Graphics,java.awt.Rectangle,~N");
64 Clazz.defineMethod (c$, "replace", 
65 function (index, length, elems) {
66 Clazz.superCall (this, javax.swing.text.BoxView, "replace", [index, length, elems]);
67 var nInserted = (elems != null) ? elems.length : 0;
68 this.majorOffsets = this.updateLayoutArray (this.majorOffsets, index, nInserted);
69 this.majorSpans = this.updateLayoutArray (this.majorSpans, index, nInserted);
70 this.majorReqValid = false;
71 this.majorAllocValid = false;
72 this.minorOffsets = this.updateLayoutArray (this.minorOffsets, index, nInserted);
73 this.minorSpans = this.updateLayoutArray (this.minorSpans, index, nInserted);
74 this.minorReqValid = false;
75 this.minorAllocValid = false;
76 }, "~N,~N,~A");
77 Clazz.defineMethod (c$, "updateLayoutArray", 
78 function (oldArray, offset, nInserted) {
79 var n = this.getViewCount ();
80 var newArray =  Clazz.newIntArray (n, 0);
81 System.arraycopy (oldArray, 0, newArray, 0, offset);
82 System.arraycopy (oldArray, offset, newArray, offset + nInserted, n - nInserted - offset);
83 return newArray;
84 }, "~A,~N,~N");
85 Clazz.defineMethod (c$, "forwardUpdate", 
86 function (ec, e, a, f) {
87 var wasValid = this.isLayoutValid (this.majorAxis);
88 Clazz.superCall (this, javax.swing.text.BoxView, "forwardUpdate", [ec, e, a, f]);
89 if (wasValid && (!this.isLayoutValid (this.majorAxis))) {
90 var c = this.getContainer ();
91 if ((a != null) && (c != null)) {
92 var pos = e.getOffset ();
93 var index = this.getViewIndexAtPosition (pos);
94 var alloc = this.getInsideAllocation (a);
95 if (this.majorAxis == 0) {
96 alloc.x += this.majorOffsets[index];
97 alloc.width -= this.majorOffsets[index];
98 } else {
99 alloc.y += this.minorOffsets[index];
100 alloc.height -= this.minorOffsets[index];
101 }c.repaint (alloc.x, alloc.y, alloc.width, alloc.height);
102 }}}, "javax.swing.event.DocumentEvent.ElementChange,javax.swing.event.DocumentEvent,java.awt.Shape,javax.swing.text.ViewFactory");
103 Clazz.defineMethod (c$, "preferenceChanged", 
104 function (child, width, height) {
105 var majorChanged = (this.majorAxis == 0) ? width : height;
106 var minorChanged = (this.majorAxis == 0) ? height : width;
107 if (majorChanged) {
108 this.majorReqValid = false;
109 this.majorAllocValid = false;
110 }if (minorChanged) {
111 this.minorReqValid = false;
112 this.minorAllocValid = false;
113 }Clazz.superCall (this, javax.swing.text.BoxView, "preferenceChanged", [child, width, height]);
114 }, "javax.swing.text.View,~B,~B");
115 Clazz.defineMethod (c$, "getResizeWeight", 
116 function (axis) {
117 this.checkRequests (axis);
118 if (axis == this.majorAxis) {
119 if ((this.majorRequest.preferred != this.majorRequest.minimum) || (this.majorRequest.preferred != this.majorRequest.maximum)) {
120 return 1;
121 }} else {
122 if ((this.minorRequest.preferred != this.minorRequest.minimum) || (this.minorRequest.preferred != this.minorRequest.maximum)) {
123 return 1;
124 }}return 0;
125 }, "~N");
126 Clazz.defineMethod (c$, "setSpanOnAxis", 
127 function (axis, span) {
128 if (axis == this.majorAxis) {
129 if (this.majorSpan != Clazz.floatToInt (span)) {
130 this.majorAllocValid = false;
131 }if (!this.majorAllocValid) {
132 this.majorSpan = Clazz.floatToInt (span);
133 this.checkRequests (this.majorAxis);
134 this.layoutMajorAxis (this.majorSpan, axis, this.majorOffsets, this.majorSpans);
135 this.majorAllocValid = true;
136 this.updateChildSizes ();
137 }} else {
138 if ((Clazz.floatToInt (span)) != this.minorSpan) {
139 this.minorAllocValid = false;
140 }if (!this.minorAllocValid) {
141 this.minorSpan = Clazz.floatToInt (span);
142 this.checkRequests (axis);
143 this.layoutMinorAxis (this.minorSpan, axis, this.minorOffsets, this.minorSpans);
144 this.minorAllocValid = true;
145 this.updateChildSizes ();
146 }}}, "~N,~N");
147 Clazz.defineMethod (c$, "updateChildSizes", 
148 function () {
149 var n = this.getViewCount ();
150 if (this.majorAxis == 0) {
151 for (var i = 0; i < n; i++) {
152 var v = this.getView (i);
153 v.setSize (this.majorSpans[i], this.minorSpans[i]);
154 }
155 } else {
156 for (var i = 0; i < n; i++) {
157 var v = this.getView (i);
158 v.setSize (this.minorSpans[i], this.majorSpans[i]);
159 }
160 }});
161 Clazz.defineMethod (c$, "getSpanOnAxis", 
162 function (axis) {
163 if (axis == this.majorAxis) {
164 return this.majorSpan;
165 } else {
166 return this.minorSpan;
167 }}, "~N");
168 Clazz.defineMethod (c$, "setSize", 
169 function (width, height) {
170 this.layout (Math.max (0, Clazz.floatToInt (width - this.getLeftInset () - this.getRightInset ())), Math.max (0, Clazz.floatToInt (height - this.getTopInset () - this.getBottomInset ())));
171 }, "~N,~N");
172 Clazz.defineMethod (c$, "paint", 
173 function (g, allocation) {
174 var alloc = (Clazz.instanceOf (allocation, java.awt.Rectangle)) ? allocation : allocation.getBounds ();
175 var n = this.getViewCount ();
176 var x = alloc.x + this.getLeftInset ();
177 var y = alloc.y + this.getTopInset ();
178 var clip = g.getClipBounds ();
179 for (var i = 0; i < n; i++) {
180 this.tempRect.x = x + this.getOffset (0, i);
181 this.tempRect.y = y + this.getOffset (1, i);
182 this.tempRect.width = this.getSpan (0, i);
183 this.tempRect.height = this.getSpan (1, i);
184 var trx0 = this.tempRect.x;
185 var trx1 = trx0 + this.tempRect.width;
186 var try0 = this.tempRect.y;
187 var try1 = try0 + this.tempRect.height;
188 var crx0 = clip.x;
189 var crx1 = crx0 + clip.width;
190 var cry0 = clip.y;
191 var cry1 = cry0 + clip.height;
192 if ((trx1 >= crx0) && (try1 >= cry0) && (crx1 >= trx0) && (cry1 >= try0)) {
193 this.paintChild (g, this.tempRect, i);
194 }}
195 }, "java.awt.Graphics,java.awt.Shape");
196 Clazz.defineMethod (c$, "getChildAllocation", 
197 function (index, a) {
198 if (a != null) {
199 var ca = Clazz.superCall (this, javax.swing.text.BoxView, "getChildAllocation", [index, a]);
200 if ((ca != null) && (!this.isAllocationValid ())) {
201 var r = (Clazz.instanceOf (ca, java.awt.Rectangle)) ? ca : ca.getBounds ();
202 if ((r.width == 0) && (r.height == 0)) {
203 return null;
204 }}return ca;
205 }return null;
206 }, "~N,java.awt.Shape");
207 Clazz.defineMethod (c$, "modelToView", 
208 function (pos, a, b) {
209 if (!this.isAllocationValid ()) {
210 var alloc = a.getBounds ();
211 this.setSize (alloc.width, alloc.height);
212 }return Clazz.superCall (this, javax.swing.text.BoxView, "modelToView", [pos, a, b]);
213 }, "~N,java.awt.Shape,javax.swing.text.Position.Bias");
214 Clazz.defineMethod (c$, "viewToModel", 
215 function (x, y, a, bias) {
216 if (!this.isAllocationValid ()) {
217 var alloc = a.getBounds ();
218 this.setSize (alloc.width, alloc.height);
219 }return Clazz.superCall (this, javax.swing.text.BoxView, "viewToModel", [x, y, a, bias]);
220 }, "~N,~N,java.awt.Shape,~A");
221 Clazz.defineMethod (c$, "getAlignment", 
222 function (axis) {
223 this.checkRequests (axis);
224 if (axis == this.majorAxis) {
225 return this.majorRequest.alignment;
226 } else {
227 return this.minorRequest.alignment;
228 }}, "~N");
229 Clazz.defineMethod (c$, "getPreferredSpan", 
230 function (axis) {
231 this.checkRequests (axis);
232 var marginSpan = (axis == 0) ? this.getLeftInset () + this.getRightInset () : this.getTopInset () + this.getBottomInset ();
233 if (axis == this.majorAxis) {
234 return (this.majorRequest.preferred) + marginSpan;
235 } else {
236 return (this.minorRequest.preferred) + marginSpan;
237 }}, "~N");
238 Clazz.defineMethod (c$, "getMinimumSpan", 
239 function (axis) {
240 this.checkRequests (axis);
241 var marginSpan = (axis == 0) ? this.getLeftInset () + this.getRightInset () : this.getTopInset () + this.getBottomInset ();
242 if (axis == this.majorAxis) {
243 return (this.majorRequest.minimum) + marginSpan;
244 } else {
245 return (this.minorRequest.minimum) + marginSpan;
246 }}, "~N");
247 Clazz.defineMethod (c$, "getMaximumSpan", 
248 function (axis) {
249 this.checkRequests (axis);
250 var marginSpan = (axis == 0) ? this.getLeftInset () + this.getRightInset () : this.getTopInset () + this.getBottomInset ();
251 if (axis == this.majorAxis) {
252 return (this.majorRequest.maximum) + marginSpan;
253 } else {
254 return (this.minorRequest.maximum) + marginSpan;
255 }}, "~N");
256 Clazz.defineMethod (c$, "isAllocationValid", 
257 function () {
258 return (this.majorAllocValid && this.minorAllocValid);
259 });
260 Clazz.overrideMethod (c$, "isBefore", 
261 function (x, y, innerAlloc) {
262 if (this.majorAxis == 0) {
263 return (x < innerAlloc.x);
264 } else {
265 return (y < innerAlloc.y);
266 }}, "~N,~N,java.awt.Rectangle");
267 Clazz.overrideMethod (c$, "isAfter", 
268 function (x, y, innerAlloc) {
269 if (this.majorAxis == 0) {
270 return (x > (innerAlloc.width + innerAlloc.x));
271 } else {
272 return (y > (innerAlloc.height + innerAlloc.y));
273 }}, "~N,~N,java.awt.Rectangle");
274 Clazz.overrideMethod (c$, "getViewAtPoint", 
275 function (x, y, alloc) {
276 var n = this.getViewCount ();
277 if (this.majorAxis == 0) {
278 if (x < (alloc.x + this.majorOffsets[0])) {
279 this.childAllocation (0, alloc);
280 return this.getView (0);
281 }for (var i = 0; i < n; i++) {
282 if (x < (alloc.x + this.majorOffsets[i])) {
283 this.childAllocation (i - 1, alloc);
284 return this.getView (i - 1);
285 }}
286 this.childAllocation (n - 1, alloc);
287 return this.getView (n - 1);
288 } else {
289 if (y < (alloc.y + this.majorOffsets[0])) {
290 this.childAllocation (0, alloc);
291 return this.getView (0);
292 }for (var i = 0; i < n; i++) {
293 if (y < (alloc.y + this.majorOffsets[i])) {
294 this.childAllocation (i - 1, alloc);
295 return this.getView (i - 1);
296 }}
297 this.childAllocation (n - 1, alloc);
298 return this.getView (n - 1);
299 }}, "~N,~N,java.awt.Rectangle");
300 Clazz.overrideMethod (c$, "childAllocation", 
301 function (index, alloc) {
302 alloc.x += this.getOffset (0, index);
303 alloc.y += this.getOffset (1, index);
304 alloc.width = this.getSpan (0, index);
305 alloc.height = this.getSpan (1, index);
306 }, "~N,java.awt.Rectangle");
307 Clazz.defineMethod (c$, "layout", 
308 function (width, height) {
309 this.setSpanOnAxis (0, width);
310 this.setSpanOnAxis (1, height);
311 }, "~N,~N");
312 Clazz.defineMethod (c$, "getWidth", 
313 function () {
314 var span;
315 if (this.majorAxis == 0) {
316 span = this.majorSpan;
317 } else {
318 span = this.minorSpan;
319 }span += this.getLeftInset () - this.getRightInset ();
320 return span;
321 });
322 Clazz.defineMethod (c$, "getHeight", 
323 function () {
324 var span;
325 if (this.majorAxis == 1) {
326 span = this.majorSpan;
327 } else {
328 span = this.minorSpan;
329 }span += this.getTopInset () - this.getBottomInset ();
330 return span;
331 });
332 Clazz.defineMethod (c$, "layoutMajorAxis", 
333 function (targetSpan, axis, offsets, spans) {
334 var preferred = 0;
335 var n = this.getViewCount ();
336 for (var i = 0; i < n; i++) {
337 var v = this.getView (i);
338 spans[i] = Clazz.floatToInt (v.getPreferredSpan (axis));
339 preferred += spans[i];
340 }
341 var desiredAdjustment = targetSpan - preferred;
342 var adjustmentFactor = 0.0;
343 var diffs = null;
344 if (desiredAdjustment != 0) {
345 var totalSpan = 0;
346 diffs =  Clazz.newIntArray (n, 0);
347 for (var i = 0; i < n; i++) {
348 var v = this.getView (i);
349 var tmp;
350 if (desiredAdjustment < 0) {
351 tmp = Clazz.floatToInt (v.getMinimumSpan (axis));
352 diffs[i] = spans[i] - tmp;
353 } else {
354 tmp = Clazz.floatToInt (v.getMaximumSpan (axis));
355 diffs[i] = tmp - spans[i];
356 }totalSpan += tmp;
357 }
358 var maximumAdjustment = Math.abs (totalSpan - preferred);
359 adjustmentFactor = desiredAdjustment / maximumAdjustment;
360 adjustmentFactor = Math.min (adjustmentFactor, 1.0);
361 adjustmentFactor = Math.max (adjustmentFactor, -1.0);
362 }var totalOffset = 0;
363 for (var i = 0; i < n; i++) {
364 offsets[i] = totalOffset;
365 if (desiredAdjustment != 0) {
366 var adjF = adjustmentFactor * diffs[i];
367 spans[i] += Math.round (adjF);
368 }totalOffset = Math.min (totalOffset + spans[i], 2147483647);
369 }
370 }, "~N,~N,~A,~A");
371 Clazz.defineMethod (c$, "layoutMinorAxis", 
372 function (targetSpan, axis, offsets, spans) {
373 var n = this.getViewCount ();
374 for (var i = 0; i < n; i++) {
375 var v = this.getView (i);
376 var max = Clazz.floatToInt (v.getMaximumSpan (axis));
377 if (max < targetSpan) {
378 var align = v.getAlignment (axis);
379 offsets[i] = Clazz.floatToInt ((targetSpan - max) * align);
380 spans[i] = max;
381 } else {
382 var min = Clazz.floatToInt (v.getMinimumSpan (axis));
383 offsets[i] = 0;
384 spans[i] = Math.max (min, targetSpan);
385 }}
386 }, "~N,~N,~A,~A");
387 Clazz.defineMethod (c$, "calculateMajorAxisRequirements", 
388 function (axis, r) {
389 var min = 0;
390 var pref = 0;
391 var max = 0;
392 var n = this.getViewCount ();
393 for (var i = 0; i < n; i++) {
394 var v = this.getView (i);
395 min += v.getMinimumSpan (axis);
396 pref += v.getPreferredSpan (axis);
397 max += v.getMaximumSpan (axis);
398 }
399 if (r == null) {
400 r =  new javax.swing.SizeRequirements ();
401 }r.alignment = 0.5;
402 r.minimum = Clazz.floatToInt (min);
403 r.preferred = Clazz.floatToInt (pref);
404 r.maximum = Clazz.floatToInt (max);
405 return r;
406 }, "~N,javax.swing.SizeRequirements");
407 Clazz.defineMethod (c$, "calculateMinorAxisRequirements", 
408 function (axis, r) {
409 var min = 0;
410 var pref = 0;
411 var max = 2147483647;
412 var n = this.getViewCount ();
413 for (var i = 0; i < n; i++) {
414 var v = this.getView (i);
415 min = Math.max (Clazz.floatToInt (v.getMinimumSpan (axis)), min);
416 pref = Math.max (Clazz.floatToInt (v.getPreferredSpan (axis)), pref);
417 max = Math.max (Clazz.floatToInt (v.getMaximumSpan (axis)), max);
418 }
419 if (r == null) {
420 r =  new javax.swing.SizeRequirements ();
421 r.alignment = 0.5;
422 }r.preferred = pref;
423 r.minimum = min;
424 r.maximum = max;
425 return r;
426 }, "~N,javax.swing.SizeRequirements");
427 Clazz.defineMethod (c$, "checkRequests", 
428 function (axis) {
429 if ((axis != 0) && (axis != 1)) {
430 throw  new IllegalArgumentException ("Invalid axis: " + axis);
431 }if (axis == this.majorAxis) {
432 if (!this.majorReqValid) {
433 this.majorRequest = this.calculateMajorAxisRequirements (axis, this.majorRequest);
434 this.majorReqValid = true;
435 }} else if (!this.minorReqValid) {
436 this.minorRequest = this.calculateMinorAxisRequirements (axis, this.minorRequest);
437 this.minorReqValid = true;
438 }}, "~N");
439 Clazz.defineMethod (c$, "baselineLayout", 
440 function (targetSpan, axis, offsets, spans) {
441 var totalAscent = Clazz.floatToInt (targetSpan * this.getAlignment (axis));
442 var totalDescent = targetSpan - totalAscent;
443 var n = this.getViewCount ();
444 for (var i = 0; i < n; i++) {
445 var v = this.getView (i);
446 var align = v.getAlignment (axis);
447 var viewSpan;
448 if (v.getResizeWeight (axis) > 0) {
449 var minSpan = v.getMinimumSpan (axis);
450 var maxSpan = v.getMaximumSpan (axis);
451 if (align == 0.0) {
452 viewSpan = Math.max (Math.min (maxSpan, totalDescent), minSpan);
453 } else if (align == 1.0) {
454 viewSpan = Math.max (Math.min (maxSpan, totalAscent), minSpan);
455 } else {
456 var fitSpan = Math.min (totalAscent / align, totalDescent / (1.0 - align));
457 viewSpan = Math.max (Math.min (maxSpan, fitSpan), minSpan);
458 }} else {
459 viewSpan = v.getPreferredSpan (axis);
460 }offsets[i] = totalAscent - Clazz.floatToInt (viewSpan * align);
461 spans[i] = Clazz.floatToInt (viewSpan);
462 }
463 }, "~N,~N,~A,~A");
464 Clazz.defineMethod (c$, "baselineRequirements", 
465 function (axis, r) {
466 var totalAscent =  new javax.swing.SizeRequirements ();
467 var totalDescent =  new javax.swing.SizeRequirements ();
468 if (r == null) {
469 r =  new javax.swing.SizeRequirements ();
470 }r.alignment = 0.5;
471 var n = this.getViewCount ();
472 for (var i = 0; i < n; i++) {
473 var v = this.getView (i);
474 var align = v.getAlignment (axis);
475 var span;
476 var ascent;
477 var descent;
478 span = v.getPreferredSpan (axis);
479 ascent = Clazz.floatToInt (align * span);
480 descent = Clazz.floatToInt (span - ascent);
481 totalAscent.preferred = Math.max (ascent, totalAscent.preferred);
482 totalDescent.preferred = Math.max (descent, totalDescent.preferred);
483 if (v.getResizeWeight (axis) > 0) {
484 span = v.getMinimumSpan (axis);
485 ascent = Clazz.floatToInt (align * span);
486 descent = Clazz.floatToInt (span - ascent);
487 totalAscent.minimum = Math.max (ascent, totalAscent.minimum);
488 totalDescent.minimum = Math.max (descent, totalDescent.minimum);
489 span = v.getMaximumSpan (axis);
490 ascent = Clazz.floatToInt (align * span);
491 descent = Clazz.floatToInt (span - ascent);
492 totalAscent.maximum = Math.max (ascent, totalAscent.maximum);
493 totalDescent.maximum = Math.max (descent, totalDescent.maximum);
494 } else {
495 totalAscent.minimum = Math.max (ascent, totalAscent.minimum);
496 totalDescent.minimum = Math.max (descent, totalDescent.minimum);
497 totalAscent.maximum = Math.max (ascent, totalAscent.maximum);
498 totalDescent.maximum = Math.max (descent, totalDescent.maximum);
499 }}
500 r.preferred = Math.min (totalAscent.preferred + totalDescent.preferred, 2147483647);
501 if (r.preferred > 0) {
502 r.alignment = totalAscent.preferred / r.preferred;
503 }if (r.alignment == 0.0) {
504 r.minimum = totalDescent.minimum;
505 r.maximum = totalDescent.maximum;
506 } else if (r.alignment == 1.0) {
507 r.minimum = totalAscent.minimum;
508 r.maximum = totalAscent.maximum;
509 } else {
510 r.minimum = Math.round (Math.max (totalAscent.minimum / r.alignment, totalDescent.minimum / (1.0 - r.alignment)));
511 r.maximum = Math.round (Math.min (totalAscent.maximum / r.alignment, totalDescent.maximum / (1.0 - r.alignment)));
512 }return r;
513 }, "~N,javax.swing.SizeRequirements");
514 Clazz.defineMethod (c$, "getOffset", 
515 function (axis, childIndex) {
516 var offsets = (axis == this.majorAxis) ? this.majorOffsets : this.minorOffsets;
517 return offsets[childIndex];
518 }, "~N,~N");
519 Clazz.defineMethod (c$, "getSpan", 
520 function (axis, childIndex) {
521 var spans = (axis == this.majorAxis) ? this.majorSpans : this.minorSpans;
522 return spans[childIndex];
523 }, "~N,~N");
524 Clazz.defineMethod (c$, "flipEastAndWestAtEnds", 
525 function (position, bias) {
526 if (this.majorAxis == 1) {
527 var testPos = (bias === javax.swing.text.Position.Bias.Backward) ? Math.max (0, position - 1) : position;
528 var index = this.getViewIndexAtPosition (testPos);
529 if (index != -1) {
530 var v = this.getView (index);
531 if (v != null && Clazz.instanceOf (v, javax.swing.text.CompositeView)) {
532 return (v).flipEastAndWestAtEnds (position, bias);
533 }}}return false;
534 }, "~N,javax.swing.text.Position.Bias");
535 });