javax.swing.text
public class AbstractDocument.LeafElement extends AbstractDocument.AbstractElement
Element
that represents a leaf in the
document structure. This is used to actually store content.AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
NameAttribute, ResolveAttribute
Constructor and Description |
---|
AbstractDocument.LeafElement(Element parent,
AttributeSet attributes,
int start,
int end)
Creates a new
LeafElement . |
Modifier and Type | Method and Description |
---|---|
Enumeration |
children()
Returns
null since LeafElement s cannot have
children. |
boolean |
getAllowsChildren()
Returns
false since LeafElement s cannot have
children. |
Element |
getElement(int index)
Returns
null since LeafElement s cannot have
children. |
int |
getElementCount()
Returns
0 since LeafElement s cannot have
children. |
int |
getElementIndex(int offset)
Returns
-1 since LeafElement s cannot have
children. |
int |
getEndOffset()
Returns the end offset of this
Element inside the
document. |
String |
getName()
Returns the name of this
Element . |
int |
getStartOffset()
Returns the start offset of this
Element inside the
document. |
boolean |
isLeaf()
Returns
true . |
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, setResolveParent
public AbstractDocument.LeafElement(Element parent, AttributeSet attributes, int start, int end)
LeafElement
.parent
- the parent of this LeafElement
attributes
- the attributes to be setstart
- the start index of this element inside the document modelend
- the end index of this element inside the document modelpublic Enumeration children()
null
since LeafElement
s cannot have
children.children
in interface TreeNode
children
in class AbstractDocument.AbstractElement
null
since LeafElement
s cannot have
childrenpublic boolean getAllowsChildren()
false
since LeafElement
s cannot have
children.getAllowsChildren
in interface TreeNode
getAllowsChildren
in class AbstractDocument.AbstractElement
false
since LeafElement
s cannot have
childrenpublic Element getElement(int index)
null
since LeafElement
s cannot have
children.getElement
in interface Element
getElement
in class AbstractDocument.AbstractElement
index
- the index of the requested child elementnull
since LeafElement
s cannot have
childrenpublic int getElementCount()
0
since LeafElement
s cannot have
children.getElementCount
in interface Element
getElementCount
in class AbstractDocument.AbstractElement
0
since LeafElement
s cannot have
childrenpublic int getElementIndex(int offset)
-1
since LeafElement
s cannot have
children.getElementIndex
in interface Element
getElementIndex
in class AbstractDocument.AbstractElement
offset
- the offset for which the responsible element is searched-1
since LeafElement
s cannot have
childrenpublic int getEndOffset()
Element
inside the
document.getEndOffset
in interface Element
getEndOffset
in class AbstractDocument.AbstractElement
Element
inside the
documentpublic String getName()
Element
. This is
AbstractDocument.ContentElementName
in this case.getName
in interface Element
getName
in class AbstractDocument.AbstractElement
Element
public int getStartOffset()
Element
inside the
document.getStartOffset
in interface Element
getStartOffset
in class AbstractDocument.AbstractElement
Element
inside the
documentpublic boolean isLeaf()
true
.public String toString()
Element
.toString
in class Object
Element
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)