javax.swing.text.rtf
Class MockAttributeSet

java.lang.Object
  extended byjavax.swing.text.rtf.MockAttributeSet
All Implemented Interfaces:
AttributeSet, MutableAttributeSet

class MockAttributeSet
extends Object
implements AttributeSet, MutableAttributeSet


Nested Class Summary
 
Nested classes inherited from class javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
 
Field Summary
 Dictionary backing
           
 
Fields inherited from interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
 
Constructor Summary
(package private) MockAttributeSet()
           
 
Method Summary
 void addAttribute(Object name, Object value)
          Creates a new attribute set similar to this one except that it contains an attribute with the given name and value.
 void addAttributes(AttributeSet attr)
          Creates a new attribute set similar to this one except that it contains the given attributes and values.
 boolean containsAttribute(Object name, Object value)
          Returns true if this set contains this attribute with an equal value.
 boolean containsAttributes(AttributeSet attr)
          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 isEmpty()
           
 boolean isEqual(AttributeSet attr)
          Determines if the two attribute sets are equivalent.
 void removeAttribute(Object name)
          Removes an attribute with the given name.
 void removeAttributes(AttributeSet attr)
          Removes a set of attributes with the given name.
 void removeAttributes(Enumeration en)
          Removes an attribute set with the given names.
 void setResolveParent(AttributeSet pp)
          Sets the resolving parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backing

public Dictionary backing
Constructor Detail

MockAttributeSet

MockAttributeSet()
Method Detail

isEmpty

public boolean isEmpty()

getAttributeCount

public int getAttributeCount()
Description copied from interface: AttributeSet
Returns the number of attributes contained in this set.

Specified by:
getAttributeCount in interface AttributeSet
Returns:
the number of attributes >= 0

isDefined

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

Specified by:
isDefined in interface AttributeSet
Parameters:
name - the attribute name
Returns:
true if the attribute has a value specified

isEqual

public boolean isEqual(AttributeSet attr)
Description copied from interface: AttributeSet
Determines if the two attribute sets are equivalent.

Specified by:
isEqual in interface AttributeSet
Parameters:
attr - an attribute set
Returns:
true if the sets are equivalent

copyAttributes

public AttributeSet copyAttributes()
Description copied from interface: AttributeSet
Returns an attribute set that is guaranteed not to change over time.

Specified by:
copyAttributes in interface AttributeSet
Returns:
a copy of the attribute set

getAttribute

public Object getAttribute(Object name)
Description copied from interface: AttributeSet
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
Parameters:
name - the non-null key of the attribute binding
Returns:
the value

addAttribute

public void addAttribute(Object name,
                         Object value)
Description copied from interface: MutableAttributeSet
Creates a new attribute set similar to this one except that it contains an attribute with the given name and value. The object must be immutable, or not mutated by any client.

Specified by:
addAttribute in interface MutableAttributeSet
Parameters:
name - the name
value - the value

addAttributes

public void addAttributes(AttributeSet attr)
Description copied from interface: MutableAttributeSet
Creates a new attribute set similar to this one except that it contains the given attributes and values.

Specified by:
addAttributes in interface MutableAttributeSet
Parameters:
attr - the set of attributes

removeAttribute

public void removeAttribute(Object name)
Description copied from interface: MutableAttributeSet
Removes an attribute with the given name.

Specified by:
removeAttribute in interface MutableAttributeSet
Parameters:
name - the attribute name

removeAttributes

public void removeAttributes(AttributeSet attr)
Description copied from interface: MutableAttributeSet
Removes a set of attributes with the given name.

Specified by:
removeAttributes in interface MutableAttributeSet
Parameters:
attr - the set of attributes

removeAttributes

public void removeAttributes(Enumeration en)
Description copied from interface: MutableAttributeSet
Removes an attribute set with the given names.

Specified by:
removeAttributes in interface MutableAttributeSet
Parameters:
en - the set of names

setResolveParent

public void setResolveParent(AttributeSet pp)
Description copied from interface: MutableAttributeSet
Sets the resolving parent. This is the set of attributes to resolve through if an attribute isn't defined locally.

Specified by:
setResolveParent in interface MutableAttributeSet
Parameters:
pp - the parent

getAttributeNames

public Enumeration getAttributeNames()
Description copied from interface: AttributeSet
Returns an enumeration over the names of the attributes in the set. The values of the Enumeration may be anything and are not constrained to a particular Object type. The set does not include the resolving parent, if one is defined.

Specified by:
getAttributeNames in interface AttributeSet
Returns:
the names

containsAttribute

public boolean containsAttribute(Object name,
                                 Object value)
Description copied from interface: AttributeSet
Returns true if this set contains this attribute with an equal value.

Specified by:
containsAttribute in interface AttributeSet
Parameters:
name - the non-null attribute name
value - the value
Returns:
true if the set contains the attribute with an equal value

containsAttributes

public boolean containsAttributes(AttributeSet attr)
Description copied from interface: AttributeSet
Returns true if this set contains all the attributes with equal values.

Specified by:
containsAttributes in interface AttributeSet
Parameters:
attr - the set of attributes to check against
Returns:
true if this set contains all the attributes with equal values

getResolveParent

public AttributeSet getResolveParent()
Description copied from interface: AttributeSet
Gets the resolving parent.

Specified by:
getResolveParent in interface AttributeSet
Returns:
the parent