1 Clazz.declarePackage ("swingjs");
2 Clazz.load (["org.xml.sax.AttributeList", "org.xml.sax.ext.Attributes2"], "swingjs.JSSAXAttributes", ["java.util.Hashtable", "swingjs.api.DOMNode"], function () {
3 c$ = Clazz.decorateAsClass (function () {
6 Clazz.instantialize (this, arguments);
7 }, swingjs, "JSSAXAttributes", null, [org.xml.sax.ext.Attributes2, org.xml.sax.AttributeList]);
8 Clazz.defineMethod (c$, "createNameMap",
10 this.nameMap = new java.util.Hashtable ();
11 for (var i = this.nodes.length; --i >= 0; ) {
12 var ii = Integer.$valueOf (i);
13 this.nameMap.put (swingjs.JSSAXAttributes.getFullName (this.getURI (i), this.getLocalName (i), null), ii);
14 this.nameMap.put (this.getQName (i), ii);
17 Clazz.makeConstructor (c$,
19 this.nodes = swingjs.api.DOMNode.getAttr (node, "attributes");
20 }, "swingjs.api.DOMNode");
21 Clazz.overrideMethod (c$, "getLength",
23 return this.nodes.length;
25 Clazz.defineMethod (c$, "getAttr",
26 function (index, key) {
27 if (index < 0 || index >= this.nodes.length) return null;
28 var s = swingjs.api.DOMNode.getAttr (this.nodes[index], key);
29 return (s == null ? "" : s);
31 Clazz.overrideMethod (c$, "getURI",
33 return this.getAttr (index, "nameSpaceURI");
35 Clazz.overrideMethod (c$, "getLocalName",
37 return this.getAttr (index, "localName");
39 Clazz.overrideMethod (c$, "getQName",
41 return this.getAttr (index, "nodeName");
43 Clazz.defineMethod (c$, "getType",
47 Clazz.defineMethod (c$, "getValue",
49 return this.getAttr (index, "value");
51 Clazz.defineMethod (c$, "getIndex",
52 function (uri, localName) {
53 return this.getIndex2 (uri, localName);
55 Clazz.defineMethod (c$, "getIndex2",
56 function (uri, localName) {
57 if (this.nameMap == null) this.createNameMap ();
58 var ii = this.nameMap.get (swingjs.JSSAXAttributes.getFullName (uri, localName, null));
59 return (ii == null ? -1 : ii.intValue ());
61 Clazz.defineMethod (c$, "getIndex",
63 return this.getIndex1 (qName);
65 Clazz.defineMethod (c$, "getIndex1",
67 if (this.nameMap == null) this.createNameMap ();
68 var ii = this.nameMap.get (qName);
69 return (ii == null ? -1 : ii.intValue ());
71 Clazz.defineMethod (c$, "getType",
72 function (uri, localName) {
73 var i = this.getIndex2 (uri, localName);
74 return (i < 0 ? null : this.getType (i));
76 Clazz.defineMethod (c$, "getType",
78 var i = this.getIndex (qName);
79 return (i < 0 ? null : this.getType (i));
81 Clazz.defineMethod (c$, "getValue",
82 function (uri, localName) {
83 var i = this.getIndex2 (uri, localName);
84 return (i < 0 ? null : this.getType (i));
86 Clazz.defineMethod (c$, "getValue",
88 var i = this.getIndex (qName);
89 return (i < 0 ? null : this.getValue (i));
91 Clazz.overrideMethod (c$, "getName",
93 return this.getAttr (i, "name");
95 Clazz.defineMethod (c$, "isDeclared",
99 Clazz.defineMethod (c$, "isDeclared",
103 Clazz.defineMethod (c$, "isDeclared",
104 function (uri, localName) {
107 Clazz.defineMethod (c$, "isSpecified",
111 Clazz.defineMethod (c$, "isSpecified",
112 function (uri, localName) {
115 Clazz.defineMethod (c$, "isSpecified",
119 c$.getFullName = Clazz.defineMethod (c$, "getFullName",
120 function (uri, localName, qName) {
121 return (uri == null || uri.length == 0 ? "" : uri + "#") + (qName == null || qName.length == 0 || qName.equals (localName) ? localName : qName);