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

java.lang.Object
  extended by com.xpn.xwiki.wysiwyg.client.selection.internal.AbstractSelection
      extended by com.xpn.xwiki.wysiwyg.client.selection.internal.DefaultSelection
All Implemented Interfaces:
Selection

public final class DefaultSelection
extends AbstractSelection


Method Summary
protected  void addRange(com.google.gwt.core.client.JavaScriptObject range)
          
 void collapse(com.google.gwt.dom.client.Node parentNode, int offset)
          Collapses the selection to a single point, at the specified offset in the given DOM node.
 void collapseToEnd()
          Collapses the whole selection to a single point at the end of the current selection (irrespective of direction).
 void collapseToStart()
          Collapses the whole selection to a single point at the start of the current selection (irrespective of direction).
 boolean containsNode(com.google.gwt.dom.client.Node node, boolean partlyContained)
          Indicates whether the node is part of the selection.
 void deleteFromDocument()
          Deletes this selection from document the nodes belong to.
 void extend(com.google.gwt.dom.client.Node parentNode, int offset)
          Extends the selection by moving the selection end to the specified node and offset, preserving the selection begin position.
 com.google.gwt.dom.client.Node getAnchorNode()
          
 int getAnchorOffset()
          
 com.google.gwt.dom.client.Node getFocusNode()
          
 int getFocusOffset()
          
protected  com.google.gwt.core.client.JavaScriptObject getJSRangeAt(int index)
           
 Range getRangeAt(int index)
          
 int getRangeCount()
          
 boolean isCollapsed()
          
 void removeAllRanges()
          Removes all ranges from the current selection.
protected  void removeRange(com.google.gwt.core.client.JavaScriptObject range)
          
 void selectAllChildren(com.google.gwt.dom.client.Node parentNode)
          Adds all children of the specified node to the selection.
 void selectionLanguageChange(boolean langRTL)
          Modifies the cursor Bidi level after a change in keyboard direction
 java.lang.String toString()
          
 
Methods inherited from class com.xpn.xwiki.wysiwyg.client.selection.internal.AbstractSelection
addRange, getJSSelection, removeRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addRange

protected void addRange(com.google.gwt.core.client.JavaScriptObject range)

Specified by:
addRange in class AbstractSelection
See Also:
AbstractSelection.addRange(JavaScriptObject)

collapse

public void collapse(com.google.gwt.dom.client.Node parentNode,
                     int offset)
Collapses the selection to a single point, at the specified offset in the given DOM node. When the selection is collapsed, and the content is focused and editable, the caret will blink there.

Parameters:
parentNode - The given dom node where the selection will be set.
offset - Where in given dom node to place the selection (the offset into the given node).
See Also:
Selection.collapse(Node, int)

collapseToEnd

public void collapseToEnd()
Collapses the whole selection to a single point at the end of the current selection (irrespective of direction). If content is focused and editable, the caret will blink there.

See Also:
Selection.collapseToEnd()

collapseToStart

public void collapseToStart()
Collapses the whole selection to a single point at the start of the current selection (irrespective of direction). If content is focused and editable, the caret will blink there.

See Also:
Selection.collapseToStart()

containsNode

public boolean containsNode(com.google.gwt.dom.client.Node node,
                            boolean partlyContained)
Indicates whether the node is part of the selection. If partlyContained is set to true, the function returns true when some part of the node is part of the selection. If partlyContained is set to false, the function only returns true when the entire node is part of the selection.

See Also:
Selection.containsNode(Node, boolean)

deleteFromDocument

public void deleteFromDocument()
Deletes this selection from document the nodes belong to.

See Also:
Selection.deleteFromDocument()

extend

public void extend(com.google.gwt.dom.client.Node parentNode,
                   int offset)
Extends the selection by moving the selection end to the specified node and offset, preserving the selection begin position. The new selection end result will always be from the anchorNode to the new focusNode, regardless of direction.

Parameters:
parentNode - The node where the selection will be extended to.
offset - Where in node to place the offset in the new selection end.
See Also:
Selection.extend(Node, int)

getAnchorNode

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

Returns:
The node in which the selection begins.
See Also:
Selection.getAnchorNode()

getAnchorOffset

public int getAnchorOffset()

Returns:
The offset within the (text) node where the selection begins.
See Also:
Selection.getAnchorOffset()

getFocusNode

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

Returns:
The node in which the selection ends.
See Also:
Selection.getFocusNode()

getFocusOffset

public int getFocusOffset()

Returns:
The offset within the (text) node where the selection ends.
See Also:
Selection.getFocusOffset()

getRangeAt

public Range getRangeAt(int index)

Returns:
The range at the specified index.
See Also:
Selection.getRangeAt(int)

getJSRangeAt

protected com.google.gwt.core.client.JavaScriptObject getJSRangeAt(int index)

getRangeCount

public int getRangeCount()

Returns:
The number of ranges in the selection.
See Also:
Selection.getRangeCount()

isCollapsed

public boolean isCollapsed()

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

removeAllRanges

public void removeAllRanges()
Removes all ranges from the current selection.

See Also:
Selection.removeAllRanges()

removeRange

protected void removeRange(com.google.gwt.core.client.JavaScriptObject range)

Specified by:
removeRange in class AbstractSelection
See Also:
AbstractSelection.removeRange(JavaScriptObject)

selectAllChildren

public void selectAllChildren(com.google.gwt.dom.client.Node parentNode)
Adds all children of the specified node to the selection.

Parameters:
parentNode - the parent of the children to be added to the selection.
See Also:
Selection.selectAllChildren(Node)

selectionLanguageChange

public void selectionLanguageChange(boolean langRTL)
Modifies the cursor Bidi level after a change in keyboard direction

Parameters:
langRTL - is true if the new language is right-to-left or false if the new language is left-to-right.
See Also:
Selection.selectionLanguageChange(boolean)

toString

public java.lang.String toString()

Specified by:
toString in interface Selection
Overrides:
toString in class java.lang.Object
Returns:
A string currently being represented by the selection object, i.e. the currently selected text.
See Also:
Selection.toString()


Copyright © 2004-2008 XWiki. All Rights Reserved.