org.kde.koala
Class Range

java.lang.Object
  extended by org.kde.koala.Range
All Implemented Interfaces:
org.kde.qt.QtSupport

public class Range
extends java.lang.Object
implements org.kde.qt.QtSupport


Constructor Summary
  Range()
           
protected Range(java.lang.Class dummy)
           
  Range(Document rootContainer)
           
  Range(Node startContainer, long startOffset, Node endContainer, long endOffset)
           
  Range(Range other)
           
 
Method Summary
 boolean boundaryPointsValid()
          not part of the DOM Compare the boundary-points of a range.
 DocumentFragment cloneContents()
          Duplicates the contents of a range
 Range cloneRange()
          Produces a new range whose end-points are equal to the end-points of the range.
 void collapse(boolean toStart)
          Collapse a range onto one of its end-points
 boolean collapsed()
          true if the range is collapsed
 Node commonAncestorContainer()
          Gets the common ancestor container of the range's two end-points.
 DocumentFragment createContextualFragment(java.lang.String html)
           
 void deleteContents()
          Removes the contents of a range from the containing document or document fragment without returning a reference to the removed content.
 void detach()
          Called to indicate that the range is no longer in use and that the implementation may relinquish any resources associated with this range.
 Node endContainer()
          Node within which the range ends
 long endOffset()
          Offset within the ending node of the range.
 DocumentFragment extractContents()
          Moves the contents of a range from the containing document or document fragment to a new DocumentFragment.
 void insertNode(Node newNode)
          Inserts a node into the document or document fragment at the start of the range.
 boolean isDetached()
          not part of the DOM true if the range is detached
 boolean isNull()
          not part of the DOM
 void selectNode(Node refNode)
          Select a node and its contents
 void selectNodeContents(Node refNode)
          Select the contents within a node
 void setEnd(Node refNode, long offset)
          Sets the attributes describing the end of a range.
 void setEndAfter(Node refNode)
          Sets the end of a range to be after a node
 void setEndBefore(Node refNode)
          Sets the end position to be before a node.
 void setStart(Node refNode, long offset)
          Sets the attributes describing the start of the range.
 void setStartAfter(Node refNode)
          Sets the start position to be after a node
 void setStartBefore(Node refNode)
          Sets the start position to be before a node
 Node startContainer()
          Node within which the range begins
 long startOffset()
          Offset within the starting node of the range.
 void surroundContents(Node newParent)
          Reparents the contents of the range to the given node and inserts the node at the position of the start of the range.
 java.lang.String toHTML()
           
 java.lang.String toString()
          Returns the contents of a range as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

protected Range(java.lang.Class dummy)

Range

public Range()

Range

public Range(Document rootContainer)

Range

public Range(Range other)

Range

public Range(Node startContainer,
             long startOffset,
             Node endContainer,
             long endOffset)
Method Detail

startContainer

public Node startContainer()
Node within which the range begins


startOffset

public long startOffset()
Offset within the starting node of the range.


endContainer

public Node endContainer()
Node within which the range ends


endOffset

public long endOffset()
Offset within the ending node of the range.


collapsed

public boolean collapsed()
true if the range is collapsed


commonAncestorContainer

public Node commonAncestorContainer()
Gets the common ancestor container of the range's two end-points. Also sets it.


setStart

public void setStart(Node refNode,
                     long offset)
Sets the attributes describing the start of the range.

Parameters:
refNode - The refNode value. This parameter must be different from null .
offset - The startOffset value. INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node. If an offset is out-of-bounds, should it just be fixed up or should an exception be raised.

setEnd

public void setEnd(Node refNode,
                   long offset)
Sets the attributes describing the end of a range.

Parameters:
refNode - The refNode value. This parameter must be different from null .
offset - The endOffset value. INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an Attr, Entity, Notation, or DocumentType node.

setStartBefore

public void setStartBefore(Node refNode)
Sets the start position to be before a node

Parameters:
refNode - Range starts before refNode

setStartAfter

public void setStartAfter(Node refNode)
Sets the start position to be after a node

Parameters:
refNode - Range starts after refNode

setEndBefore

public void setEndBefore(Node refNode)
Sets the end position to be before a node.

Parameters:
refNode - Range ends before refNode

setEndAfter

public void setEndAfter(Node refNode)
Sets the end of a range to be after a node

Parameters:
refNode - Range ends after refNode .

collapse

public void collapse(boolean toStart)
Collapse a range onto one of its end-points

Parameters:
toStart - If true, collapses the Range onto its start; if false, collapses it onto its end.

selectNode

public void selectNode(Node refNode)
Select a node and its contents

Parameters:
refNode - The node to select.

selectNodeContents

public void selectNodeContents(Node refNode)
Select the contents within a node

Parameters:
refNode - Node to select from

boundaryPointsValid

public boolean boundaryPointsValid()
not part of the DOM Compare the boundary-points of a range. Return true if the startContainer is before the endContainer, or if they are equal. Return false if the startContainer is after the endContainer.


deleteContents

public void deleteContents()
Removes the contents of a range from the containing document or document fragment without returning a reference to the removed content.


extractContents

public DocumentFragment extractContents()
Moves the contents of a range from the containing document or document fragment to a new DocumentFragment. HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be extracted into the new DocumentFragment.

Returns:
A DocumentFragment containing the extracted contents.

cloneContents

public DocumentFragment cloneContents()
Duplicates the contents of a range

Returns:
A DocumentFragment containing contents equivalent to those of this range.

insertNode

public void insertNode(Node newNode)
Inserts a node into the document or document fragment at the start of the range.

Parameters:
newNode - The node to insert at the start of the range WRONG_DOCUMENT_ERR: Raised if newNode and the container of the start of the Range were not created from the same document. HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is of a type that does not allow children of the type of newNode or if newNode is an ancestor of the container .

surroundContents

public void surroundContents(Node newParent)
Reparents the contents of the range to the given node and inserts the node at the position of the start of the range.

Parameters:
newParent - The node to surround the contents with. WRONG_DOCUMENT_ERR: Raised if newParent and the container of the start of the Range were not created from the same document. HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range is of a type that does not allow children of the type of newParent or if newParent is an ancestor of the container or if node would end up with a child node of a type not allowed by the type of node . INVALID_NODE_TYPE_ERR: Raised if node is an Attr, Entity, DocumentType, Notation, Document, or DocumentFragment node.

cloneRange

public Range cloneRange()
Produces a new range whose end-points are equal to the end-points of the range.

Returns:
The duplicated range.

toString

public java.lang.String toString()
Returns the contents of a range as a string.

Overrides:
toString in class java.lang.Object
Returns:
The contents of the range.

toHTML

public java.lang.String toHTML()

createContextualFragment

public DocumentFragment createContextualFragment(java.lang.String html)

detach

public void detach()
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 DOMException being thrown with an error code of INVALID_STATE_ERR.


isDetached

public boolean isDetached()
not part of the DOM true if the range is detached


isNull

public boolean isNull()
not part of the DOM