|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.text.AbstractDocument.AbstractElement
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 applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Inner classes inherited from class javax.swing.text.AttributeSet |
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
Fields inherited from interface javax.swing.text.AttributeSet |
NameAttribute, ResolveAttribute |
Constructor Summary | |
AbstractDocument.AbstractElement(Element parent,
AttributeSet a)
Creates a new AbstractElement. |
Method Summary | |
void |
addAttribute(Object name,
Object value)
Adds an attribute to the element. |
void |
addAttributes(AttributeSet attr)
Adds a set of attributes to the element. |
abstract Enumeration |
children()
Returns the children of the reciever as an Enumeration. |
boolean |
containsAttribute(Object name,
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(PrintStream psOut,
int indentAmount)
Dumps a debugging representation of the element hierarchy. |
protected void |
finalize()
Finalizes an AbstractElement. |
abstract boolean |
getAllowsChildren()
Returns true if the receiver allows children. |
Object |
getAttribute(Object attrName)
Gets the value of an attribute. |
int |
getAttributeCount()
Gets the number of attributes that are defined. |
Enumeration |
getAttributeNames()
Gets the names of all attributes. |
AttributeSet |
getAttributes()
Gets the attributes for the element. |
TreeNode |
getChildAt(int childIndex)
Returns the child TreeNode at index
childIndex . |
int |
getChildCount()
Returns the number of children TreeNode s the receiver
contains. |
Document |
getDocument()
Retrieves the underlying model. |
abstract Element |
getElement(int index)
Gets a child element. |
abstract int |
getElementCount()
Gets the number of children for the element. |
abstract int |
getElementIndex(int offset)
Gets the child element index closest to the given model offset. |
abstract int |
getEndOffset()
Gets the ending offset in the model for the element. |
int |
getIndex(TreeNode node)
Returns the index of node in the receivers children. |
String |
getName()
Gets the name of the element. |
TreeNode |
getParent()
Returns the parent TreeNode of the receiver. |
Element |
getParentElement()
Gets the parent of the element. |
AttributeSet |
getResolveParent()
Gets the resolving parent. |
abstract int |
getStartOffset()
Gets the starting offset in the model for the element. |
boolean |
isDefined(Object attrName)
Checks whether a given attribute is defined. |
boolean |
isEqual(AttributeSet attr)
Checks whether two attribute sets are equal. |
abstract boolean |
isLeaf()
Checks whether the element is a leaf. |
void |
removeAttribute(Object name)
Removes an attribute from the set. |
void |
removeAttributes(AttributeSet attrs)
Removes a set of attributes for the element. |
void |
removeAttributes(Enumeration names)
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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractDocument.AbstractElement(Element parent, AttributeSet a)
parent
- the parent elementa
- the attributes for the elementMethod Detail |
public void dump(PrintStream psOut, int indentAmount)
out
- the output streamindentAmount
- the indentation level >= 0protected void finalize() throws Throwable
finalize
in class Object
java.lang.Object
Throwable
- the Exception
raised by this methodpublic int getAttributeCount()
getAttributeCount
in interface AttributeSet
AttributeSet.getAttributeCount()
public boolean isDefined(Object attrName)
isDefined
in interface AttributeSet
attrName
- the non-null attribute nameAttributeSet.isDefined(java.lang.Object)
public boolean isEqual(AttributeSet attr)
isEqual
in interface AttributeSet
attr
- the attribute set to check againstAttributeSet.isEqual(javax.swing.text.AttributeSet)
public AttributeSet copyAttributes()
copyAttributes
in interface AttributeSet
AttributeSet.copyAttributes()
public Object getAttribute(Object attrName)
getAttribute
in interface AttributeSet
attrName
- the non-null attribute nameAttributeSet.getAttribute(java.lang.Object)
public Enumeration getAttributeNames()
getAttributeNames
in interface AttributeSet
AttributeSet.getAttributeNames()
public boolean containsAttribute(Object name, Object value)
containsAttribute
in interface AttributeSet
name
- the non-null attribute namevalue
- the attribute valueAttributeSet.containsAttribute(java.lang.Object, java.lang.Object)
public boolean containsAttributes(AttributeSet attrs)
containsAttributes
in interface AttributeSet
attrs
- the attributes to checkAttributeSet.containsAttributes(javax.swing.text.AttributeSet)
public AttributeSet getResolveParent()
getResolveParent
in interface AttributeSet
AttributeSet.getResolveParent()
public void addAttribute(Object name, Object value)
addAttribute
in interface MutableAttributeSet
name
- the non-null attribute namevalue
- the attribute valueMutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void addAttributes(AttributeSet attr)
addAttributes
in interface MutableAttributeSet
attr
- the attributes to addMutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)
public void removeAttribute(Object name)
removeAttribute
in interface MutableAttributeSet
name
- the non-null attribute nameMutableAttributeSet.removeAttribute(java.lang.Object)
public void removeAttributes(Enumeration names)
removeAttributes
in interface MutableAttributeSet
names
- the attribute namesMutableAttributeSet.removeAttributes(java.util.Enumeration)
public void removeAttributes(AttributeSet attrs)
removeAttributes
in interface MutableAttributeSet
attrs
- the attributesMutableAttributeSet.removeAttributes(java.util.Enumeration)
public void setResolveParent(AttributeSet parent)
setResolveParent
in interface MutableAttributeSet
parent
- the parent, null if noneMutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)
public Document getDocument()
getDocument
in interface Element
public Element getParentElement()
getParentElement
in interface Element
public AttributeSet getAttributes()
getAttributes
in interface Element
public String getName()
getName
in interface Element
public abstract int getStartOffset()
getStartOffset
in interface Element
public abstract int getEndOffset()
getEndOffset
in interface Element
public abstract Element getElement(int index)
getElement
in interface Element
index
- the child index, >= 0 && < getElementCount()public abstract int getElementCount()
getElementCount
in interface Element
public abstract int getElementIndex(int offset)
getElementIndex
in interface Element
offset
- the offset >= 0public abstract boolean isLeaf()
isLeaf
in interface Element
public TreeNode getChildAt(int childIndex)
TreeNode
at index
childIndex
.getChildAt
in interface TreeNode
public int getChildCount()
TreeNode
s the receiver
contains.getChildCount
in interface TreeNode
public TreeNode getParent()
TreeNode
of the receiver.getParent
in interface TreeNode
public int getIndex(TreeNode node)
node
in the receivers children.
If the receiver does not contain node
, -1 will be
returned.getIndex
in interface TreeNode
public abstract boolean getAllowsChildren()
getAllowsChildren
in interface TreeNode
public abstract Enumeration children()
children
in interface TreeNode
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.