javax.swing.text
Class AbstractDocument.LeafElement

java.lang.Object
  extended by javax.swing.text.AbstractDocument.AbstractElement
      extended by javax.swing.text.AbstractDocument.LeafElement
All Implemented Interfaces:
Serializable, AttributeSet, Element, MutableAttributeSet, TreeNode
Direct Known Subclasses:
HTMLDocument.RunElement
Enclosing class:
AbstractDocument

public class AbstractDocument.LeafElement
extends AbstractDocument.AbstractElement

An implementation of Element that represents a leaf in the document structure. This is used to actually store content.

See Also:
Serialized Form

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.LeafElement(Element parent, AttributeSet attributes, int start, int end)
          Creates a new LeafElement.
 
Method Summary
 Enumeration children()
          Returns null since LeafElements cannot have children.
 boolean getAllowsChildren()
          Returns false since LeafElements cannot have children.
 Element getElement(int index)
          Returns null since LeafElements cannot have children.
 int getElementCount()
          Returns 0 since LeafElements cannot have children.
 int getElementIndex(int offset)
          Returns -1 since LeafElements 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.
 
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

AbstractDocument.LeafElement

public AbstractDocument.LeafElement(Element parent,
                                    AttributeSet attributes,
                                    int start,
                                    int end)
Creates a new LeafElement.

Parameters:
parent - the parent of this LeafElement
attributes - the attributes to be set
start - the start index of this element inside the document model
end - the end index of this element inside the document model
Method Detail

children

public Enumeration children()
Returns null since LeafElements cannot have children.

Specified by:
children in interface TreeNode
Specified by:
children in class AbstractDocument.AbstractElement
Returns:
null since LeafElements cannot have children

getAllowsChildren

public boolean getAllowsChildren()
Returns false since LeafElements cannot have children.

Specified by:
getAllowsChildren in interface TreeNode
Specified by:
getAllowsChildren in class AbstractDocument.AbstractElement
Returns:
false since LeafElements cannot have children

getElement

public Element getElement(int index)
Returns null since LeafElements cannot have children.

Specified by:
getElement in interface Element
Specified by:
getElement in class AbstractDocument.AbstractElement
Parameters:
index - the index of the requested child element
Returns:
null since LeafElements cannot have children

getElementCount

public int getElementCount()
Returns 0 since LeafElements cannot have children.

Specified by:
getElementCount in interface Element
Specified by:
getElementCount in class AbstractDocument.AbstractElement
Returns:
0 since LeafElements cannot have children

getElementIndex

public int getElementIndex(int offset)
Returns -1 since LeafElements cannot have children.

Specified by:
getElementIndex in interface Element
Specified by:
getElementIndex in class AbstractDocument.AbstractElement
Parameters:
offset - the offset for which the responsible element is searched
Returns:
-1 since LeafElements cannot have children

getEndOffset

public int getEndOffset()
Returns the end offset of this Element inside the document.

Specified by:
getEndOffset in interface Element
Specified by:
getEndOffset in class AbstractDocument.AbstractElement
Returns:
the end offset of this Element inside the document

getName

public String getName()
Returns the name of this Element. This is AbstractDocument.ContentElementName in this case.

Specified by:
getName in interface Element
Overrides:
getName in class AbstractDocument.AbstractElement
Returns:
the name of this Element

getStartOffset

public int getStartOffset()
Returns the start offset of this Element inside the document.

Specified by:
getStartOffset in interface Element
Specified by:
getStartOffset in class AbstractDocument.AbstractElement
Returns:
the start offset of this Element inside the document

isLeaf

public boolean isLeaf()
Returns true.

Specified by:
isLeaf in interface Element
Specified by:
isLeaf in interface TreeNode
Specified by:
isLeaf in class AbstractDocument.AbstractElement
Returns:
true

toString

public String toString()
Returns a string representation of this Element.

Overrides:
toString in class Object
Returns:
a string representation of this Element
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)