org.xwiki.gwt.dom.client
Class Text

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.dom.client.Node
          extended by com.google.gwt.dom.client.Text
              extended by org.xwiki.gwt.dom.client.Text

public final class Text
extends com.google.gwt.dom.client.Text

Extends the text implementation provided by GWT to add useful methods. All of them should be removed as soon as they make their way into GWT's API.

Version:
$Id$

Field Summary
 
Fields inherited from class com.google.gwt.dom.client.Node
DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE
 
Constructor Summary
protected Text()
          Default constructor.
 
Method Summary
static Text as(com.google.gwt.dom.client.Node node)
          Casts a Node to an instance of this type.
 void crop(int startIndex, int endIndex)
          Keeps the text between the given indexes as the value of this node.
 int getOffset()
           
 TextFragment normalize()
          Merges all the neighbor text nodes of this text node and returns a text fragment specifying where is this text placed in the final text node resulted after the merge.
 
Methods inherited from class com.google.gwt.dom.client.Text
deleteData, getData, getLength, insertData, replaceData, setData, splitText
 
Methods inherited from class com.google.gwt.dom.client.Node
appendChild, as, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, is, isOrHasChild, removeChild, removeFromParent, replaceChild, setNodeValue
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Text

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

Method Detail

as

public static Text as(com.google.gwt.dom.client.Node node)
Casts a Node to an instance of this type.

Parameters:
node - the instance to be casted to this type.
Returns:
the given object as an instance of Text.

normalize

public TextFragment normalize()
Merges all the neighbor text nodes of this text node and returns a text fragment specifying where is this text placed in the final text node resulted after the merge.

Returns:
a text fragment showing the place of this text in the node obtained after the merge.

getOffset

public int getOffset()
Returns:
the offset of this text node relative to the left-most successive text node sibling. The offset is expressed as the number of characters between this text node and the reference point.

crop

public void crop(int startIndex,
                 int endIndex)
Keeps the text between the given indexes as the value of this node. The remaining text, if present, is placed in sibling text nodes.

Parameters:
startIndex - crop start
endIndex - crop end


Copyright © 2004-2011 XWiki. All Rights Reserved.