javax.swing.text
Class AbstractDocument.AbstractElement
- AbstractDocument
- AttributeSet, Element, MutableAttributeSet, Serializable, TreeNode
An abstract base implementation of the
Element
interface.
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
AbstractElement
public AbstractElement(Element p,
AttributeSet s)
Creates a new instance of AbstractElement
with a
specified parent Element
and AttributeSet
.
p
- the parent of this AbstractElement
s
- the attributes to be assigned to this
AbstractElement
containsAttribute
public boolean containsAttribute(Object name,
Object value)
Returns true
if this element contains the specified
attribute.
- containsAttribute in interface AttributeSet
name
- the name of the attribute to checkvalue
- the value of the attribute to check
true
if this element contains the specified
attribute
dump
public void dump(PrintStream stream,
int indent)
Prints diagnostic output to the specified stream.
stream
- the stream to write toindent
- the indentation level
getAttribute
public Object getAttribute(Object key)
Returns the attribute value with the specified key. If this attribute
is not defined in this element and this element has a resolving
parent, the search goes upward to the resolve parent chain.
- getAttribute in interface AttributeSet
key
- the key of the requested attribute
- the attribute value for
key
of null
if key
is not found locally and cannot be resolved
in this element's resolve parents
getChildAt
public TreeNode getChildAt(int index)
Returns the child of this AbstractElement
at
index
.
- getChildAt in interface TreeNode
index
- the position in the child list of the child element to
be returned
- the child of this
AbstractElement
at
index
getChildCount
public int getChildCount()
Returns the number of children of this AbstractElement
.
- getChildCount in interface TreeNode
- the number of children of this
AbstractElement
getElement
public abstract Element getElement(int index)
Returns the child element at the specified index
.
- getElement in interface Element
index
- the index of the requested child element
getElementCount
public abstract int getElementCount()
Returns the number of child elements of this element.
- getElementCount in interface Element
- the number of child elements of this element
getElementIndex
public abstract int getElementIndex(int offset)
Returns the index of the child element that spans the specified
offset in the document model.
- getElementIndex in interface Element
offset
- the offset for which the responsible element is searched
- the index of the child element that spans the specified
offset in the document model
getEndOffset
public abstract int getEndOffset()
Returns the offset inside the document model that is after the last
character of this element.
- getEndOffset in interface Element
- the offset inside the document model that is after the last
character of this element
getIndex
public int getIndex(TreeNode node)
Returns the index of a given child TreeNode
or
-1
if node
is not a child of this
AbstractElement
.
- getIndex in interface TreeNode
node
- the node for which the index is requested
- the index of a given child
TreeNode
or
-1
if node
is not a child of this
AbstractElement
getParent
public TreeNode getParent()
Returns the parent TreeNode
of this
AbstractElement
or null
if this element
has no parent.
- getParent in interface TreeNode
- the parent
TreeNode
of this
AbstractElement
or null
if this
element has no parent
getResolveParent
public AttributeSet getResolveParent()
Returns the resolve parent of this element.
This is taken from the AttributeSet, but if this is null,
this method instead returns the Element's parent's
AttributeSet
- getResolveParent in interface AttributeSet
- the resolve parent of this element
getStartOffset
public abstract int getStartOffset()
Returns the start offset if this element inside the document model.
- getStartOffset in interface Element
- the start offset if this element inside the document model
isDefined
public boolean isDefined(Object attrName)
Returns true
if an attribute with the specified name
is defined in this element, false
otherwise.
- isDefined in interface AttributeSet
attrName
- the name of the requested attributes
true
if an attribute with the specified name
is defined in this element, false
otherwise
isEqual
public boolean isEqual(AttributeSet attrs)
Returns true
if the specified AttributeSet
is equal to this element's AttributeSet
, false
otherwise.
- isEqual in interface AttributeSet
attrs
- the attributes to compare this element to
true
if the specified AttributeSet
is equal to this element's AttributeSet
,
false
otherwise
isLeaf
public abstract boolean isLeaf()
Returns true
if this AbstractElement
is a
leaf element, false
otherwise.
- isLeaf in interface Element
- isLeaf in interface TreeNode
true
if this AbstractElement
is a
leaf element, false
otherwise
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.