JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / java / text / Format.js
1 Clazz.declarePackage ("java.text");\r
2 Clazz.load (["java.text.AttributedCharacterIterator"], "java.text.Format", ["java.lang.StringBuffer", "java.text.AttributedString", "$.FieldPosition", "$.ParseException", "$.ParsePosition"], function () {\r
3 c$ = Clazz.declareType (java.text, "Format", null, [java.io.Serializable, Cloneable]);\r
4 Clazz.makeConstructor (c$, \r
5 function () {\r
6 });\r
7 Clazz.defineMethod (c$, "format", \r
8 function (obj) {\r
9 return this.format (obj,  new StringBuffer (),  new java.text.FieldPosition (0)).toString ();\r
10 }, "~O");\r
11 Clazz.defineMethod (c$, "formatToCharacterIterator", \r
12 function (obj) {\r
13 return this.createAttributedCharacterIterator (this.format (obj));\r
14 }, "~O");\r
15 Clazz.defineMethod (c$, "parseObject", \r
16 function (source) {\r
17 var pos =  new java.text.ParsePosition (0);\r
18 var result = this.parseObject (source, pos);\r
19 if (pos.index == 0) {\r
20 throw  new java.text.ParseException ("Format.parseObject(String) failed", pos.errorIndex);\r
21 }return result;\r
22 }, "~S");\r
23 Clazz.defineMethod (c$, "clone", \r
24 function () {\r
25 try {\r
26 return Clazz.superCall (this, java.text.Format, "clone", []);\r
27 } catch (e) {\r
28 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {\r
29 return null;\r
30 } else {\r
31 throw e;\r
32 }\r
33 }\r
34 });\r
35 Clazz.defineMethod (c$, "createAttributedCharacterIterator", \r
36 function (s) {\r
37 var as =  new java.text.AttributedString (s);\r
38 return as.getIterator ();\r
39 }, "~S");\r
40 Clazz.defineMethod (c$, "createAttributedCharacterIterator", \r
41 function (iterators) {\r
42 var as =  new java.text.AttributedString (iterators);\r
43 return as.getIterator ();\r
44 }, "~A");\r
45 Clazz.defineMethod (c$, "createAttributedCharacterIterator", \r
46 function (string, key, value) {\r
47 var as =  new java.text.AttributedString (string);\r
48 as.addAttribute (key, value);\r
49 return as.getIterator ();\r
50 }, "~S,java.text.AttributedCharacterIterator.Attribute,~O");\r
51 Clazz.defineMethod (c$, "createAttributedCharacterIterator", \r
52 function (iterator, key, value) {\r
53 var as =  new java.text.AttributedString (iterator);\r
54 as.addAttribute (key, value);\r
55 return as.getIterator ();\r
56 }, "java.text.AttributedCharacterIterator,java.text.AttributedCharacterIterator.Attribute,~O");\r
57 Clazz.pu$h(self.c$);\r
58 c$ = Clazz.declareType (java.text.Format, "Field", java.text.AttributedCharacterIterator.Attribute);\r
59 c$ = Clazz.p0p ();\r
60 Clazz.declareInterface (java.text.Format, "FieldDelegate");\r
61 });\r