javax.swing.text
Class AbstractDocument.BranchElement
- AbstractDocument
- AttributeSet, Element, MutableAttributeSet, Serializable, TreeNode
An implementation of
Element
to represent composite
Element
s that contain other
Element
s.
Enumeration<E> | children() - Returns the children of this
BranchElement .
|
boolean | getAllowsChildren() - Returns
true since BranchElements allow
child elements.
|
Element | getElement(int index) - Returns the child element at the specified
index .
|
int | getElementCount() - Returns the number of child elements of this element.
|
int | getElementIndex(int offset) - Returns the index of the child element that spans the specified
offset in the document model.
|
int | getEndOffset() - Returns the offset inside the document model that is after the last
character of this element.
|
String | getName() - Returns the name of this element.
|
int | getStartOffset() - Returns the start offset of this element inside the document model.
|
boolean | isLeaf() - Returns
false since BranchElement are no
leafes.
|
Element | positionToElement(int position) - Returns the
Element at the specified Document
offset.
|
void | replace(int offset, int length, Element[] elements) - Replaces a set of child elements with a new set of child elemens.
|
String | toString() - Returns a string representation of this element.
|
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 |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
BranchElement
public BranchElement(Element parent,
AttributeSet attributes)
Creates a new BranchElement
with the specified
parent and attributes.
parent
- the parent element of this BranchElement
attributes
- the attributes to set on this
BranchElement
getEndOffset
public int getEndOffset()
Returns the offset inside the document model that is after the last
character of this element.
This is the end offset of the last child element. If this element
has no children, this method throws a NullPointerException
.
- getEndOffset in interface Element
- getEndOffset in interface AbstractDocument.AbstractElement
- the offset inside the document model that is after the last
character of this element
positionToElement
public Element positionToElement(int position)
Returns the Element
at the specified Document
offset.
- the
Element
at the specified Document
offset
replace
public void replace(int offset,
int length,
Element[] elements)
Replaces a set of child elements with a new set of child elemens.
offset
- the start index of the elements to be removedlength
- the number of elements to be removedelements
- the new elements to be inserted
toString
public String toString()
Returns a string representation of this element.
- toString in interface Object
- 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.