public class AbstractDocument.BranchElement extends AbstractDocument.AbstractElement
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttributeNameAttribute, ResolveAttribute| Constructor and Description |
|---|
AbstractDocument.BranchElement(Element parent,
AttributeSet attributes)
Creates a new
BranchElement with the specified
parent and attributes. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
addAttribute, addAttributes, containsAttribute, containsAttributes, copyAttributes, dump, getAttribute, getAttributeCount, getAttributeNames, getAttributes, getChildAt, getChildCount, getDocument, getIndex, getParent, getParentElement, getResolveParent, isDefined, isEqual, removeAttribute, removeAttributes, removeAttributes, setResolveParentpublic AbstractDocument.BranchElement(Element parent, AttributeSet attributes)
BranchElement with the specified
parent and attributes.parent - the parent element of this BranchElementattributes - the attributes to set on this
BranchElementpublic Enumeration children()
BranchElement.children in interface TreeNodechildren in class AbstractDocument.AbstractElementBranchElementpublic boolean getAllowsChildren()
true since BranchElements allow
child elements.getAllowsChildren in interface TreeNodegetAllowsChildren in class AbstractDocument.AbstractElementtrue since BranchElements allow
child elementspublic Element getElement(int index)
index.getElement in interface ElementgetElement in class AbstractDocument.AbstractElementindex - the index of the requested child elementpublic int getElementCount()
getElementCount in interface ElementgetElementCount in class AbstractDocument.AbstractElementpublic int getElementIndex(int offset)
getElementIndex in interface ElementgetElementIndex in class AbstractDocument.AbstractElementoffset - the offset for which the responsible element is searchedpublic int getEndOffset()
NullPointerException.getEndOffset in interface ElementgetEndOffset in class AbstractDocument.AbstractElementNullPointerException - if this branch element has no childrenpublic String getName()
AbstractDocument.ParagraphElementName
in this case.getName in interface ElementgetName in class AbstractDocument.AbstractElementpublic int getStartOffset()
NullPointerException.getStartOffset in interface ElementgetStartOffset in class AbstractDocument.AbstractElementNullPointerException - if this branch element has no children and
no startOffset value has been cachedpublic boolean isLeaf()
false since BranchElement are no
leafes.public 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 ObjectObject.getClass(),
Object.hashCode(),
Class.getName(),
Integer.toHexString(int)