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