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