| Java Doc By Examples | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectjavax.swing.text.AbstractDocument.AbstractElementjavax.swing.text.AbstractDocument.BranchElementpublic class AbstractDocument.BranchElementextends AbstractDocument.AbstractElementjava.beans package.
Please see XMLEncoder.
Fields inherited from interface javax.swing.text.AttributeSet | |
NameAttribute, ResolveAttribute | |
Constructor Summary | |
| |
Method Summary | |
Enumeration<E> |
|
boolean |
|
Element |
|
int |
|
int |
|
int |
|
String |
|
int |
|
boolean |
|
Element |
|
void | |
String |
|
Methods inherited from class java.lang.Object | |
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait | |
public BranchElement(Element parent, AttributeSet a)
Constructs a composite element that initially contains no children.
- Parameters:
parent- The parent elementa- the attributes for the element
public Enumeration<E> children()
Returns the children of the receiver as anEnumeration.
- Overrides:
- children in interface AbstractDocument.AbstractElement
- Returns:
- the children of the receiver
public boolean getAllowsChildren()
Returns true if the receiver allows children.
- Specified by:
- getAllowsChildren in interface TreeNode
- Overrides:
- getAllowsChildren in interface AbstractDocument.AbstractElement
- Returns:
- true if the receiver allows children, otherwise false
public Element getElement(int index)
Gets a child element.
- Specified by:
- getElement in interface Element
- Overrides:
- getElement in interface AbstractDocument.AbstractElement
- Parameters:
index- the child index, >= 0 && <32getElementCount()
- Returns:
- the child element, null if none
public int getElementCount()
Gets the number of children for the element.
- Specified by:
- getElementCount in interface Element
- Overrides:
- getElementCount in interface AbstractDocument.AbstractElement
- Returns:
- the number of children >= 0
public int getElementIndex(int offset)
Gets the child element index closest to the given model offset.
- Specified by:
- getElementIndex in interface Element
- Overrides:
- getElementIndex in interface AbstractDocument.AbstractElement
- Parameters:
offset- the offset >= 0
- Returns:
- the element index >= 0
public int getEndOffset()
Gets the ending offset in the model for the element.
- Specified by:
- getEndOffset in interface Element
- Overrides:
- getEndOffset in interface AbstractDocument.AbstractElement
- Returns:
- the offset >= 0
- Throws:
NullPointerException- if this element has no children
public String getName()
Gets the element name.
- Overrides:
- getName in interface AbstractDocument.AbstractElement
- Returns:
- the element name
public int getStartOffset()
Gets the starting offset in the model for the element.
- Specified by:
- getStartOffset in interface Element
- Overrides:
- getStartOffset in interface AbstractDocument.AbstractElement
- Returns:
- the offset >= 0
public boolean isLeaf()
Checks whether the element is a leaf.
- Overrides:
- isLeaf in interface AbstractDocument.AbstractElement
- Returns:
- true if a leaf
public 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
public void replace(int offset, int length, Element[] elems)
Replaces content with a new set of elements.
- Parameters:
offset- the starting offset >= 0length- the length to replace >= 0elems- the new elements