JAL-1807 Bob
[jalviewjs.git] / site / j2s / swingjs / JSPlainDocument.js
1 Clazz.declarePackage ("swingjs");
2 Clazz.load (["swingjs.JSAbstractDocument"], "swingjs.JSPlainDocument", ["java.util.Hashtable", "JU.SB", "swingjs.JSPosition"], function () {
3 c$ = Clazz.declareType (swingjs, "JSPlainDocument", swingjs.JSAbstractDocument);
4 Clazz.makeConstructor (c$, 
5 function () {
6 Clazz.superConstructor (this, swingjs.JSPlainDocument);
7 this.sb =  new JU.SB ();
8 this.root = Clazz.innerTypeInstance (swingjs.JSAbstractDocument.JSElement, this, null);
9 });
10 Clazz.overrideMethod (c$, "getLength", 
11 function () {
12 return this.sb.length ();
13 });
14 Clazz.defineMethod (c$, "getText", 
15 function (offset, length) {
16 this.checkLoc (offset, offset + length);
17 return this.sb.substring2 (offset, offset + length);
18 }, "~N,~N");
19 Clazz.defineMethod (c$, "getText", 
20 function (offset, length, chars) {
21 this.checkLoc (offset, offset + length);
22 if (this.tempChar == null) {
23 this.tempChar =  Clazz.newCharArray (this.sb.length (), '\0');
24 for (var i = this.tempChar.length; --i >= 0; ) this.tempChar[i] = this.sb.charAt (i);
25
26 }chars.array = this.tempChar;
27 chars.offset = offset;
28 chars.count = length;
29 }, "~N,~N,javax.swing.text.Segment");
30 Clazz.overrideMethod (c$, "getStartPosition", 
31 function () {
32 return  new swingjs.JSPosition (0);
33 });
34 Clazz.overrideMethod (c$, "getEndPosition", 
35 function () {
36 return  new swingjs.JSPosition (this.sb.length ());
37 });
38 Clazz.overrideMethod (c$, "createPosition", 
39 function (offs) {
40 this.checkLoc (offs, offs);
41 var i = Integer.$valueOf (offs);
42 if (this.positions == null) this.positions =  new java.util.Hashtable ();
43 var p = this.positions.get (i);
44 if (p == null) this.positions.put (i, p =  new swingjs.JSPosition (offs));
45 return p;
46 }, "~N");
47 Clazz.overrideMethod (c$, "getDefaultRootElement", 
48 function () {
49 return this.root;
50 });
51 Clazz.overrideMethod (c$, "render", 
52 function (r) {
53 }, "Runnable");
54 Clazz.defineStatics (c$,
55 "tabSizeAttribute", "tabSize",
56 "lineLimitAttribute", "lineLimit");
57 });