org.apache.pivot.wtk.text
Class TextNode

java.lang.Object
  extended by org.apache.pivot.wtk.text.Node
      extended by org.apache.pivot.wtk.text.TextNode

public final class TextNode
extends Node

Node representing a sequence of characters.


Constructor Summary
TextNode()
           
TextNode(String text)
           
TextNode(TextNode textNode)
           
 
Method Summary
 Node duplicate(boolean recursive)
          Creates a copy of this node.
 char getCharacterAt(int index)
          Returns the character at the given offset.
 int getCharacterCount()
          Returns the number of characters in this node.
 CharSequence getCharacters()
           
 CharSequence getCharacters(int start, int end)
           
 CharSequence getCharacters(Span range)
           
 Node getRange(int offset, int characterCount)
          Returns a range from the node.
 String getSubstring(int start, int end)
           
 String getSubstring(Span range)
           
 String getText()
           
 String getText(int beginIndex, int endIndex)
           
 ListenerList<TextNodeListener> getTextNodeListeners()
           
 void insertRange(Node range, int offset)
          Inserts a range into the node.
 void insertText(CharSequence text, int index)
           
 Node removeRange(int offset, int characterCount)
          Removes a range from the node.
 void removeText(int index, int count)
           
 void setText(String text)
           
 String toString()
           
 
Methods inherited from class org.apache.pivot.wtk.text.Node
getDocumentOffset, getDocumentSpan, getNodeListeners, getOffset, getParent, nodeInserted, nodesRemoved, rangeInserted, rangeRemoved, replaceRange, setOffset, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextNode

public TextNode()

TextNode

public TextNode(TextNode textNode)

TextNode

public TextNode(String text)
Method Detail

getText

public String getText()

getText

public String getText(int beginIndex,
                      int endIndex)

setText

public void setText(String text)

insertText

public void insertText(CharSequence text,
                       int index)

removeText

public void removeText(int index,
                       int count)

getSubstring

public String getSubstring(Span range)

getSubstring

public String getSubstring(int start,
                           int end)

getCharacters

public CharSequence getCharacters()

getCharacters

public CharSequence getCharacters(int start,
                                  int end)

getCharacters

public CharSequence getCharacters(Span range)

getCharacterAt

public char getCharacterAt(int index)
Description copied from class: Node
Returns the character at the given offset.

Specified by:
getCharacterAt in class Node

getCharacterCount

public int getCharacterCount()
Description copied from class: Node
Returns the number of characters in this node.

Specified by:
getCharacterCount in class Node

insertRange

public void insertRange(Node range,
                        int offset)
Description copied from class: Node
Inserts a range into the node. Note that the contents of the range, rather than the range itself, is added to the node.

Specified by:
insertRange in class Node

removeRange

public Node removeRange(int offset,
                        int characterCount)
Description copied from class: Node
Removes a range from the node.

Specified by:
removeRange in class Node
Returns:
The removed range. This will be a copy of the node structure relative to this node.

getRange

public Node getRange(int offset,
                     int characterCount)
Description copied from class: Node
Returns a range from the node.

Specified by:
getRange in class Node
Returns:
A node containing a copy of the node structure spanning the given range, relative to this node.

duplicate

public Node duplicate(boolean recursive)
Description copied from class: Node
Creates a copy of this node.

Specified by:
duplicate in class Node

toString

public String toString()
Overrides:
toString in class Object

getTextNodeListeners

public ListenerList<TextNodeListener> getTextNodeListeners()