org.xwiki.gwt.dom.client.internal
Class DefaultSelection

java.lang.Object
  extended by org.xwiki.gwt.dom.client.internal.AbstractSelection
      extended by org.xwiki.gwt.dom.client.internal.DefaultSelection
All Implemented Interfaces:
Selection
Direct Known Subclasses:
MozillaSelection

public class DefaultSelection
extends AbstractSelection

The default selection implementation for browsers supporting the W3C Range specification and following Mozilla Selection API.

Version:
$Id: DefaultSelection.java 20039 2009-05-16 12:04:30Z sdumitriu $

Constructor Summary
DefaultSelection(NativeSelection nativeSelection)
          Creates a new selection object.
 
Method Summary
 void addRange(Range range)
          Adds a range to this selection.
protected  NativeSelection getNativeSelection()
           
 Range getRangeAt(int index)
          
 int getRangeCount()
          
 void removeAllRanges()
          Removes all ranges from the current selection.
 void removeRange(Range range)
          Removes the given range from the selection.
 
Methods inherited from class org.xwiki.gwt.dom.client.internal.AbstractSelection
collapse, collapseToEnd, collapseToStart, containsNode, deleteFromDocument, extend, getAnchorNode, getAnchorOffset, getFocusNode, getFocusOffset, isCollapsed, selectAllChildren, selectionLanguageChange, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultSelection

public DefaultSelection(NativeSelection nativeSelection)
Creates a new selection object. This object will handle the conversion of Range objects to the native range supported by the browser. The native ranges obtained will be applied to the underlying native selection.

Parameters:
nativeSelection - the underlying native selection to be used
Method Detail

getNativeSelection

protected NativeSelection getNativeSelection()
Returns:
nativeSelection

addRange

public void addRange(Range range)
Adds a range to this selection.

Parameters:
range - the range to be added
See Also:
Selection.addRange(Range)

getRangeAt

public Range getRangeAt(int index)

Parameters:
index - the index of the range to retrieve. Usually the selection contains just one range.
Returns:
the range at the specified index
See Also:
Selection.getRangeAt(int)

getRangeCount

public int getRangeCount()

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

removeAllRanges

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

See Also:
Selection.removeAllRanges()

removeRange

public void removeRange(Range range)
Removes the given range from the selection.

Parameters:
range - the range to be removed from the selection.
See Also:
Selection.removeRange(Range)


Copyright © 2004-2009 XWiki. All Rights Reserved.