org.enhydra.apache.xerces.dom
Class RangeImpl

java.lang.Object
  |
  +--org.enhydra.apache.xerces.dom.RangeImpl
All Implemented Interfaces:
Range

public class RangeImpl
extends Object
implements Range

The RangeImpl class implements the org.w3c.dom.range.Range interface.

Please see the API documentation for the interface classes and use the interfaces in your client programs.


Field Summary
(package private) static int CLONE_CONTENTS
           
(package private) static int DELETE_CONTENTS
           
(package private) static int EXTRACT_CONTENTS
           
(package private)  Node fDeleteNode
           
(package private)  boolean fDetach
           
(package private)  DocumentImpl fDocument
           
(package private)  Node fEndContainer
           
(package private)  int fEndOffset
           
(package private)  Node fInsertNode
           
(package private)  boolean fIsCollapsed
           
(package private)  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.
(package private)  Node fSplitNode
           
(package private)  Node fStartContainer
           
(package private)  int fStartOffset
           
 
Fields inherited from interface org.w3c.dom.ranges.Range
END_TO_END, END_TO_START, START_TO_END, START_TO_START
 
Constructor Summary
RangeImpl(DocumentImpl document)
          The constructor.
 
Method Summary
(package private)  void checkIndex(Node refNode, int offset)
           
 DocumentFragment cloneContents()
           
 Range cloneRange()
           
 void collapse(boolean toStart)
           
 short compareBoundaryPoints(short how, Range sourceRange)
           
 void deleteContents()
           
(package private)  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.
 void detach()
           
 DocumentFragment extractContents()
           
 boolean getCollapsed()
           
 Node getCommonAncestorContainer()
           
 Node getEndContainer()
           
 int getEndOffset()
           
 Node getStartContainer()
           
 int getStartOffset()
           
(package private)  int indexOf(Node child, Node parent)
          what is the index of the child in the parent
(package private)  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.
 void insertedNodeFromDOM(Node node)
          This function is called from the DOM.
 void insertNode(Node newNode)
           
(package private)  boolean isAncestorOf(Node a, Node b)
          is a an ancestor of b ?
(package private)  Node nextNode(Node node, boolean visitChildren)
           
(package private)  void receiveDeletedText(Node node, int offset, int count)
          This function is called from DOM.
(package private)  void receiveInsertedText(Node node, int index, int len)
          This function is called from DOM.
(package private)  void receiveReplacedText(Node node)
          This function is called from DOM.
(package private)  void receiveSplitData(Node node, Node newNode, int offset)
          Fix up this Range if another Range has split a Text Node into 2 Nodes.
(package private)  Node removeChild(Node parent, Node child)
           
(package private)  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.
 void selectNode(Node refNode)
           
 void selectNodeContents(Node refNode)
           
 void setEnd(Node refNode, int offset)
           
 void setEndAfter(Node refNode)
           
 void setEndBefore(Node refNode)
           
 void setStart(Node refNode, int offset)
           
 void setStartAfter(Node refNode)
           
 void setStartBefore(Node refNode)
           
(package private)  void signalSplitData(Node node, Node newNode, int offset)
          Signal other Ranges to update their start/end containers/offsets.
 void surroundContents(Node newParent)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fDocument

DocumentImpl fDocument

fStartContainer

Node fStartContainer

fEndContainer

Node fEndContainer

fStartOffset

int fStartOffset

fEndOffset

int fEndOffset

fIsCollapsed

boolean fIsCollapsed

fDetach

boolean fDetach

fInsertNode

Node fInsertNode

fDeleteNode

Node fDeleteNode

fSplitNode

Node fSplitNode

fRemoveChild

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.

EXTRACT_CONTENTS

static final int EXTRACT_CONTENTS

CLONE_CONTENTS

static final int CLONE_CONTENTS

DELETE_CONTENTS

static final int DELETE_CONTENTS
Constructor Detail

RangeImpl

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.
Method Detail

getStartContainer

public Node getStartContainer()
Specified by:
getStartContainer in interface Range

getStartOffset

public int getStartOffset()
Specified by:
getStartOffset in interface Range

getEndContainer

public Node getEndContainer()
Specified by:
getEndContainer in interface Range

getEndOffset

public int getEndOffset()
Specified by:
getEndOffset in interface Range

getCollapsed

public boolean getCollapsed()
Specified by:
getCollapsed in interface Range

getCommonAncestorContainer

public Node getCommonAncestorContainer()
Specified by:
getCommonAncestorContainer in interface Range

setStart

public void setStart(Node refNode,
                     int offset)
              throws RangeException,
                     DOMException
Specified by:
setStart in interface Range

setEnd

public void setEnd(Node refNode,
                   int offset)
            throws RangeException,
                   DOMException
Specified by:
setEnd in interface Range

setStartBefore

public void setStartBefore(Node refNode)
                    throws RangeException
Specified by:
setStartBefore in interface Range

setStartAfter

public void setStartAfter(Node refNode)
                   throws RangeException
Specified by:
setStartAfter in interface Range

setEndBefore

public void setEndBefore(Node refNode)
                  throws RangeException
Specified by:
setEndBefore in interface Range

setEndAfter

public void setEndAfter(Node refNode)
                 throws RangeException
Specified by:
setEndAfter in interface Range

collapse

public void collapse(boolean toStart)
Specified by:
collapse in interface Range

selectNode

public void selectNode(Node refNode)
                throws RangeException
Specified by:
selectNode in interface Range

selectNodeContents

public void selectNodeContents(Node refNode)
                        throws RangeException
Specified by:
selectNodeContents in interface Range

compareBoundaryPoints

public short compareBoundaryPoints(short how,
                                   Range sourceRange)
                            throws DOMException
Specified by:
compareBoundaryPoints in interface Range

deleteContents

public void deleteContents()
                    throws DOMException
Specified by:
deleteContents in interface Range

extractContents

public DocumentFragment extractContents()
                                 throws DOMException
Specified by:
extractContents in interface Range

cloneContents

public DocumentFragment cloneContents()
                               throws DOMException
Specified by:
cloneContents in interface Range

insertNode

public void insertNode(Node newNode)
                throws DOMException,
                       RangeException
Specified by:
insertNode in interface Range

surroundContents

public void surroundContents(Node newParent)
                      throws DOMException,
                             RangeException
Specified by:
surroundContents in interface Range

cloneRange

public Range cloneRange()
Specified by:
cloneRange in interface Range

toString

public String toString()
Specified by:
toString in interface Range
Overrides:
toString in class Object

detach

public void detach()
Specified by:
detach in interface Range

signalSplitData

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.

receiveSplitData

void receiveSplitData(Node node,
                      Node newNode,
                      int offset)
Fix up this Range if another Range has split a Text Node into 2 Nodes.

deleteData

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.

receiveDeletedText

void receiveDeletedText(Node node,
                        int offset,
                        int count)
This function is called from DOM. The text has already beeen inserted. Fix-up any offsets.

insertData

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.

receiveInsertedText

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

void receiveReplacedText(Node node)
This function is called from DOM. The text has already beeen replaced. Fix-up any offsets.

insertedNodeFromDOM

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.

removeChild

Node removeChild(Node parent,
                 Node child)

removeNode

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.

checkIndex

void checkIndex(Node refNode,
                int offset)
          throws DOMException

nextNode

Node nextNode(Node node,
              boolean visitChildren)

isAncestorOf

boolean isAncestorOf(Node a,
                     Node b)
is a an ancestor of b ?

indexOf

int indexOf(Node child,
            Node parent)
what is the index of the child in the parent


Copyright © 1999 The Apache Software Foundation. All Rights reserved.