com.xpn.xwiki.wysiwyg.client.selection.internal
Class DefaultRange

java.lang.Object
  extended by com.xpn.xwiki.wysiwyg.client.selection.internal.AbstractRange
      extended by com.xpn.xwiki.wysiwyg.client.selection.internal.DefaultRange
All Implemented Interfaces:
Range

public class DefaultRange
extends AbstractRange


Method Summary
 DocumentFragment cloneContents()
          Duplicates the contents of a Range.
protected  com.google.gwt.core.client.JavaScriptObject cloneJSRange()
           
 Range cloneRange()
          Produces a new Range whose boundary-points are equal to the boundary-points of the Range.
 void collapse(boolean toStart)
          Collapse a Range onto one of its boundary-points.
protected  short compareBoundaryPoints(int how, com.google.gwt.core.client.JavaScriptObject sourceRange)
          
 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.
 DocumentFragment extractContents()
          Moves the contents of a Range from the containing document or document fragment to a new DocumentFragment.
 com.google.gwt.dom.client.Node getCommonAncestorContainer()
          
 com.google.gwt.dom.client.Node getEndContainer()
          
 int getEndOffset()
          
 com.google.gwt.dom.client.Node getStartContainer()
          
 int getStartOffset()
          
 void insertNode(com.google.gwt.dom.client.Node newNode)
          Inserts a node into the Document or DocumentFragment at the start of the Range.
 boolean isCollapsed()
          
 void selectNode(com.google.gwt.dom.client.Node refNode)
          Select a node and its contents.
 void selectNodeContents(com.google.gwt.dom.client.Node refNode)
          Select the contents within a node.
 void setEnd(com.google.gwt.dom.client.Node refNode, int offset)
          Sets the attributes describing the end of a Range.
 void setEndAfter(com.google.gwt.dom.client.Node refNode)
          Sets the end of a Range to be after a node.
 void setEndBefore(com.google.gwt.dom.client.Node refNode)
          Sets the end position to be before a node.
 void setStart(com.google.gwt.dom.client.Node refNode, int offset)
          Sets the attributes describing the start of the Range.
 void setStartAfter(com.google.gwt.dom.client.Node refNode)
          Sets the start position to be after a node.
 void setStartBefore(com.google.gwt.dom.client.Node refNode)
          Sets the start position to be before a node.
 void surroundContents(com.google.gwt.dom.client.Node newParent)
          Re-parents 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 toString()
          Returns the contents of a Range as a string.
 
Methods inherited from class com.xpn.xwiki.wysiwyg.client.selection.internal.AbstractRange
compareBoundaryPoints, getJSRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isCollapsed

public boolean isCollapsed()

Returns:
true if the Range is collapsed.
See Also:
Range.isCollapsed()

getCommonAncestorContainer

public com.google.gwt.dom.client.Node getCommonAncestorContainer()

Returns:
The deepest common ancestor container of the Range's two boundary-points.
See Also:
Range.getCommonAncestorContainer()

getEndContainer

public com.google.gwt.dom.client.Node getEndContainer()

Returns:
Node within which the Range ends.
See Also:
Range.getEndContainer()

getEndOffset

public int getEndOffset()

Returns:
Offset within the ending node of the Range.
See Also:
Range.getEndOffset()

getStartContainer

public com.google.gwt.dom.client.Node getStartContainer()

Returns:
Node within which the Range begins.
See Also:
Range.getStartContainer()

getStartOffset

public int getStartOffset()

Returns:
Offset within the starting node of the Range.
See Also:
Range.getStartOffset()

setStart

public void setStart(com.google.gwt.dom.client.Node refNode,
                     int 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.
See Also:
Range.setStart(Node, int)

setEnd

public void setEnd(com.google.gwt.dom.client.Node refNode,
                   int 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.
See Also:
Range.setEnd(Node, int)

setStartBefore

public void setStartBefore(com.google.gwt.dom.client.Node refNode)
Sets the start position to be before a node.

Parameters:
refNode - Range starts before refNode.
See Also:
Range.setStartBefore(Node)

setStartAfter

public void setStartAfter(com.google.gwt.dom.client.Node refNode)
Sets the start position to be after a node.

Parameters:
refNode - Range starts after refNode.
See Also:
Range.setStartAfter(Node)

setEndBefore

public void setEndBefore(com.google.gwt.dom.client.Node refNode)
Sets the end position to be before a node.

Parameters:
refNode - Range ends before refNode.
See Also:
Range.setEndBefore(Node)

setEndAfter

public void setEndAfter(com.google.gwt.dom.client.Node refNode)
Sets the end of a Range to be after a node.

Parameters:
refNode - Range ends after refNode.
See Also:
Range.setEndAfter(Node)

selectNode

public void selectNode(com.google.gwt.dom.client.Node refNode)
Select a node and its contents.

Parameters:
refNode - The node to select.
See Also:
Range.selectNode(Node)

selectNodeContents

public void selectNodeContents(com.google.gwt.dom.client.Node refNode)
Select the contents within a node.

Parameters:
refNode - Node to select from.
See Also:
Range.selectNodeContents(Node)

collapse

public void collapse(boolean toStart)
Collapse a Range onto one of its boundary-points.

Parameters:
toStart - If true, collapses the Range onto its start; if false, collapses it onto its end.
See Also:
Range.collapse(boolean)

cloneContents

public DocumentFragment cloneContents()
Duplicates the contents of a Range.

Returns:
A DocumentFragment that contains content equivalent to this Range.
See Also:
Range.cloneContents()

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.

See Also:
Range.deleteContents()

extractContents

public DocumentFragment extractContents()
Moves the contents of a Range from the containing document or document fragment to a new DocumentFragment.

Returns:
A DocumentFragment containing the extracted contents.
See Also:
Range.extractContents()

insertNode

public void insertNode(com.google.gwt.dom.client.Node newNode)
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.

Parameters:
newNode - The node to insert at the start of the Range.
See Also:
Range.insertNode(Node)

surroundContents

public void surroundContents(com.google.gwt.dom.client.Node newParent)
Re-parents 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.
See Also:
Range.surroundContents(Node)

compareBoundaryPoints

protected short compareBoundaryPoints(int how,
                                      com.google.gwt.core.client.JavaScriptObject sourceRange)

Specified by:
compareBoundaryPoints in class AbstractRange
See Also:
AbstractRange.compareBoundaryPoints(int, JavaScriptObject)

cloneRange

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

Returns:
The duplicated Range.
See Also:
Range.cloneRange()

cloneJSRange

protected com.google.gwt.core.client.JavaScriptObject cloneJSRange()

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.

See Also:
Range.detach()

toString

public java.lang.String toString()
Returns the contents of a Range as a string. This string contains only the data characters, not any mark-up.

Specified by:
toString in interface Range
Overrides:
toString in class java.lang.Object
Returns:
The contents of the Range.
See Also:
Range.toString()


Copyright © 2004-2008 XWiki. All Rights Reserved.