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