pivot.wtk.text
Class Paragraph

java.lang.Object
  extended by pivot.wtk.text.Node
      extended by pivot.wtk.text.Element
          extended by pivot.wtk.text.Block
              extended by pivot.wtk.text.Paragraph
All Implemented Interfaces:
java.lang.Iterable<Node>, Sequence<Node>

public class Paragraph
extends Block

Element representing a paragraph.

TODO Add indent property.

Author:
gbrown

Nested Class Summary
 
Nested classes/interfaces inherited from interface pivot.collections.Sequence
Sequence.Search, Sequence.Sort, Sequence.Tree
 
Constructor Summary
Paragraph()
           
Paragraph(Paragraph paragraph, boolean recursive)
           
Paragraph(java.lang.String text)
           
 
Method Summary
 int add(java.lang.String text)
           
 Node duplicate(boolean recursive)
          Creates a copy of this node.
 int getCharacterCount()
          Returns the number of characters in this node.
 Node getDescendantAt(int offset)
          Determines the descendant node at a given offset.
 Sequence<java.lang.Integer> getPathAt(int offset)
          Determines the path of the descendant node at a given offset.
 Node 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.
 Node removeRange(int offset, int characterCount)
          Removes a range from the node.
 
Methods inherited from class pivot.wtk.text.Element
add, dumpOffsets, get, getElementListeners, getIndexAt, getLength, getNodeAt, indexOf, insertRange, iterator, rangeInserted, rangeRemoved, remove, remove, update
 
Methods inherited from class pivot.wtk.text.Node
getDocumentOffset, getNodeListeners, getOffset, getParent, replaceRange, setOffset, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Paragraph

public Paragraph()

Paragraph

public Paragraph(java.lang.String text)

Paragraph

public Paragraph(Paragraph paragraph,
                 boolean recursive)
Method Detail

removeRange

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

Overrides:
removeRange in class Element
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.

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

getCharacterCount

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

Overrides:
getCharacterCount in class Element

add

public int add(java.lang.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().

getPathAt

public Sequence<java.lang.Integer> getPathAt(int offset)
Description copied from class: Element
Determines the path of the descendant node at a given offset.

Overrides:
getPathAt in class Element
Returns:
The path to the descendant node at the given offset.

getDescendantAt

public Node getDescendantAt(int offset)
Description copied from class: Element
Determines the descendant node at a given offset.

Overrides:
getDescendantAt in class Element
Returns:
The descendant node at the given offset.

duplicate

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

Specified by:
duplicate in class Node