org.apache.pivot.wtk.text
Class TextSpan

java.lang.Object
  extended by org.apache.pivot.wtk.text.Node
      extended by org.apache.pivot.wtk.text.Element
          extended by org.apache.pivot.wtk.text.TextSpan
All Implemented Interfaces:
Iterable<Node>, Sequence<Node>
Direct Known Subclasses:
Span

public class TextSpan
extends Element

Element representing an inline range of styled characters.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
 
Constructor Summary
TextSpan()
           
TextSpan(String text)
           
TextSpan(TextSpan span, boolean recursive)
           
 
Method Summary
 int add(String text)
           
 TextSpan duplicate(boolean recursive)
          Creates a copy of this node.
 TextSpan getRange(int offset, int characterCount)
          Returns a range from the node.
 void insert(Node node, int index)
          Inserts an item into the sequence at a specific index.
 
Methods inherited from class org.apache.pivot.wtk.text.Element
add, dumpOffsets, get, getBackgroundColor, getCharacterAt, getCharacterCount, getDescendantAt, getElementListeners, getFont, getForegroundColor, getLength, getNodeAt, getPathAt, indexOf, insertRange, isStrikethrough, isUnderline, iterator, rangeInserted, rangeRemoved, remove, remove, removeRange, setBackgroundColor, setBackgroundColor, setFont, setFont, setForegroundColor, setForegroundColor, setStrikethrough, setUnderline, update
 
Methods inherited from class org.apache.pivot.wtk.text.Node
getDocumentOffset, getDocumentSpan, getNodeListeners, getOffset, getParent, nodeInserted, nodesRemoved, replaceRange, setOffset, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextSpan

public TextSpan()

TextSpan

public TextSpan(TextSpan span,
                boolean recursive)

TextSpan

public TextSpan(String text)
Method Detail

add

public int add(String text)

insert

public void insert(Node node,
                   int index)
Description copied from interface: Sequence
Inserts an item into the sequence at a specific index.

Specified by:
insert in interface Sequence<Node>
Overrides:
insert in class Element
Parameters:
node - The item to be added to the sequence.
index - The index at which the item should be inserted. Must be a value between 0 and getLength().

duplicate

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

Specified by:
duplicate in class Element

getRange

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

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