Tiny fix in AbstractDocument.AbstractElement.  The O'Reilly Swing book
correctly points out that AbstractElement implements the getAttribute
method to first check the AttributeSet (and up the hierarchy through the
AttributeSet's resolveParent) as normal but then to also (if no
Attribute was found) pass the call up to the parent Element and see if
one can be found in _that_ hierarchy.  This is implemented now.

2005-12-15  Anthony Balkissoon  <[EMAIL PROTECTED]>

        * javax/swing/text/AbstractDocument.java:
        (AbstractElement.getAttribute): If no attribute could be found in the 
        AttributeSet hierarchy, then try the Element hierarchy instead.

--Tony
Index: javax/swing/text/AbstractDocument.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/AbstractDocument.java,v
retrieving revision 1.40
diff -u -r1.40 AbstractDocument.java
--- javax/swing/text/AbstractDocument.java	23 Nov 2005 14:12:39 -0000	1.40
+++ javax/swing/text/AbstractDocument.java	15 Dec 2005 21:12:02 -0000
@@ -1327,7 +1327,14 @@
      */
     public Object getAttribute(Object key)
     {
-      return attributes.getAttribute(key);
+      Object result = attributes.getAttribute(key);
+      if (result == null && element_parent != null)
+        {
+          AttributeSet parentSet = element_parent.getAttributes();
+          if (parentSet != null)
+            result = parentSet.getAttribute(key);
+        }
+      return result;
     }
 
     /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to