Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.text.
AbstractDocument.AbstractElement

java.lang.Object
  |
  +--com.sun.java.swing.text.AbstractDocument.AbstractElement
Subclasses:
AbstractDocument.BranchElement, AbstractDocument.LeafElement

public abstract class AbstractDocument.AbstractElement
extends java.lang.Object
implements Element, MutableAttributeSet, java.io.Serializable
Implements the abstract part of an element. By default elements support attributes by having a field that represents the immutable part of the current attribute set for the element. The element itself implements MutableAttributeSet which can be used to modify the set by fetching a new immutable set. The immutable sets are provided by the AttributeContext associated with the document.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
Serialized Form

Constructor Summary
AbstractDocument.AbstractElement(AbstractDocument this$0, Element parent, AttributeSet a)
          Creates a new AbstractElement.
 
Method Summary
void addAttribute(java.lang.Object name, java.lang.Object value)
          Adds an attribute to the element.
void addAttributes(AttributeSet attr)
          Adds a set of attributes to the element.
boolean containsAttribute(java.lang.Object name, java.lang.Object value)
          Checks whether a given attribute name/value is defined.
boolean containsAttributes(AttributeSet attrs)
          Checks whether the element contains all the attributes.
AttributeSet copyAttributes()
          Copies a set of attributes.
void dump(java.io.PrintStream out, int indentAmount)
          Dumps a debugging representation of the element hierarchy.
void finalize()
          Finalizes an AbstractElement.
java.lang.Object getAttribute(java.lang.Object attrName)
          Gets the value of an attribute.
int getAttributeCount()
          Gets the number of attributes that are defined.
java.util.Enumeration getAttributeNames()
          Gets the names of all attributes.
AttributeSet getAttributes()
          Gets the attributes for the element.
Document getDocument()
          Retrieves the underlying model.
Element getElement(int index)
          Gets a child element.
int getElementCount()
          Gets the number of children for the element.
int getElementIndex(int offset)
          Gets the child element index closest to the given model offset.
int getEndOffset()
          Gets the ending offset in the model for the element.
java.lang.String getName()
          Gets the name of the element.
Element getParentElement()
          Gets the parent of the element.
AttributeSet getResolveParent()
          Gets the resolving parent.
int getStartOffset()
          Gets the starting offset in the model for the element.
boolean isDefined(java.lang.Object attrName)
          Checks whether a given attribute is defined.
boolean isEqual(AttributeSet attr)
          Checks whether two attribute sets are equal.
boolean isLeaf()
          Checks whether the element is a leaf.
void removeAttribute(java.lang.Object name)
          Removes an attribute from the set.
void removeAttributes(java.util.Enumeration names)
          Removes a set of attributes for the element.
void removeAttributes(AttributeSet attrs)
          Removes a set of attributes for the element.
void setResolveParent(AttributeSet parent)
          Sets the resolving parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

AbstractDocument.AbstractElement

public AbstractDocument.AbstractElement(AbstractDocument this$0,
                                        Element parent,
                                        AttributeSet a)
Creates a new AbstractElement.
Parameters:
parent - the parent element
a - the attributes for the element
Method Detail

dump

public void dump(java.io.PrintStream out,
                 int indentAmount)
Dumps a debugging representation of the element hierarchy.
Parameters:
out - the output stream
indentAmount - the indentation level >= 0

finalize

protected void finalize()
                throws java.lang.Throwable
Finalizes an AbstractElement.
Overrides:
finalize in class java.lang.Object

getAttributeCount

public int getAttributeCount()
Gets the number of attributes that are defined.
Returns:
the number of attributes >= 0
See Also:
getAttributeCount

isDefined

public boolean isDefined(java.lang.Object attrName)
Checks whether a given attribute is defined.
Parameters:
attrName - the non-null attribute name
Returns:
true if the attribute is defined
See Also:
isDefined

isEqual

public boolean isEqual(AttributeSet attr)
Checks whether two attribute sets are equal.
Parameters:
attr - the attribute set to check against
Returns:
true if the same
See Also:
isEqual

copyAttributes

public AttributeSet copyAttributes()
Copies a set of attributes.
Returns:
the copy
See Also:
copyAttributes

