|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.text.AbstractDocument.AbstractElement
public abstract class AbstractDocument.AbstractElement
An abstract base implementation of the Element interface.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface javax.swing.text.AttributeSet |
|---|
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute |
| Field Summary |
|---|
| Fields inherited from interface javax.swing.text.AttributeSet |
|---|
NameAttribute, ResolveAttribute |
| Constructor Summary | |
|---|---|
AbstractDocument.AbstractElement(Element p,
AttributeSet s)
Creates a new instance of AbstractElement with a
specified parent Element and AttributeSet. |
|
| Method Summary | |
|---|---|
void |
addAttribute(Object name,
Object value)
Adds an attribute to this element. |
void |
addAttributes(AttributeSet attrs)
Adds a set of attributes to this element. |
abstract Enumeration |
children()
Returns the child nodes of this Element as an
Enumeration of TreeNodes. |
boolean |
containsAttribute(Object name,
Object value)
Returns true if this element contains the specified
attribute. |
boolean |
containsAttributes(AttributeSet attrs)
Returns true if this element contains all of the
specified attributes. |
AttributeSet |
copyAttributes()
Returns a copy of the attributes of this element. |
void |
dump(PrintStream stream,
int indent)
Prints diagnostic output to the specified stream. |
abstract boolean |
getAllowsChildren()
Returns true if this AbstractElement
allows children. |
Object |
getAttribute(Object key)
Returns the attribute value with the specified key. |
int |
getAttributeCount()
Returns the number of defined attributes in this element. |
Enumeration<?> |
getAttributeNames()
Returns the names of the attributes of this element. |
AttributeSet |
getAttributes()
Returns the attributes of this element. |
TreeNode |
getChildAt(int index)
Returns the child of this AbstractElement at
index. |
int |
getChildCount()
Returns the number of children of this AbstractElement. |
Document |
getDocument()
Returns the Document to which this element belongs. |
abstract Element |
getElement(int index)
Returns the child element at the specified index. |
abstract int |
getElementCount()
Returns the number of child elements of this element. |
abstract int |
getElementIndex(int offset)
Returns the index of the child element that spans the specified offset in the document model. |
abstract int |
getEndOffset()
Returns the offset inside the document model that is after the last character of this element. |
int |
getIndex(TreeNode node)
Returns the index of a given child TreeNode or
-1 if node is not a child of this
AbstractElement. |
String |
getName()
Returns the name of this element. |
TreeNode |
getParent()
Returns the parent TreeNode of this
AbstractElement or null if this element
has no parent. |
Element |
getParentElement()
Returns the parent element of this element. |
AttributeSet |
getResolveParent()
Returns the resolve parent of this element. |
abstract int |
getStartOffset()
Returns the start offset if this element inside the document model. |
boolean |
isDefined(Object attrName)
Returns true if an attribute with the specified name
is defined in this element, false otherwise. |
boolean |
isEqual(AttributeSet attrs)
Returns true if the specified AttributeSet
is equal to this element's AttributeSet, false
otherwise. |
abstract boolean |
isLeaf()
Returns true if this AbstractElement is a
leaf element, false otherwise. |
void |
removeAttribute(Object name)
Removes an attribute from this element. |
void |
removeAttributes(AttributeSet attrs)
Removes a set of attributes from this element. |
void |
removeAttributes(Enumeration<?> names)
Removes a set of attribute from this element. |
void |
setResolveParent(AttributeSet parent)
Sets the parent attribute set against which the element can resolve attributes that are not defined in itself. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractDocument.AbstractElement(Element p,
AttributeSet s)
AbstractElement with a
specified parent Element and AttributeSet.
p - the parent of this AbstractElements - the attributes to be assigned to this
AbstractElement| Method Detail |
|---|
public abstract Enumeration children()
Element as an
Enumeration of TreeNodes.
children in interface TreeNodeElement as an
Enumeration of TreeNodespublic abstract boolean getAllowsChildren()
true if this AbstractElement
allows children.
getAllowsChildren in interface TreeNodetrue if this AbstractElement
allows childrenpublic TreeNode getChildAt(int index)
AbstractElement at
index.
getChildAt in interface TreeNodeindex - the position in the child list of the child element to
be returned
AbstractElement at
indexpublic int getChildCount()
AbstractElement.
getChildCount in interface TreeNodeAbstractElementpublic int getIndex(TreeNode node)
TreeNode or
-1 if node is not a child of this
AbstractElement.
getIndex in interface TreeNodenode - the node for which the index is requested
TreeNode or
-1 if node is not a child of this
AbstractElementpublic TreeNode getParent()
TreeNode of this
AbstractElement or null if this element
has no parent.
getParent in interface TreeNodeTreeNode of this
AbstractElement or null if this
element has no parentpublic abstract boolean isLeaf()
true if this AbstractElement is a
leaf element, false otherwise.
isLeaf in interface ElementisLeaf in interface TreeNodetrue if this AbstractElement is a
leaf element, false otherwise
public void addAttribute(Object name,
Object value)
addAttribute in interface MutableAttributeSetname - the name of the attribute to be addedvalue - the value of the attribute to be addedpublic void addAttributes(AttributeSet attrs)
addAttributes in interface MutableAttributeSetattrs - the attributes to be added to this elementpublic void removeAttribute(Object name)
removeAttribute in interface MutableAttributeSetname - the name of the attribute to be removedpublic void removeAttributes(AttributeSet attrs)
removeAttributes in interface MutableAttributeSetattrs - the attributes to be removedpublic void removeAttributes(Enumeration<?> names)
removeAttributes in interface MutableAttributeSetnames - the names of the attributes to be removedpublic void setResolveParent(AttributeSet parent)
setResolveParent in interface MutableAttributeSetparent - the resolve parent to set
public boolean containsAttribute(Object name,
Object value)
true if this element contains the specified
attribute.
containsAttribute in interface AttributeSetname - the name of the attribute to checkvalue - the value of the attribute to check
true if this element contains the specified
attributepublic boolean containsAttributes(AttributeSet attrs)
true if this element contains all of the
specified attributes.
containsAttributes in interface AttributeSetattrs - the attributes to check
true if this element contains all of the
specified attributespublic AttributeSet copyAttributes()
copyAttributes in interface AttributeSetpublic Object getAttribute(Object key)
getAttribute in interface AttributeSetkey - the key of the requested attribute
key of null
if key is not found locally and cannot be resolved
in this element's resolve parentspublic int getAttributeCount()
getAttributeCount in interface AttributeSetpublic Enumeration<?> getAttributeNames()
getAttributeNames in interface AttributeSetpublic AttributeSet getResolveParent()
getResolveParent in interface AttributeSetsetResolveParent(AttributeSet)public boolean isDefined(Object attrName)
true if an attribute with the specified name
is defined in this element, false otherwise.
isDefined in interface AttributeSetattrName - the name of the requested attributes
true if an attribute with the specified name
is defined in this element, false otherwisepublic boolean isEqual(AttributeSet attrs)
true if the specified AttributeSet
is equal to this element's AttributeSet, false
otherwise.
isEqual in interface AttributeSetattrs - the attributes to compare this element to
true if the specified AttributeSet
is equal to this element's AttributeSet,
false otherwisepublic AttributeSet getAttributes()
getAttributes in interface Elementpublic Document getDocument()
Document to which this element belongs.
getDocument in interface ElementDocument to which this element belongspublic abstract Element getElement(int index)
index.
getElement in interface Elementindex - the index of the requested child element
public String getName()
getName in interface Elementpublic Element getParentElement()
getParentElement in interface Elementpublic abstract int getEndOffset()
getEndOffset in interface Elementpublic abstract int getElementCount()
getElementCount in interface Elementpublic abstract int getElementIndex(int offset)
getElementIndex in interface Elementoffset - the offset for which the responsible element is searched
public abstract int getStartOffset()
getStartOffset in interface Element
public void dump(PrintStream stream,
int indent)
stream - the stream to write toindent - the indentation level
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||