net.sourceforge.spedit.core
Class XMLAttributes

java.lang.Object
  |
  +--net.sourceforge.spedit.core.XMLAttributes
All Implemented Interfaces:
AttributeSet

public class XMLAttributes
extends Object
implements AttributeSet

The XMLAttributes class has the same role as the XMLElementWrapper, it wraps the attributes of a JDOM element and present the methods defined in the AttributeSet interface of the Swing text package.
This class is needed by the XMLElementWrapper class.


Inner Class Summary
 class XMLAttributes.XMLAttributesEnumeration
           
 
Inner classes inherited from class javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
 
Field Summary
protected  List attributes
           
 
Fields inherited from interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
 
Constructor Summary
XMLAttributes(List attributes)
           
 
Method Summary
 Object clone()
          Create a deep copy of the current attribute set.
 boolean containsAttribute(Object name, Object value)
          Returns true if this set contains this attribute with an equal value.
 boolean containsAttributes(AttributeSet attrs)
          Returns true if this set contains all the attributes with equal values.
 AttributeSet copyAttributes()
          Returns an attribute set that is guaranteed not to change over time.
 Object getAttribute(Object name)
          Fetches the value of the given attribute.
 int getAttributeCount()
          Returns the number of attributes contained in this set.
 Enumeration getAttributeNames()
          Returns an enumeration over the names of the attributes in the set.
 AttributeSet getResolveParent()
          Gets the resolving parent.
 boolean isDefined(Object name)
          Checks whether the named attribute has a value specified in the set without resolving through another attribute set.
 boolean isEqual(AttributeSet attrs)
          Determines if the two attribute sets are equivalent.
 void setAttributes(List attributes)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributes

protected List attributes
Constructor Detail

XMLAttributes

public XMLAttributes(List attributes)
Method Detail

setAttributes

public void setAttributes(List attributes)

containsAttribute

public boolean containsAttribute(Object name,
                                 Object value)
Returns true if this set contains this attribute with an equal value.
Specified by:
containsAttribute in interface AttributeSet

containsAttributes

public boolean containsAttributes(AttributeSet attrs)
Returns true if this set contains all the attributes with equal values. This should be used instead of equals() which will not work with the JDom implementation of the attributes.
Specified by:
containsAttributes in interface AttributeSet

copyAttributes

public AttributeSet copyAttributes()
Returns an attribute set that is guaranteed not to change over time.
Specified by:
copyAttributes in interface AttributeSet

getAttribute

public Object getAttribute(Object name)
Fetches the value of the given attribute. If the value is not found locally, the search is continued upward through the resolving parent (if one exists) until the value is either found or there are no more parents. If the value is not found, null is returned.
Specified by:
getAttribute in interface AttributeSet

getAttributeCount

public int getAttributeCount()
Returns the number of attributes contained in this set.
Specified by:
getAttributeCount in interface AttributeSet

getAttributeNames

public Enumeration getAttributeNames()
Returns an enumeration over the names of the attributes in the set.
Specified by:
getAttributeNames in interface AttributeSet

getResolveParent

public AttributeSet getResolveParent()
Gets the resolving parent. AttributeSet can be used hierarchically and if the current AttributeSet doesn't find the required element, it will look inside its parent for the specified attribute until the root parent is reached.
Specified by:
getResolveParent in interface AttributeSet

clone

public Object clone()
Create a deep copy of the current attribute set. This method is used by the copyAttributes method, which guaratees that the new AttributeSet will not change if you change the original values.
Overrides:
clone in class Object

isDefined

public boolean isDefined(Object name)
Checks whether the named attribute has a value specified in the set without resolving through another attribute set.
Specified by:
isDefined in interface AttributeSet

isEqual

public boolean isEqual(AttributeSet attrs)
Determines if the two attribute sets are equivalent.
Specified by:
isEqual in interface AttributeSet

toString

public String toString()
Overrides:
toString in class Object