Please see the API documentation for the interface classes and use the interfaces in your client programs.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv Node | |
| pack-priv boolean | |
| pack-priv DocumentImpl | |
| pack-priv Node | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv Node | |
| pack-priv boolean | |
| pack-priv Node | fRemoveChild
This function is called within Range instead of Node.removeChild, so that the range can remember that it is actively removing this child. |
| pack-priv Node | |
| pack-priv Node | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public DocumentFragment | cloneContents()
Implements org. Duplicates the contents of a Range |
| public Range | cloneRange()
Implements org. Produces a new Range whose boundary-points are equal to the boundary-points of the Range. |
| public void | collapse(boolean toStart)
Implements org. Collapse a Range onto one of its boundary-points |
| public short | compareBoundaryPoints(short how, Range sourceRange)
Implements org. Compare the boundary-points of two Ranges in a document. |
| public void | deleteContents()
Implements org. Removes the contents of a Range from the containing document or document fragment without returning a reference to the removed content. |
| pack-priv void | deleteData(CharacterData node, int offset, int count)
This function inserts text into a Node and invokes a method to fix-up all other Ranges. |
| public void | detach()
Implements org. Called to indicate that the Range is no longer in use and that the implementation may relinquish any resources associated with this Range. |
| public DocumentFragment | extractContents()
Implements org. Moves the contents of a Range from the containing document or document fragment to a new DocumentFragment. |
| public boolean | |
| public Node | getCommonAncestorContainer()
Implements org. The deepest common ancestor container of the Range's two boundary-points. |
| public Node | getEndContainer()
Implements org. Node within which the Range ends |
| public int | getEndOffset()
Implements org. Offset within the ending node of the Range. |
| private Node | getRootContainer(Node node)
Given a node, calculate what the Range's root container for that node would be. |
| private Node | Returns: Returns either a child node of the container or the container itself.A container node container, int An offset within the container for which a selected node should
be computed. If the offset is less than zero, or if the offset
is greater than the number of children, the container is returned. offset)Utility method to retrieve a child node by index. |
| public Node | getStartContainer()
Implements org. Node within which the Range begins |
| public int | getStartOffset()
Implements org. Offset within the starting node of the Range. |
| private boolean | hasLegalRootContainer(Node node)
Finds the root container for the given node and determines if that root container is legal with respect to the DOM 2 specification. |
| pack-priv int | |
| pack-priv void | insertData(CharacterData node, int index, String insert)
This function inserts text into a Node and invokes a method to fix-up all other Ranges. |
| public void | |
| public void | insertNode(Node newNode)
Implements org. Inserts a node into the Document or DocumentFragment at the start of the Range. |
| pack-priv boolean | |
| private boolean | |
| private boolean | isLegalContainer(Node node)
Returns true IFF the given node can serve as a container for a range's boundary points. |
| pack-priv Node | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | receiveSplitData(Node node, Node newNode, int offset)
Fix up this Range if another Range has split a Text Node into 2 Nodes. |
| pack-priv Node | |
| pack-priv void | removeNode(Node node)
This function must be called by the DOM _BEFORE_ a node is deleted, because at that time it is connected in the DOM tree, which we depend on. |
| public void | selectNode(Node refNode)
Implements org. Select a node and its contents |
| public void | selectNodeContents(Node refNode)
Implements org. Select the contents within a node |
| public void | setEnd(Node refNode, int offset)
Implements org. Sets the attributes describing the end of a Range. |
| public void | setEndAfter(Node refNode)
Implements org. Sets the end of a Range to be after a node |
| public void | setEndBefore(Node refNode)
Implements org. Sets the end position to be before a node. |
| public void | setStart(Node refNode, int offset)
Implements org. Sets the attributes describing the start of the Range. |
| public void | setStartAfter(Node refNode)
Implements org. Sets the start position to be after a node |
| public void | setStartBefore(Node refNode)
Implements org. Sets the start position to be before a node |
| pack-priv void | signalSplitData(Node node, Node newNode, int offset)
Signal other Ranges to update their start/end containers/offsets. |
| public void | surroundContents(Node newParent)
Implements org. Reparents the contents of the Range to the given node and inserts the node at the position of the start of the Range. |
| public String | toString()
Overrides java. Implements org. Returns the contents of a Range as a string. |
| private DocumentFragment | Returns: Returns a document fragment containing any copied or extracted nodes. If thehow
parameter was DELETE_CONTENTS, the
return value is null.Given a common ancestor of the start and end containers,
this parameter is the ancestor (or self) of the start
container that is a direct child of the common ancestor. startAncestor, Node Given a common ancestor of the start and end containers,
this parameter is the ancestor (or self) of the end
container that is a direct child of the common ancestor. endAncestor, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Visits the nodes selected by this range when we know a-priori that the start and end containers are not the same, and we also know that neither the start nor end container is an ancestor of the other. |
| private DocumentFragment | Returns: Returns a document fragment containing any copied or extracted nodes. If thehow
parameter was DELETE_CONTENTS, the
return value is null.The ancestor of the start container that is a direct
child of the end container. startAncestor, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Visits the nodes selected by this range when we know a-priori that the start and end containers are not the same, but the end container is an ancestor of the start container. |
| private DocumentFragment | Returns: Returns a document fragment containing any copied or extracted nodes. If thehow
parameter was DELETE_CONTENTS, the
return value is null.The ancestor of the end container that is a direct child
of the start container. endAncestor, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Visits the nodes selected by this range when we know a-priori that the start and end containers are not the same, but the start container is an ancestor of the end container. |
| private DocumentFragment | Returns: Returns a document fragment containing any copied or extracted nodes. If thehow
parameter was DELETE_CONTENTS, the
return value is null.Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
This is the master routine invoked to visit the nodes selected by this range. |
| private Node | Returns: Returns a node that is the result of visiting the node. If the traversal operation isDELETE_CONTENTS the return value is null.The node to be traversed. n, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Utility method for traversing a single node when we know a-priori that the node if fully selected. |
| private Node | Returns: Returns a node that is the result of visiting nodes. If the traversal operation isDELETE_CONTENTS the return value is null.The node that is the root of the "left boundary" subtree. root, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Traverses the "left boundary" of this range and
operates on each "boundary node" according to the
|
| private Node | Returns: Returns a node that is the result of visiting the node. If the traversal operation isDELETE_CONTENTS the return value is null.The node to be traversed. n, boolean Set to true if the node is fully selected. Should be
false otherwise.
Note that although the DOM 2 specification says that a
text node that is boththe start and end container is not
selected, we treat it here as if it were partially
selected. isFullySelected, boolean Is true if we are traversing the node as part of navigating
the "left boundary" of the range. If this value is false,
it implies we are navigating the "right boundary" of the
range. isLeft, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Utility method for traversing a single node. |
| private Node | Returns: Returns a node that is the result of visiting the node. If the traversal operation isDELETE_CONTENTS the return value is null.The node to be traversed. n, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Utility method for traversing a single node when we know a-priori that the node if partially selected and is not a text node. |
| private Node | Returns: Returns a node that is the result of visiting nodes. If the traversal operation isDELETE_CONTENTS the return value is null.The node that is the root of the "right boundary" subtree. root, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Traverses the "right boundary" of this range and
operates on each "boundary node" according to the
|
| private DocumentFragment | Returns: Returns a document fragment containing any copied or extracted nodes. If thehow
parameter was DELETE_CONTENTS, the
return value is null.Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Visits the nodes selected by this range when we know a-priori that the start and end containers are the same. |
| private Node | Returns: Returns a node that is the result of visiting the node. If the traversal operation isDELETE_CONTENTS the return value is null.The node to be traversed. n, boolean Is true if we are traversing the node as part of navigating
the "left boundary" of the range. If this value is false,
it implies we are navigating the "right boundary" of the
range. isLeft, int Specifies what type of traversal is being
requested (extract, clone, or delete).
Legal values for this argument are:
how)
Utility method for traversing a text node that we know a-priori to be on a left or right boundary of the range. |
| CLONE_CONTENTS | back to summary |
|---|---|
| pack-priv static final int CLONE_CONTENTS | |
| DELETE_CONTENTS | back to summary |
|---|---|
| pack-priv static final int DELETE_CONTENTS | |
| EXTRACT_CONTENTS | back to summary |
|---|---|
| pack-priv static final int EXTRACT_CONTENTS | |
| fDeleteNode | back to summary |
|---|---|
| pack-priv Node fDeleteNode | |
| fDetach | back to summary |
|---|---|
| pack-priv boolean fDetach | |
| fDocument | back to summary |
|---|---|
| pack-priv DocumentImpl fDocument | |
| fEndContainer | back to summary |
|---|---|
| pack-priv Node fEndContainer | |
| fEndOffset | back to summary |
|---|---|
| pack-priv int fEndOffset | |
| fInsertedFromRange | back to summary |
|---|---|
| pack-priv boolean fInsertedFromRange | |
| fInsertNode | back to summary |
|---|---|
| pack-priv Node fInsertNode | |
| fIsCollapsed | back to summary |
|---|---|
| pack-priv boolean fIsCollapsed | |
| fRemoveChild | back to summary |
|---|---|
| pack-priv Node fRemoveChild This function is called within Range instead of Node.removeChild, so that the range can remember that it is actively removing this child. | |
| fSplitNode | back to summary |
|---|---|
| pack-priv Node fSplitNode | |
| fStartContainer | back to summary |
|---|---|
| pack-priv Node fStartContainer | |
| fStartOffset | back to summary |
|---|---|
| pack-priv int fStartOffset | |
| RangeImpl | back to summary |
|---|---|
| public RangeImpl(DocumentImpl document) The constructor. Clients must use DocumentRange.createRange(), because it registers the Range with the document, so it can be fixed-up. | |
| checkIndex | back to summary |
|---|---|
| pack-priv void checkIndex(Node refNode, int offset) throws DOMException | |
| cloneContents | back to summary |
|---|---|
| public DocumentFragment cloneContents() throws DOMException Implements org. Doc from org. Duplicates the contents of a Range
| |
| cloneRange | back to summary |
|---|---|
| public Range cloneRange() Implements org. Doc from org. Produces a new Range whose boundary-points are equal to the boundary-points of the Range. | |
| collapse | back to summary |
|---|---|
| public void collapse(boolean toStart) Implements org. Doc from org. Collapse a Range onto one of its boundary-points | |
| compareBoundaryPoints | back to summary |
|---|---|
| public short compareBoundaryPoints(short how, Range sourceRange) throws DOMException Implements org. Doc from org. Compare the boundary-points of two Ranges in a document.
| |
| deleteContents | back to summary |
|---|---|
| public void deleteContents() throws DOMException Implements org. Doc from org. Removes the contents of a Range from the containing document or document fragment without returning a reference to the removed content.
| |
| deleteData | back to summary |
|---|---|
| pack-priv void deleteData(CharacterData node, int offset, int count) This function inserts text into a Node and invokes a method to fix-up all other Ranges. | |
| detach | back to summary |
|---|---|
| public void detach() Implements org. Doc from org. Called to indicate that the Range is no longer in use and that the
implementation may relinquish any resources associated with this
Range. Subsequent calls to any methods or attribute getters on this
Range will result in a | |
| extractContents | back to summary |
|---|---|
| public DocumentFragment extractContents() throws DOMException Implements org. Doc from org. Moves the contents of a Range from the containing document or document fragment to a new DocumentFragment.
| |
| getCollapsed | back to summary |
|---|---|
| public boolean getCollapsed() Implements org. Doc from org. TRUE if the Range is collapsed | |
| getCommonAncestorContainer | back to summary |
|---|---|
| public Node getCommonAncestorContainer() Implements org. Doc from org. The deepest common ancestor container of the Range's two boundary-points. | |
| getEndContainer | back to summary |
|---|---|
| public Node getEndContainer() Implements org. Doc from org. Node within which the Range ends | |
| getEndOffset | back to summary |
|---|---|
| public int getEndOffset() Implements org. Doc from org. Offset within the ending node of the Range. | |
| getRootContainer | back to summary |
|---|---|
| private Node getRootContainer(Node node) Given a node, calculate what the Range's root container for that node would be. | |
| getSelectedNode | back to summary |
|---|---|
| private Node getSelectedNode(Node container, int offset) Utility method to retrieve a child node by index. This method assumes the caller is trying to find out which node is selected by the given index. Note that if the index is greater than the number of children, this implies that the first node selected is the parent node itself.
| |
| getStartContainer | back to summary |
|---|---|
| public Node getStartContainer() Implements org. Doc from org. Node within which the Range begins | |
| getStartOffset | back to summary |
|---|---|
| public int getStartOffset() Implements org. Doc from org. Offset within the starting node of the Range. | |
| hasLegalRootContainer | back to summary |
|---|---|
| private boolean hasLegalRootContainer(Node node) Finds the root container for the given node and determines if that root container is legal with respect to the DOM 2 specification. At present, that means the root container must be either an attribute, a document, or a document fragment. | |
| indexOf | back to summary |
|---|---|
| pack-priv int indexOf(Node child, Node parent) what is the index of the child in the parent | |
| insertData | back to summary |
|---|---|
| pack-priv void insertData(CharacterData node, int index, String insert) This function inserts text into a Node and invokes a method to fix-up all other Ranges. | |
| insertedNodeFromDOM | back to summary |
|---|---|
| public void insertedNodeFromDOM(Node node) This function is called from the DOM. This node has already been inserted into the DOM. Fix-up any offsets. | |
| insertNode | back to summary |
|---|---|
| public void insertNode(Node newNode) throws DOMException, RangeException Implements org. Doc from org. Inserts a node into the Document or DocumentFragment at the start of the Range. If the container is a Text node, this will be split at the start of the Range (as if the Text node's splitText method was performed at the insertion point) and the insertion will occur between the two resulting Text nodes. Adjacent Text nodes will not be automatically merged. If the node to be inserted is a DocumentFragment node, the children will be inserted rather than the DocumentFragment node itself.
| |
| isAncestorOf | back to summary |
|---|---|
| pack-priv boolean isAncestorOf(Node a, Node b) is a an ancestor of b ? | |
| isLegalContainedNode | back to summary |
|---|---|
| private boolean isLegalContainedNode(Node node) Returns true IFF the given node can be contained by a range. | |
| isLegalContainer | back to summary |
|---|---|
| private boolean isLegalContainer(Node node) Returns true IFF the given node can serve as a container for a range's boundary points. | |
| nextNode | back to summary |
|---|---|
| pack-priv Node nextNode(Node node, boolean visitChildren) | |
| receiveDeletedText | back to summary |
|---|---|
| pack-priv void receiveDeletedText(Node node, int offset, int count) This function is called from DOM. The text has already beeen inserted. Fix-up any offsets. | |
| receiveInsertedText | back to summary |
|---|---|
| pack-priv void receiveInsertedText(Node node, int index, int len) This function is called from DOM. The text has already beeen inserted. Fix-up any offsets. | |
| receiveReplacedText | back to summary |
|---|---|
| pack-priv void receiveReplacedText(Node node) This function is called from DOM. The text has already beeen replaced. Fix-up any offsets. | |
| receiveSplitData | back to summary |
|---|---|
| pack-priv void receiveSplitData(Node node, Node newNode, int offset) Fix up this Range if another Range has split a Text Node into 2 Nodes. | |
| removeChild | back to summary |
|---|---|
| pack-priv Node removeChild(Node parent, Node child) | |
| removeNode | back to summary |
|---|---|
| pack-priv void removeNode(Node node) This function must be called by the DOM _BEFORE_ a node is deleted, because at that time it is connected in the DOM tree, which we depend on. | |
| selectNode | back to summary |
|---|---|
| public void selectNode(Node refNode) throws RangeException Implements org. Doc from org. Select a node and its contents
| |
| selectNodeContents | back to summary |
|---|---|
| public void selectNodeContents(Node refNode) throws RangeException Implements org. Doc from org. Select the contents within a node
| |
| setEnd | back to summary |
|---|---|
| public void setEnd(Node refNode, int offset) throws RangeException, DOMException Implements org. Doc from org. Sets the attributes describing the end of a Range.
| |
| setEndAfter | back to summary |
|---|---|
| public void setEndAfter(Node refNode) throws RangeException Implements org. Doc from org. Sets the end of a Range to be after a node
| |
| setEndBefore | back to summary |
|---|---|
| public void setEndBefore(Node refNode) throws RangeException Implements org. Doc from org. Sets the end position to be before a node.
| |
| setStart | back to summary |
|---|---|
| public void setStart(Node refNode, int offset) throws RangeException, DOMException Implements org. Doc from org. Sets the attributes describing the start of the Range.
| |
| setStartAfter | back to summary |
|---|---|
| public void setStartAfter(Node refNode) throws RangeException Implements org. Doc from org. Sets the start position to be after a node
| |
| setStartBefore | back to summary |
|---|---|
| public void setStartBefore(Node refNode) throws RangeException Implements org. Doc from org. Sets the start position to be before a node
| |
| signalSplitData | back to summary |
|---|---|
| pack-priv void signalSplitData(Node node, Node newNode, int offset) Signal other Ranges to update their start/end containers/offsets. The data has already been split into the two Nodes. | |
| surroundContents | back to summary |
|---|---|
| public void surroundContents(Node newParent) throws DOMException, RangeException Implements org. Doc from org. Reparents the contents of the Range to the given node and inserts the node at the position of the start of the Range.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements org. Doc from org. Returns the contents of a Range as a string. This string contains only the data characters, not any markup. | |
| traverseCommonAncestors | back to summary |
|---|---|
| private DocumentFragment traverseCommonAncestors(Node startAncestor, Node endAncestor, int how) Visits the nodes selected by this range when we know
a-priori that the start and end containers are not
the same, and we also know that neither the start
nor end container is an ancestor of the other.
This method is invoked by
the generic
| |
| traverseCommonEndContainer | back to summary |
|---|---|
| private DocumentFragment traverseCommonEndContainer(Node startAncestor, int how) Visits the nodes selected by this range when we know
a-priori that the start and end containers are not the
same, but the end container is an ancestor of the
start container. This method is invoked by the generic
| |
| traverseCommonStartContainer | back to summary |
|---|---|
| private DocumentFragment traverseCommonStartContainer(Node endAncestor, int how) Visits the nodes selected by this range when we know
a-priori that the start and end containers are not the
same, but the start container is an ancestor of the
end container. This method is invoked by the generic
| |
| traverseContents | back to summary |
|---|---|
| private DocumentFragment traverseContents(int how) throws DOMException This is the master routine invoked to visit the nodes
selected by this range. For each such node, different
actions are taken depending on the value of the
| |
| traverseFullySelected | back to summary |
|---|---|
| private Node traverseFullySelected(Node n, int how) Utility method for traversing a single node when we know a-priori that the node if fully selected.
| |
| traverseLeftBoundary | back to summary |
|---|---|
| private Node traverseLeftBoundary(Node root, int how) Traverses the "left boundary" of this range and
operates on each "boundary node" according to the
A "left boundary" is best visualized by thinking of a sample tree:
A
/|\
/ | \
/ | \
B C D
/|\ /|\
E F G H I J
Imagine first a range that begins between the
"E" and "F" nodes and ends between the
"I" and "J" nodes. The start container is
"B" and the end container is "D". Given this setup,
the following applies:
Partially Selected Nodes: B, D The "left boundary" is the highest subtree node that contains the starting container. The root of this subtree is always partially selected. In this example, the nodes that are traversed as "left boundary" nodes are: F, G, and B.
| |
| traverseNode | back to summary |
|---|---|
| private Node traverseNode(Node n, boolean isFullySelected, boolean isLeft, int how) Utility method for traversing a single node. Does not properly handle a text node containing both the start and end offsets. Such nodes should have been previously detected and been routed to traverseTextNode.
| |
| traversePartiallySelected | back to summary |
|---|---|
| private Node traversePartiallySelected(Node n, int how) Utility method for traversing a single node when we know a-priori that the node if partially selected and is not a text node.
| |
| traverseRightBoundary | back to summary |
|---|---|
| private Node traverseRightBoundary(Node root, int how) Traverses the "right boundary" of this range and
operates on each "boundary node" according to the
A "right boundary" is best visualized by thinking of a sample tree:
A
/|\
/ | \
/ | \
B C D
/|\ /|\
E F G H I J
Imagine first a range that begins between the
"E" and "F" nodes and ends between the
"I" and "J" nodes. The start container is
"B" and the end container is "D". Given this setup,
the following applies:
Partially Selected Nodes: B, D The "right boundary" is the highest subtree node that contains the ending container. The root of this subtree is always partially selected. In this example, the nodes that are traversed as "right boundary" nodes are: H, I, and D.
| |
| traverseSameContainer | back to summary |
|---|---|
| private DocumentFragment traverseSameContainer(int how) Visits the nodes selected by this range when we know
a-priori that the start and end containers are the same.
This method is invoked by the generic
| |
| traverseTextNode | back to summary |
|---|---|
| private Node traverseTextNode(Node n, boolean isLeft, int how) Utility method for traversing a text node that we know a-priori to be on a left or right boundary of the range. This method does not properly handle text nodes that contain both the start and end points of the range.
| |