getAttribute

public java.lang.Object getAttribute(java.lang.Object attrName)
Gets the value of an attribute.
Parameters:
attrName - the non-null attribute name
Returns:
the attribute value
See Also:
getAttribute

getAttributeNames

public java.util.Enumeration getAttributeNames()
Gets the names of all attributes.
Returns:
the attribute names as an enumeration
See Also:
getAttributeNames

containsAttribute

public boolean containsAttribute(java.lang.Object name,
                                 java.lang.Object value)
Checks whether a given attribute name/value is defined.
Parameters:
name - the non-null attribute name
value - the attribute value
Returns:
true if the name/value is defined
See Also:
containsAttribute

containsAttributes

public boolean containsAttributes(AttributeSet attrs)
Checks whether the element contains all the attributes.
Parameters:
attrs - the attributes to check
Returns:
true if the element contains all the attributes
See Also:
containsAttributes

getResolveParent

public AttributeSet getResolveParent()
Gets the resolving parent. If not overriden, the resolving parent defaults to the parent element.
Returns:
the attributes from the parent, null if none
See Also:
getResolveParent

addAttribute

public void addAttribute(java.lang.Object name,
                         java.lang.Object value)
Adds an attribute to the element.
Specified by:
addAttribute in interface MutableAttributeSet
Parameters:
name - the non-null attribute name
value - the attribute value
See Also:
addAttribute

addAttributes

public void addAttributes(AttributeSet attr)
Adds a set of attributes to the element.
Specified by:
addAttributes in interface MutableAttributeSet
Parameters:
attr - the attributes to add
See Also:
addAttribute

removeAttribute

public void removeAttribute(java.lang.Object name)
Removes an attribute from the set.
Specified by:
removeAttribute in interface MutableAttributeSet
Parameters:
name - the non-null attribute name
See Also:
removeAttribute

removeAttributes

public void removeAttributes(java.util.Enumeration names)
Removes a set of attributes for the element.
Specified by:
removeAttributes in interface MutableAttributeSet
Parameters:
names - the attribute names
See Also:
removeAttributes

removeAttributes

public void removeAttributes(AttributeSet attrs)
Removes a set of attributes for the element.
Specified by:
removeAttributes in interface MutableAttributeSet
Parameters:
attrs - the attributes
See Also:
removeAttributes

setResolveParent

public void setResolveParent(AttributeSet parent)
Sets the resolving parent.
Specified by:
setResolveParent in interface MutableAttributeSet
Parameters:
parent - the parent, null if none
See Also:
setResolveParent

getDocument

public Document getDocument()
Retrieves the underlying model.
Specified by:
getDocument in interface Element
Returns:
the model

getParentElement

public Element getParentElement()
Gets the parent of the element.
Specified by:
getParentElement in interface Element
Returns:
the parent

getAttributes

public AttributeSet getAttributes()
Gets the attributes for the element.
Specified by:
getAttributes in interface Element
Returns:
the attribute set

getName

public java.lang.String getName()
Gets the name of the element.
Specified by:
getName in interface Element
Returns:
the name, null if none

getStartOffset

public abstract int getStartOffset()
Gets the starting offset in the model for the element.
Specified by:
getStartOffset in interface Element
Returns:
the offset >= 0

getEndOffset

public abstract int getEndOffset()
Gets the ending offset in the model for the element.
Specified by:
getEndOffset in interface Element
Returns:
the offset >= 0

getElement

public abstract Element getElement(int index)
Gets a child element.
Specified by:
getElement in interface Element
Parameters:
index - the child index, >= 0 && < getElementCount()
Returns:
the child element

getElementCount

public abstract int getElementCount()
Gets the number of children for the element.
Specified by:
getElementCount in interface Element
Returns:
the number of children >= 0

getElementIndex

public abstract int getElementIndex(int offset)
Gets the child element index closest to the given model offset.
Specified by:
getElementIndex in interface Element
Parameters:
offset - the offset >= 0
Returns:
the element index >= 0

isLeaf

public abstract boolean isLeaf()
Checks whether the element is a leaf.
Specified by:
isLeaf in interface Element
Returns:
true if a leaf

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.