javax.swing.text
Class SimpleAttributeSet

java.lang.Object
  |
  +--javax.swing.text.SimpleAttributeSet
All Implemented Interfaces:
AttributeSet, Cloneable, MutableAttributeSet, Serializable

public class SimpleAttributeSet
extends Object
implements MutableAttributeSet, Serializable, Cloneable

Safe:

See Also:
Serialized Form

Field Summary
static AttributeSet EMPTY
          Suppressed: An empty attribute set.
private static Enumeration emptyEnumeration
           
private  Hashtable table
           
 
Fields inherited from interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
 
Constructor Summary
  SimpleAttributeSet()
          Enabled: Creates a new attribute set.
  SimpleAttributeSet(AttributeSet source)
          Enabled: Creates a new attribute set based on a supplied set of attributes.
private SimpleAttributeSet(Hashtable table)
           
 
Method Summary
 void addAttribute(Object name, Object value)
          Enabled: Adds an attribute to the list.
 void addAttributes(AttributeSet attributes)
          Enabled: Adds a set of attributes to the list.
 Object clone()
          Suppressed: Clones a set of attributes.
 boolean containsAttribute(Object name, Object value)
          Enabled: Checks whether the attribute list contains a specified attribute name/value pair.
 boolean containsAttributes(AttributeSet attributes)
          Enabled: Checks whether the attribute list contains all the specified name/value pairs.
 AttributeSet copyAttributes()
          Enabled: Makes a copy of the attributes.
 boolean equals(Object obj)
          Suppressed: Compares this object to the specified object.
 Object getAttribute(Object name)
          Enabled: Gets the value of an attribute.
 int getAttributeCount()
          Enabled: Gets a count of the number of attributes.
 Enumeration getAttributeNames()
          Enabled: Gets the names of the attributes in the set.
private static Enumeration getEmptyEnumeration()
           
 AttributeSet getResolveParent()
          Enabled: Gets the resolving parent.
 int hashCode()
          Suppressed: Returns a hashcode for this set of attributes.
 boolean isDefined(Object attrName)
          Enabled: Tells whether a given attribute is defined.
 boolean isEmpty()
          Enabled: Checks whether the set of attributes is empty.
 boolean isEqual(AttributeSet attr)
          Enabled: Compares two attribute sets.
private  void readObject(ObjectInputStream s)
           
 void removeAttribute(Object name)
          Enabled: Removes an attribute from the list.
 void removeAttributes(AttributeSet attributes)
          Enabled: Removes a set of attributes from the list.
 void removeAttributes(Enumeration names)
          Enabled: Removes a set of attributes from the list.
 void setResolveParent(AttributeSet parent)
          Enabled: Sets the resolving parent.
 String toString()
          Suppressed: Converts the attribute set to a String.
private  void writeObject(ObjectOutputStream s)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final AttributeSet EMPTY
Suppressed: An empty attribute set.


table

private transient Hashtable table

emptyEnumeration

private static Enumeration emptyEnumeration
Constructor Detail

SimpleAttributeSet

public SimpleAttributeSet()
Enabled: Creates a new attribute set.


SimpleAttributeSet

public SimpleAttributeSet(AttributeSet source)
Enabled: Creates a new attribute set based on a supplied set of attributes.

Parameters:
source - the set of attributes

SimpleAttributeSet

private SimpleAttributeSet(Hashtable table)
Method Detail

isEmpty

public boolean isEmpty()
Enabled: Checks whether the set of attributes is empty.

Returns:
true if the set is empty else false

getAttributeCount

public int getAttributeCount()
Enabled: Gets a count of the number of attributes.

Specified by:
getAttributeCount in interface AttributeSet
Returns:
the count

isDefined

public boolean isDefined(Object attrName)
Enabled: Tells whether a given attribute is defined.

Specified by:
isDefined in interface AttributeSet
Parameters:
attrName - the attribute name
Returns:
true if the attribute is defined

isEqual

public boolean isEqual(AttributeSet attr)
Enabled: Compares two attribute sets.

Specified by:
isEqual in interface AttributeSet
Parameters:
attr - the second attribute set
Returns:
true if the sets are equal, false otherwise

copyAttributes

public AttributeSet copyAttributes()
Enabled: Makes a copy of the attributes.

Specified by:
copyAttributes in interface AttributeSet
Returns:
the copy

getAttributeNames

public Enumeration getAttributeNames()
Enabled: Gets the names of the attributes in the set.

Specified by:
getAttributeNames in interface AttributeSet
Returns:
the names as an Enumeration

getAttribute

public Object getAttribute(Object name)
Enabled: Gets the value of an attribute.

Specified by:
getAttribute in interface AttributeSet
Parameters:
name - the attribute name
Returns:
the value

containsAttribute

public boolean containsAttribute(Object name,
                                 Object value)
Enabled: Checks whether the attribute list contains a specified attribute name/value pair.

Specified by:
containsAttribute in interface AttributeSet
Parameters:
name - the name
value - the value
Returns:
true if the name/value pair is in the list

containsAttributes

public boolean containsAttributes(AttributeSet attributes)
Enabled: Checks whether the attribute list contains all the specified name/value pairs.

Specified by:
containsAttributes in interface AttributeSet
Parameters:
attributes - the attribute list
Returns:
true if the list contains all the name/value pairs

addAttribute

public void addAttribute(Object name,
                         Object value)
Enabled: Adds an attribute to the list.

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

addAttributes

public void addAttributes(AttributeSet attributes)
Enabled: Adds a set of attributes to the list.

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

removeAttribute

public void removeAttribute(Object name)
Enabled: Removes an attribute from the list.

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

removeAttributes

public void removeAttributes(Enumeration names)
Enabled: Removes a set of attributes from the list.

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

removeAttributes

public void removeAttributes(AttributeSet attributes)
Enabled: Removes a set of attributes from the list.

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

getResolveParent

public AttributeSet getResolveParent()
Enabled: Gets the resolving parent. This is the set of attributes to resolve through if an attribute isn't defined locally. This is null if there are no other sets of attributes to resolve through.

Specified by:
getResolveParent in interface AttributeSet
Returns:
the parent

setResolveParent

public void setResolveParent(AttributeSet parent)
Enabled: Sets the resolving parent.

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

clone

public Object clone()
Suppressed: Clones a set of attributes.

Overrides:
clone in class Object
Returns:
the new set of attributes
See Also:
java.lang.Cloneable

hashCode

public int hashCode()
Suppressed: Returns a hashcode for this set of attributes.

Overrides:
hashCode in class Object
Returns:
a hashcode value for this set of attributes.
See Also:
java.lang.Object#equals(java.lang.Object), java.util.Hashtable

equals

public boolean equals(Object obj)
Suppressed: Compares this object to the specified object. The result is true if the object is an equivalent set of attributes.

Overrides:
equals in class Object
Parameters:
obj - the object to compare this attribute set with
Returns:
true if the objects are equal; false otherwise
See Also:
Object.hashCode(), java.util.Hashtable

toString

public String toString()
Suppressed: Converts the attribute set to a String.

Overrides:
toString in class Object
Returns:
the string

writeObject

private void writeObject(ObjectOutputStream s)
                  throws IOException
IOException

readObject

private void readObject(ObjectInputStream s)
                 throws ClassNotFoundException,
                        IOException
ClassNotFoundException
IOException

getEmptyEnumeration

private static Enumeration getEmptyEnumeration()


comments?