javax.swing.text

Class AbstractDocument.LeafElement

public class AbstractDocument.LeafElement extends AbstractDocument.AbstractElement

An implementation of {@link Element} that represents a leaf in the document structure. This is used to actually store content.
Constructor Summary
LeafElement(Element parent, AttributeSet attributes, int start, int end)
Creates a new LeafElement.
Method Summary
Enumerationchildren()
Returns null since LeafElements cannot have children.
booleangetAllowsChildren()
Returns false since LeafElements cannot have children.
ElementgetElement(int index)
Returns null since LeafElements cannot have children.
intgetElementCount()
Returns 0 since LeafElements cannot have children.
intgetElementIndex(int offset)
Returns -1 since LeafElements cannot have children.
intgetEndOffset()
Returns the end offset of this Element inside the document.
StringgetName()
Returns the name of this Element.
intgetStartOffset()
Returns the start offset of this Element inside the document.
booleanisLeaf()
Returns true.
StringtoString()
Returns a string representation of this Element.

Constructor Detail

LeafElement

public 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.

Returns: null since LeafElements cannot have children

getAllowsChildren

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

Returns: false since LeafElements cannot have children

getElement

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

Returns: null since LeafElements cannot have children

getElementCount

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

Returns: 0 since LeafElements cannot have children

getElementIndex

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

Returns: -1 since LeafElements cannot have children

getEndOffset

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

Returns: the end offset of this Element inside the document

getName

public String getName()
Returns the name of this Element. This is {@link #ContentElementName} in this case.

Returns: the name of this Element

getStartOffset

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

Returns: the start offset of this Element inside the document

isLeaf

public boolean isLeaf()
Returns true.

Returns: true

toString

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

Returns: a string representation of this Element