javax.swing.text

Class AbstractDocument.LeafElement

Enclosing Class:
AbstractDocument
Implemented Interfaces:
AttributeSet, Element, MutableAttributeSet, Serializable, TreeNode
Known Direct Subclasses:
HTMLDocument.RunElement

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

Fields inherited from interface javax.swing.text.AttributeSet

NameAttribute, ResolveAttribute

Constructor Summary

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

Method Summary

Enumeration<E>
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, children, containsAttribute, containsAttributes, copyAttributes, dump, getAllowsChildren, getAttribute, getAttributeCount, getAttributeNames, getAttributes, getChildAt, getChildCount, getDocument, getElement, getElementCount, getElementIndex, getEndOffset, getIndex, getName, getParent, getParentElement, getResolveParent, getStartOffset, isDefined, isEqual, isLeaf, removeAttribute, removeAttributes, removeAttributes, setResolveParent

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

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 Details

children

public Enumeration<E> children()
Returns null since LeafElements cannot have children.
Overrides:
children in interface 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
Overrides:
getAllowsChildren in interface 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
Overrides:
getElement in interface AbstractDocument.AbstractElement
Returns:
null since LeafElements cannot have children

getElementCount

public int getElementCount()
Returns 0 since LeafElements cannot have children.
Specified by:
getElementCount in interface Element
Overrides:
getElementCount in interface 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
Overrides:
getElementIndex in interface AbstractDocument.AbstractElement
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
Overrides:
getEndOffset in interface 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.LeafElement in this case.
Specified by:
getName in interface Element
Overrides:
getName in interface 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
Overrides:
getStartOffset in interface AbstractDocument.AbstractElement
Returns:
the start offset of this Element inside the document

isLeaf

public boolean isLeaf()
Returns true.
Specified by:
isLeaf in interface Element
isLeaf in interface TreeNode
Overrides:
isLeaf in interface AbstractDocument.AbstractElement
Returns:
true

toString

public String toString()
Returns a string representation of this Element.
Overrides:
toString in interface Object
Returns:
a string representation of this Element

AbstractDocument.java -- Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.