- 
- All Known Implementing Classes:
- AbstractDocument.AbstractElement,- AbstractDocument.BranchElement,- AbstractDocument.LeafElement,- DefaultStyledDocument.SectionElement,- HTMLDocument.BlockElement,- HTMLDocument.RunElement
 
 public interface ElementInterface to describe a structural piece of a document. It is intended to capture the spirit of an SGML element.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description AttributeSetgetAttributes()Fetches the collection of attributes this element contains.DocumentgetDocument()Fetches the document associated with this element.ElementgetElement(int index)Fetches the child element at the given index.intgetElementCount()Gets the number of child elements contained by this element.intgetElementIndex(int offset)Gets the child element index closest to the given offset.intgetEndOffset()Fetches the offset from the beginning of the document that this element ends at.StringgetName()Fetches the name of the element.ElementgetParentElement()Fetches the parent element.intgetStartOffset()Fetches the offset from the beginning of the document that this element begins at.booleanisLeaf()Is this element a leaf element?
 
- 
- 
- 
Method Detail- 
getDocumentDocument getDocument() Fetches the document associated with this element.- Returns:
- the document
 
 - 
getParentElementElement getParentElement() Fetches the parent element. If the element is a root level element returnsnull.- Returns:
- the parent element
 
 - 
getNameString getName() Fetches the name of the element. If the element is used to represent some type of structure, this would be the type name.- Returns:
- the element name
 
 - 
getAttributesAttributeSet getAttributes() Fetches the collection of attributes this element contains.- Returns:
- the attributes for the element
 
 - 
getStartOffsetint getStartOffset() Fetches the offset from the beginning of the document that this element begins at. If this element has children, this will be the offset of the first child. As a document position, there is an implied forward bias.- Returns:
- the starting offset >= 0 and < getEndOffset();
- See Also:
- Document,- AbstractDocument
 
 - 
getEndOffsetint getEndOffset() Fetches the offset from the beginning of the document that this element ends at. If this element has children, this will be the end offset of the last child. As a document position, there is an implied backward bias.All the default Documentimplementations descend fromAbstractDocument.AbstractDocumentmodels an implied break at the end of the document. As a result of this, it is possible for this to return a value greater than the length of the document.- Returns:
- the ending offset > getStartOffset() and <= getDocument().getLength() + 1
- See Also:
- Document,- AbstractDocument
 
 - 
getElementIndexint getElementIndex(int offset) Gets the child element index closest to the given offset. The offset is specified relative to the beginning of the document. Returns-1if theElementis a leaf, otherwise returns the index of theElementthat best represents the given location. Returns0if the location is less than the start offset. ReturnsgetElementCount() - 1if the location is greater than or equal to the end offset.- Parameters:
- offset- the specified offset >= 0
- Returns:
- the element index >= 0
 
 - 
getElementCountint getElementCount() Gets the number of child elements contained by this element. If this element is a leaf, a count of zero is returned.- Returns:
- the number of child elements >= 0
 
 - 
getElementElement getElement(int index) Fetches the child element at the given index.- Parameters:
- index- the specified index >= 0
- Returns:
- the child element
 
 - 
isLeafboolean isLeaf() Is this element a leaf element? An element that may have children, even if it currently has no children, would returnfalse.- Returns:
- true if a leaf element else false
 
 
- 
 
-