org.xwiki.gwt.dom.client.internal.ie
Class NativeSelection

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by org.xwiki.gwt.dom.client.internal.ie.NativeSelection

public final class NativeSelection
extends com.google.gwt.core.client.JavaScriptObject

Wraps the selection JavaScript object provided by Internet Explorer.

Version:
$Id: NativeSelection.java 20252 2009-05-21 12:38:08Z mflorea $

Constructor Summary
protected NativeSelection()
          Default constructor.
 
Method Summary
 NativeRange createRange()
          Creates a TextRange object from the current text selection, or a ControlRange object from a control selection.
 void empty()
          Cancels the current selection and sets the selection type to none.
static void ensureSelectionIsPreserved(Document document)
          Ensures that the selection of the given document is preserved when the document looses focus.
static NativeSelection getInstance(Document document)
           
 Document getOwnerDocument()
           
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NativeSelection

protected NativeSelection()
Default constructor. Needs to be protected because all instances are created from JavaScript.

Method Detail

getInstance

public static NativeSelection getInstance(Document document)
Parameters:
document - the DOM document for which to retrieve the selection object
Returns:
the selection object associated with the given in-line frame

ensureSelectionIsPreserved

public static void ensureSelectionIsPreserved(Document document)
Ensures that the selection of the given document is preserved when the document looses focus. This method is required because IE has only one selection object per top level window. This means that when a child document looses the focus its selection object will return ranges from the parent document.

Parameters:
document - the document whose selection has to be preserved

createRange

public NativeRange createRange()
Creates a TextRange object from the current text selection, or a ControlRange object from a control selection.

Returns:
the created range object

empty

public void empty()
Cancels the current selection and sets the selection type to none.


getOwnerDocument

public Document getOwnerDocument()
Returns:
the document associated with this selection object


Copyright © 2004-2009 XWiki. All Rights Reserved.