javax.swing.text
Class AbstractDocument.BranchElement

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.text.AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement 
      extended by javax.swing.text.AbstractDocument.BranchElement
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet , Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element , MutableAttributeSet sample code for javax.swing.text.MutableAttributeSet definition code for javax.swing.text.MutableAttributeSet , TreeNode sample code for javax.swing.tree.TreeNode definition code for javax.swing.tree.TreeNode
Direct Known Subclasses:
DefaultStyledDocument.SectionElement sample code for javax.swing.text.DefaultStyledDocument.SectionElement definition code for javax.swing.text.DefaultStyledDocument.SectionElement , HTMLDocument.BlockElement sample code for javax.swing.text.html.HTMLDocument.BlockElement definition code for javax.swing.text.html.HTMLDocument.BlockElement
Enclosing class:
AbstractDocument sample code for javax.swing.text.AbstractDocument definition code for javax.swing.text.AbstractDocument

public class AbstractDocument.BranchElement
extends AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement

Implements a composite element that contains other elements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.swing.text.AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute sample code for javax.swing.text.AttributeSet.CharacterAttribute definition code for javax.swing.text.AttributeSet.CharacterAttribute , AttributeSet.ColorAttribute sample code for javax.swing.text.AttributeSet.ColorAttribute definition code for javax.swing.text.AttributeSet.ColorAttribute , AttributeSet.FontAttribute sample code for javax.swing.text.AttributeSet.FontAttribute definition code for javax.swing.text.AttributeSet.FontAttribute , AttributeSet.ParagraphAttribute sample code for javax.swing.text.AttributeSet.ParagraphAttribute definition code for javax.swing.text.AttributeSet.ParagraphAttribute
 
Field Summary
 
Fields inherited from interface javax.swing.text.AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet
NameAttribute sample code for javax.swing.text.AttributeSet.NameAttribute definition code for javax.swing.text.AttributeSet.NameAttribute , ResolveAttribute sample code for javax.swing.text.AttributeSet.ResolveAttribute definition code for javax.swing.text.AttributeSet.ResolveAttribute
 
