|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.AbstractDocument.AbstractElement
javax.swing.text.AbstractDocument.BranchElement
public class AbstractDocument.BranchElement
An implementation of Element
to represent composite
Element
s that contain other Element
s.
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.BranchElement(Element parent,
AttributeSet attributes)
Creates a new BranchElement with the specified
parent and attributes. |
Method Summary | |
---|---|
Enumeration |
children()
Returns the children of this BranchElement . |
boolean |
getAllowsChildren()
Returns true since BranchElements allow
child elements. |
Element |
getElement(int index)
Returns the child element at the specified index . |
int |
getElementCount()
Returns the number of child elements of this element. |
int |
getElementIndex(int offset)
Returns the index of the child element that spans the specified offset in the document model. |
int |
getEndOffset()
Returns the offset inside the document model that is after the last character of this element. |
String |
getName()
Returns the name of this element. |
int |
getStartOffset()
Returns the start offset of this element inside the document model. |
boolean |
isLeaf()
Returns false since BranchElement are no
leafes. |
Element |
positionToElement(int position)
Returns the Element at the specified Document
offset. |
void |
replace(int offset,
int length,
Element[] elements)
Replaces a set of child elements with a new set of child elemens. |
String |
toString()
Returns a string representation of this element. |
Methods inherited from class javax.swing.text.AbstractDocument.AbstractElement |
---|
addAttribute, addAttributes, containsAttribute, containsAttributes, copyAttributes, dump, getAttribute, getAttributeCount, getAttributeNames, getAttributes, getChildAt, getChildCount, getDocument, getIndex, getParent, getParentElement, getResolveParent, isDefined, isEqual, removeAttribute, removeAttributes, removeAttributes, setResolveParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractDocument.BranchElement(Element parent, AttributeSet attributes)
BranchElement
with the specified
parent and attributes.
parent
- the parent element of this BranchElement
attributes
- the attributes to set on this
BranchElement
Method Detail |
---|
public Enumeration children()
BranchElement
.
children
in interface TreeNode
children
in class AbstractDocument.AbstractElement
BranchElement
public boolean getAllowsChildren()
true
since BranchElements
allow
child elements.
getAllowsChildren
in interface TreeNode
getAllowsChildren
in class AbstractDocument.AbstractElement
true
since BranchElements
allow
child elementspublic Element getElement(int index)
index
.
getElement
in interface Element
getElement
in class AbstractDocument.AbstractElement
index
- the index of the requested child element
public int getElementCount()
getElementCount
in interface Element
getElementCount
in class AbstractDocument.AbstractElement
public int getElementIndex(int offset)
getElementIndex
in interface Element
getElementIndex
in class AbstractDocument.AbstractElement
offset
- the offset for which the responsible element is searched
public int getEndOffset()
NullPointerException
.
getEndOffset
in interface Element
getEndOffset
in class AbstractDocument.AbstractElement
NullPointerException
- if this branch element has no childrenpublic String getName()
AbstractDocument.ParagraphElementName
in this case.
getName
in interface Element
getName
in class AbstractDocument.AbstractElement
public int getStartOffset()
NullPointerException
.
getStartOffset
in interface Element
getStartOffset
in class AbstractDocument.AbstractElement
NullPointerException
- if this branch element has no children and
no startOffset value has been cachedpublic boolean isLeaf()
false
since BranchElement
are no
leafes.
isLeaf
in interface Element
isLeaf
in interface TreeNode
isLeaf
in class AbstractDocument.AbstractElement
false
since BranchElement
are no
leafespublic Element positionToElement(int position)
Element
at the specified Document
offset.
Element
at the specified Document
offsetgetElementIndex(int)
public void replace(int offset, int length, Element[] elements)
offset
- the start index of the elements to be removedlength
- the number of elements to be removedelements
- the new elements to be insertedpublic String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |