Class java.awt.swing.text.AbstractDocument.AbstractElement
java.lang.Object
|
+----java.awt.swing.text.AbstractDocument.AbstractElement
- Subclasses:
- AbstractDocument.BranchElement, AbstractDocument.LeafElement
- public abstract class AbstractDocument.AbstractElement
- extends Object
- implements Element, MutableAttributeSet, 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.
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
dump
public void dump(PrintStream out,
int indentAmount)
- Dumps a debugging representation of the element hierarchy.
- Parameters:
out
- the output stream
indentAmount
- the indentation level
finalize
protected void finalize() throws Throwable
- Finalizes an AbstractElement.
- Overrides:
- finalize in class Object
getAttributeCount
public int getAttributeCount()
- Gets the number of attributes that are defined.
- Returns:
- the number of attributes
- See Also:
- getAttributeCount
isDefined
public boolean isDefined(Object attrName)
- Checks whether a given attribute is defined.
- Parameters:
attrName
- the 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 Object getAttribute(Object attrName)
- Gets the value of an attribute.
- Parameters:
attrName
- the attribute name
- Returns:
- the attribute value
- See Also:
- getAttribute
getAttributeNames
public Enumeration getAttributeNames()
- Gets the names of all attributes.
- Returns:
- the attribute names
- See Also:
- getAttributeNames
containsAttribute
public boolean containsAttribute(Object name,
Object value)
- Checks whether a given attribute name/value is defined.
- Parameters:
name
- the 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
- See Also:
- getResolveParent
addAttribute
public void addAttribute(Object name,
Object value)
- Adds an attribute to the element.
- Implements:
- addAttribute in interface MutableAttributeSet
- Parameters:
name
- the attribute name
value
- the attribute value
- See Also:
- addAttribute
addAttributes
public void addAttributes(AttributeSet attr)
- Adds a set of attributes to the element.
- Implements:
- addAttributes in interface MutableAttributeSet
- Parameters:
attr
- the attributes to add
- See Also:
- addAttribute
removeAttribute
public void removeAttribute(Object name)
- Removes an attribute from the set.
- Implements:
- removeAttribute in interface MutableAttributeSet
- Parameters:
name
- the attribute name
- See Also:
- removeAttribute
removeAttributes
public void removeAttributes(Enumeration names)
- Removes a set of attributes for the element.
- Implements:
- 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.
- Implements:
- removeAttributes in interface MutableAttributeSet
- Parameters:
attrs
- the attributes
- See Also:
- removeAttributes
setResolveParent
public void setResolveParent(AttributeSet parent)
- Sets the resolving parent.
- Implements:
- setResolveParent in interface MutableAttributeSet
- Parameters:
parent
- the parent
- See Also:
- setResolveParent
getDocument
public Document getDocument()
- Retrieves the underlying model.
- Implements:
- getDocument in interface Element
- Returns:
- the model
getParentElement
public Element getParentElement()
- Gets the parent of the element.
- Implements:
- getParentElement in interface Element
- Returns:
- the parent
getAttributes
public AttributeSet getAttributes()
- Gets the attributes for the element.
- Implements:
- getAttributes in interface Element
- Returns:
- the attribute set
getName
public String getName()
- Gets the name of the element.
- Implements:
- getName in interface Element
- Returns:
- the name
getStartOffset
public abstract int getStartOffset()
- Gets the starting offset in the model for the element.
- Implements:
- getStartOffset in interface Element
- Returns:
- the offset
getEndOffset
public abstract int getEndOffset()
- Gets the ending offset in the model for the element.
- Implements:
- getEndOffset in interface Element
- Returns:
- the offset
getElement
public abstract Element getElement(int index)
- Gets a child element.
- Implements:
- getElement in interface Element
- Parameters:
index
- the child index
- Returns:
- the child element
getElementCount
public abstract int getElementCount()
- Gets the number of children for the element.
- Implements:
- getElementCount in interface Element
- Returns:
- the number of children
getElementIndex
public abstract int getElementIndex(int offset)
- Gets the child element index closest to the given model offset.
- Implements:
- getElementIndex in interface Element
- Parameters:
offset
- the offset
- Returns:
- the element index
isLeaf
public abstract boolean isLeaf()
- Checks whether the element is a leaf.
- Implements:
- isLeaf in interface Element
- Returns:
- true if a leaf
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
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.