Constructor Summary
AbstractDocument.BranchElement sample code for javax.swing.text.AbstractDocument.BranchElement.AbstractDocument.BranchElement(javax.swing.text.Element, javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.BranchElement.AbstractDocument.BranchElement(javax.swing.text.Element, javax.swing.text.AttributeSet) (Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  parent, AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
          Constructs a composite element that initially contains no children.
 
Method Summary
 Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration children sample code for javax.swing.text.AbstractDocument.BranchElement.children() definition code for javax.swing.text.AbstractDocument.BranchElement.children() ()
          Returns the children of the receiver as an Enumeration.
 boolean getAllowsChildren sample code for javax.swing.text.AbstractDocument.BranchElement.getAllowsChildren() definition code for javax.swing.text.AbstractDocument.BranchElement.getAllowsChildren() ()
          Returns true if the receiver allows children.
 Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element getElement sample code for javax.swing.text.AbstractDocument.BranchElement.getElement(int) definition code for javax.swing.text.AbstractDocument.BranchElement.getElement(int) (int index)
          Gets a child element.
 int getElementCount sample code for javax.swing.text.AbstractDocument.BranchElement.getElementCount() definition code for javax.swing.text.AbstractDocument.BranchElement.getElementCount() ()
          Gets the number of children for the element.
 int getElementIndex sample code for javax.swing.text.AbstractDocument.BranchElement.getElementIndex(int) definition code for javax.swing.text.AbstractDocument.BranchElement.getElementIndex(int) (int offset)
          Gets the child element index closest to the given model offset.
 int getEndOffset sample code for javax.swing.text.AbstractDocument.BranchElement.getEndOffset() definition code for javax.swing.text.AbstractDocument.BranchElement.getEndOffset() ()
          Gets the ending offset in the model for the element.
 String sample code for java.lang.String definition code for java.lang.String getName sample code for javax.swing.text.AbstractDocument.BranchElement.getName() definition code for javax.swing.text.AbstractDocument.BranchElement.getName() ()
          Gets the element name.
 int getStartOffset sample code for javax.swing.text.AbstractDocument.BranchElement.getStartOffset() definition code for javax.swing.text.AbstractDocument.BranchElement.getStartOffset() ()
          Gets the starting offset in the model for the element.
 boolean isLeaf sample code for javax.swing.text.AbstractDocument.BranchElement.isLeaf() definition code for javax.swing.text.AbstractDocument.BranchElement.isLeaf() ()
          Checks whether the element is a leaf.
 Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element positionToElement sample code for javax.swing.text.AbstractDocument.BranchElement.positionToElement(int) definition code for javax.swing.text.AbstractDocument.BranchElement.positionToElement(int) (int pos)
          Gets the child element that contains the given model position.
 void replace sample code for javax.swing.text.AbstractDocument.BranchElement.replace(int, int, javax.swing.text.Element[]) definition code for javax.swing.text.AbstractDocument.BranchElement.replace(int, int, javax.swing.text.Element[]) (int offset, int length, Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element [] elems)
          Replaces content with a new set of elements.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.swing.text.AbstractDocument.BranchElement.toString() definition code for javax.swing.text.AbstractDocument.BranchElement.toString() ()
          Converts the element to a string.
 
Methods inherited from class javax.swing.text.AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
addAttribute sample code for javax.swing.text.AbstractDocument.AbstractElement.addAttribute(java.lang.Object, java.lang.Object) definition code for javax.swing.text.AbstractDocument.AbstractElement.addAttribute(java.lang.Object, java.lang.Object) , addAttributes sample code for javax.swing.text.AbstractDocument.AbstractElement.addAttributes(javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AbstractElement.addAttributes(javax.swing.text.AttributeSet) , containsAttribute sample code for javax.swing.text.AbstractDocument.AbstractElement.containsAttribute(java.lang.Object, java.lang.Object) definition code for javax.swing.text.AbstractDocument.AbstractElement.containsAttribute(java.lang.Object, java.lang.Object) , containsAttributes sample code for javax.swing.text.AbstractDocument.AbstractElement.containsAttributes(javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AbstractElement.containsAttributes(javax.swing.text.AttributeSet) , copyAttributes sample code for javax.swing.text.AbstractDocument.AbstractElement.copyAttributes() definition code for javax.swing.text.AbstractDocument.AbstractElement.copyAttributes() , dump sample code for javax.swing.text.AbstractDocument.AbstractElement.dump(java.io.PrintStream, int) definition code for javax.swing.text.AbstractDocument.AbstractElement.dump(java.io.PrintStream, int) , getAttribute sample code for javax.swing.text.AbstractDocument.AbstractElement.getAttribute(java.lang.Object) definition code for javax.swing.text.AbstractDocument.AbstractElement.getAttribute(java.lang.Object) , getAttributeCount sample code for javax.swing.text.AbstractDocument.AbstractElement.getAttributeCount() definition code for javax.swing.text.AbstractDocument.AbstractElement.getAttributeCount() , getAttributeNames sample code for javax.swing.text.AbstractDocument.AbstractElement.getAttributeNames() definition code for javax.swing.text.AbstractDocument.AbstractElement.getAttributeNames() , getAttributes sample code for javax.swing.text.AbstractDocument.AbstractElement.getAttributes() definition code for javax.swing.text.AbstractDocument.AbstractElement.getAttributes() , getChildAt sample code for javax.swing.text.AbstractDocument.AbstractElement.getChildAt(int) definition code for javax.swing.text.AbstractDocument.AbstractElement.getChildAt(int) , getChildCount sample code for javax.swing.text.AbstractDocument.AbstractElement.getChildCount() definition code for javax.swing.text.AbstractDocument.AbstractElement.getChildCount() , getDocument sample code for javax.swing.text.AbstractDocument.AbstractElement.getDocument() definition code for javax.swing.text.AbstractDocument.AbstractElement.getDocument() , getIndex sample code for javax.swing.text.AbstractDocument.AbstractElement.getIndex(javax.swing.tree.TreeNode) definition code for javax.swing.text.AbstractDocument.AbstractElement.getIndex(javax.swing.tree.TreeNode) , getParent sample code for javax.swing.text.AbstractDocument.AbstractElement.getParent() definition code for javax.swing.text.AbstractDocument.AbstractElement.getParent() , getParentElement sample code for javax.swing.text.AbstractDocument.AbstractElement.getParentElement() definition code for javax.swing.text.AbstractDocument.AbstractElement.getParentElement() , getResolveParent sample code for javax.swing.text.AbstractDocument.AbstractElement.getResolveParent() definition code for javax.swing.text.AbstractDocument.AbstractElement.getResolveParent() , isDefined sample code for javax.swing.text.AbstractDocument.AbstractElement.isDefined(java.lang.Object) definition code for javax.swing.text.AbstractDocument.AbstractElement.isDefined(java.lang.Object) , isEqual sample code for javax.swing.text.AbstractDocument.AbstractElement.isEqual(javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AbstractElement.isEqual(javax.swing.text.AttributeSet) , removeAttribute sample code for javax.swing.text.AbstractDocument.AbstractElement.removeAttribute(java.lang.Object) definition code for javax.swing.text.AbstractDocument.AbstractElement.removeAttribute(java.lang.Object) , removeAttributes sample code for javax.swing.text.AbstractDocument.AbstractElement.removeAttributes(javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AbstractElement.removeAttributes(javax.swing.text.AttributeSet) , removeAttributes sample code for javax.swing.text.AbstractDocument.AbstractElement.removeAttributes(java.util.Enumeration) definition code for javax.swing.text.AbstractDocument.AbstractElement.removeAttributes(java.util.Enumeration) , setResolveParent sample code for javax.swing.text.AbstractDocument.AbstractElement.setResolveParent(javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.AbstractElement.setResolveParent(javax.swing.text.AttributeSet)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

AbstractDocument.BranchElement sample code for javax.swing.text.AbstractDocument.BranchElement(javax.swing.text.Element, javax.swing.text.AttributeSet) definition code for javax.swing.text.AbstractDocument.BranchElement(javax.swing.text.Element, javax.swing.text.AttributeSet)

public AbstractDocument.BranchElement(Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  parent,
                                      AttributeSet sample code for javax.swing.text.AttributeSet definition code for javax.swing.text.AttributeSet  a)
Constructs a composite element that initially contains no children.

Parameters:
parent - The parent element
a - the attributes for the element
Method Detail

positionToElement sample code for javax.swing.text.AbstractDocument.BranchElement.positionToElement(int) definition code for javax.swing.text.AbstractDocument.BranchElement.positionToElement(int)

public Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  positionToElement(int pos)
Gets the child element that contains the given model position.

Parameters:
pos - the position >= 0
Returns:
the element, null if none

replace sample code for javax.swing.text.AbstractDocument.BranchElement.replace(int, int, javax.swing.text.Element[]) definition code for javax.swing.text.AbstractDocument.BranchElement.replace(int, int, javax.swing.text.Element[])

public void replace(int offset,
                    int length,
                    Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element [] elems)
Replaces content with a new set of elements.

Parameters:
offset - the starting offset >= 0
length - the length to replace >= 0
elems - the new elements

toString sample code for javax.swing.text.AbstractDocument.BranchElement.toString() definition code for javax.swing.text.AbstractDocument.BranchElement.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Converts the element to a string.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the string

getName sample code for javax.swing.text.AbstractDocument.BranchElement.getName() definition code for javax.swing.text.AbstractDocument.BranchElement.getName()

public String sample code for java.lang.String definition code for java.lang.String  getName()
Gets the element name.

Specified by:
getName sample code for javax.swing.text.Element.getName() definition code for javax.swing.text.Element.getName() in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Overrides:
getName sample code for javax.swing.text.AbstractDocument.AbstractElement.getName() definition code for javax.swing.text.AbstractDocument.AbstractElement.getName() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
the element name

getStartOffset sample code for javax.swing.text.AbstractDocument.BranchElement.getStartOffset() definition code for javax.swing.text.AbstractDocument.BranchElement.getStartOffset()

public int getStartOffset()
Gets the starting offset in the model for the element.

Specified by:
getStartOffset sample code for javax.swing.text.Element.getStartOffset() definition code for javax.swing.text.Element.getStartOffset() in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Specified by:
getStartOffset sample code for javax.swing.text.AbstractDocument.AbstractElement.getStartOffset() definition code for javax.swing.text.AbstractDocument.AbstractElement.getStartOffset() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
the offset >= 0
See Also:
Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document , AbstractDocument sample code for javax.swing.text.AbstractDocument definition code for javax.swing.text.AbstractDocument

getEndOffset sample code for javax.swing.text.AbstractDocument.BranchElement.getEndOffset() definition code for javax.swing.text.AbstractDocument.BranchElement.getEndOffset()

public int getEndOffset()
Gets the ending offset in the model for the element.

Specified by:
getEndOffset sample code for javax.swing.text.Element.getEndOffset() definition code for javax.swing.text.Element.getEndOffset() in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Specified by:
getEndOffset sample code for javax.swing.text.AbstractDocument.AbstractElement.getEndOffset() definition code for javax.swing.text.AbstractDocument.AbstractElement.getEndOffset() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
the offset >= 0
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if this element has no children
See Also:
Document sample code for javax.swing.text.Document definition code for javax.swing.text.Document , AbstractDocument sample code for javax.swing.text.AbstractDocument definition code for javax.swing.text.AbstractDocument

getElement sample code for javax.swing.text.AbstractDocument.BranchElement.getElement(int) definition code for javax.swing.text.AbstractDocument.BranchElement.getElement(int)

public Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  getElement(int index)
Gets a child element.

Specified by:
getElement sample code for javax.swing.text.Element.getElement(int) definition code for javax.swing.text.Element.getElement(int) in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Specified by:
getElement sample code for javax.swing.text.AbstractDocument.AbstractElement.getElement(int) definition code for javax.swing.text.AbstractDocument.AbstractElement.getElement(int) in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Parameters:
index - the child index, >= 0 && < getElementCount()
Returns:
the child element, null if none

getElementCount sample code for javax.swing.text.AbstractDocument.BranchElement.getElementCount() definition code for javax.swing.text.AbstractDocument.BranchElement.getElementCount()

public int getElementCount()
Gets the number of children for the element.

Specified by:
getElementCount sample code for javax.swing.text.Element.getElementCount() definition code for javax.swing.text.Element.getElementCount() in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Specified by:
getElementCount sample code for javax.swing.text.AbstractDocument.AbstractElement.getElementCount() definition code for javax.swing.text.AbstractDocument.AbstractElement.getElementCount() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
the number of children >= 0

getElementIndex sample code for javax.swing.text.AbstractDocument.BranchElement.getElementIndex(int) definition code for javax.swing.text.AbstractDocument.BranchElement.getElementIndex(int)

public int getElementIndex(int offset)
Gets the child element index closest to the given model offset.

Specified by:
getElementIndex sample code for javax.swing.text.Element.getElementIndex(int) definition code for javax.swing.text.Element.getElementIndex(int) in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Specified by:
getElementIndex sample code for javax.swing.text.AbstractDocument.AbstractElement.getElementIndex(int) definition code for javax.swing.text.AbstractDocument.AbstractElement.getElementIndex(int) in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Parameters:
offset - the offset >= 0
Returns:
the element index >= 0

isLeaf sample code for javax.swing.text.AbstractDocument.BranchElement.isLeaf() definition code for javax.swing.text.AbstractDocument.BranchElement.isLeaf()

public boolean isLeaf()
Checks whether the element is a leaf.

Specified by:
isLeaf sample code for javax.swing.text.Element.isLeaf() definition code for javax.swing.text.Element.isLeaf() in interface Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element
Specified by:
isLeaf sample code for javax.swing.tree.TreeNode.isLeaf() definition code for javax.swing.tree.TreeNode.isLeaf() in interface TreeNode sample code for javax.swing.tree.TreeNode definition code for javax.swing.tree.TreeNode
Specified by:
isLeaf sample code for javax.swing.text.AbstractDocument.AbstractElement.isLeaf() definition code for javax.swing.text.AbstractDocument.AbstractElement.isLeaf() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
true if a leaf

getAllowsChildren sample code for javax.swing.text.AbstractDocument.BranchElement.getAllowsChildren() definition code for javax.swing.text.AbstractDocument.BranchElement.getAllowsChildren()

public boolean getAllowsChildren()
Returns true if the receiver allows children.

Specified by:
getAllowsChildren sample code for javax.swing.tree.TreeNode.getAllowsChildren() definition code for javax.swing.tree.TreeNode.getAllowsChildren() in interface TreeNode sample code for javax.swing.tree.TreeNode definition code for javax.swing.tree.TreeNode
Specified by:
getAllowsChildren sample code for javax.swing.text.AbstractDocument.AbstractElement.getAllowsChildren() definition code for javax.swing.text.AbstractDocument.AbstractElement.getAllowsChildren() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
true if the receiver allows children, otherwise false

children sample code for javax.swing.text.AbstractDocument.BranchElement.children() definition code for javax.swing.text.AbstractDocument.BranchElement.children()

public Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration  children()
Returns the children of the receiver as an Enumeration.

Specified by:
children sample code for javax.swing.tree.TreeNode.children() definition code for javax.swing.tree.TreeNode.children() in interface TreeNode sample code for javax.swing.tree.TreeNode definition code for javax.swing.tree.TreeNode
Specified by:
children sample code for javax.swing.text.AbstractDocument.AbstractElement.children() definition code for javax.swing.text.AbstractDocument.AbstractElement.children() in class AbstractDocument.AbstractElement sample code for javax.swing.text.AbstractDocument.AbstractElement definition code for javax.swing.text.AbstractDocument.AbstractElement
Returns:
the children of the receiver