1 Clazz.declarePackage ("javax.swing.text");
\r
2 Clazz.load (["javax.swing.text.AttributeSet", "$.MutableAttributeSet", "java.util.Hashtable"], "javax.swing.text.SimpleAttributeSet", ["java.util.Enumeration", "$.NoSuchElementException", "javax.swing.text.StyleConstants"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
5 Clazz.instantialize (this, arguments);
\r
6 }, javax.swing.text, "SimpleAttributeSet", null, [javax.swing.text.MutableAttributeSet, Cloneable]);
\r
7 Clazz.prepareFields (c$, function () {
\r
8 this.table = new java.util.Hashtable (3);
\r
10 Clazz.makeConstructor (c$,
\r
13 Clazz.makeConstructor (c$,
\r
15 this.addAttributes (source);
\r
16 }, "javax.swing.text.AttributeSet");
\r
17 Clazz.defineMethod (c$, "isEmpty",
\r
19 return this.table.isEmpty ();
\r
21 Clazz.defineMethod (c$, "getAttributeCount",
\r
23 return this.table.size ();
\r
25 Clazz.overrideMethod (c$, "isDefined",
\r
26 function (attrName) {
\r
27 return this.table.containsKey (attrName);
\r
29 Clazz.overrideMethod (c$, "isEqual",
\r
31 return ((this.getAttributeCount () == attr.getAttributeCount ()) && this.containsAttributes (attr));
\r
32 }, "javax.swing.text.AttributeSet");
\r
33 Clazz.overrideMethod (c$, "copyAttributes",
\r
35 return this.clone ();
\r
37 Clazz.defineMethod (c$, "getAttributeNames",
\r
39 return this.table.keys ();
\r
41 Clazz.defineMethod (c$, "getAttribute",
\r
43 var value = this.table.get (name);
\r
44 if (value == null) {
\r
45 var parent = this.getResolveParent ();
\r
46 if (parent != null) {
\r
47 value = parent.getAttribute (name);
\r
50 Clazz.overrideMethod (c$, "containsAttribute",
\r
51 function (name, value) {
\r
52 return value.equals (this.getAttribute (name));
\r
54 Clazz.overrideMethod (c$, "containsAttributes",
\r
55 function (attributes) {
\r
57 var names = attributes.getAttributeNames ();
\r
58 while (result && names.hasMoreElements ()) {
\r
59 var name = names.nextElement ();
\r
60 result = attributes.getAttribute (name).equals (this.getAttribute (name));
\r
63 }, "javax.swing.text.AttributeSet");
\r
64 Clazz.overrideMethod (c$, "addAttribute",
\r
65 function (name, value) {
\r
66 this.table.put (name, value);
\r
68 Clazz.overrideMethod (c$, "addAttributes",
\r
69 function (attributes) {
\r
70 var names = attributes.getAttributeNames ();
\r
71 while (names.hasMoreElements ()) {
\r
72 var name = names.nextElement ();
\r
73 this.addAttribute (name, attributes.getAttribute (name));
\r
75 }, "javax.swing.text.AttributeSet");
\r
76 Clazz.overrideMethod (c$, "removeAttribute",
\r
78 this.table.remove (name);
\r
80 Clazz.defineMethod (c$, "removeAttributes",
\r
82 while (names.hasMoreElements ()) this.removeAttribute (names.nextElement ());
\r
84 }, "java.util.Enumeration");
\r
85 Clazz.defineMethod (c$, "removeAttributes",
\r
86 function (attributes) {
\r
87 if (attributes === this) {
\r
88 this.table.clear ();
\r
90 var names = attributes.getAttributeNames ();
\r
91 while (names.hasMoreElements ()) {
\r
92 var name = names.nextElement ();
\r
93 var value = attributes.getAttribute (name);
\r
94 if (value.equals (this.getAttribute (name))) this.removeAttribute (name);
\r
96 }}, "javax.swing.text.AttributeSet");
\r
97 Clazz.overrideMethod (c$, "getResolveParent",
\r
99 return this.table.get (javax.swing.text.StyleConstants.ResolveAttribute);
\r
101 Clazz.overrideMethod (c$, "setResolveParent",
\r
102 function (parent) {
\r
103 this.addAttribute (javax.swing.text.StyleConstants.ResolveAttribute, parent);
\r
104 }, "javax.swing.text.AttributeSet");
\r
105 Clazz.defineMethod (c$, "clone",
\r
109 attr = Clazz.superCall (this, javax.swing.text.SimpleAttributeSet, "clone", []);
\r
110 attr.table = this.table.clone ();
\r
112 if (Clazz.exceptionOf (cnse, CloneNotSupportedException)) {
\r
120 Clazz.overrideMethod (c$, "hashCode",
\r
122 return this.table.hashCode ();
\r
124 Clazz.defineMethod (c$, "equals",
\r
126 if (this === obj) {
\r
128 }if (Clazz.instanceOf (obj, javax.swing.text.AttributeSet)) {
\r
130 return this.isEqual (attrs);
\r
133 Clazz.overrideMethod (c$, "toString",
\r
136 var names = this.getAttributeNames ();
\r
137 while (names.hasMoreElements ()) {
\r
138 var key = names.nextElement ();
\r
139 var value = this.getAttribute (key);
\r
140 if (Clazz.instanceOf (value, javax.swing.text.AttributeSet)) {
\r
141 s = s + key + "=**AttributeSet** ";
\r
143 s = s + key + "=" + value + " ";
\r
147 Clazz.pu$h(self.c$);
\r
148 c$ = Clazz.declareType (javax.swing.text.SimpleAttributeSet, "EmptyAttributeSet", null, javax.swing.text.AttributeSet);
\r
149 Clazz.defineMethod (c$, "getAttributeCount",
\r
153 Clazz.overrideMethod (c$, "isDefined",
\r
157 Clazz.overrideMethod (c$, "isEqual",
\r
159 return (a.getAttributeCount () == 0);
\r
160 }, "javax.swing.text.AttributeSet");
\r
161 Clazz.overrideMethod (c$, "copyAttributes",
\r
165 Clazz.overrideMethod (c$, "getAttribute",
\r
169 Clazz.overrideMethod (c$, "getAttributeNames",
\r
171 return ((Clazz.isClassDefined ("javax.swing.text.SimpleAttributeSet$EmptyAttributeSet$1") ? 0 : javax.swing.text.SimpleAttributeSet.EmptyAttributeSet.$SimpleAttributeSet$EmptyAttributeSet$1$ ()), Clazz.innerTypeInstance (javax.swing.text.SimpleAttributeSet$EmptyAttributeSet$1, this, null));
\r
173 Clazz.overrideMethod (c$, "containsAttribute",
\r
177 Clazz.overrideMethod (c$, "containsAttributes",
\r
179 return (a.getAttributeCount () == 0);
\r
180 }, "javax.swing.text.AttributeSet");
\r
181 Clazz.overrideMethod (c$, "getResolveParent",
\r
185 Clazz.overrideMethod (c$, "equals",
\r
189 }return ((Clazz.instanceOf (a, javax.swing.text.AttributeSet)) && ((a).getAttributeCount () == 0));
\r
191 Clazz.overrideMethod (c$, "hashCode",
\r
195 c$.$SimpleAttributeSet$EmptyAttributeSet$1$ = function () {
\r
196 Clazz.pu$h(self.c$);
\r
197 c$ = Clazz.declareAnonymous (javax.swing.text, "SimpleAttributeSet$EmptyAttributeSet$1", null, java.util.Enumeration);
\r
198 Clazz.overrideMethod (c$, "hasMoreElements",
\r
202 Clazz.overrideMethod (c$, "nextElement",
\r
204 throw new java.util.NoSuchElementException ();
\r
209 c$.EMPTY = c$.prototype.EMPTY = new javax.swing.text.SimpleAttributeSet.EmptyAttributeSet ();
\r