Package org.apache.pivot.wtk.text
Class TextNode
- java.lang.Object
-
- org.apache.pivot.wtk.text.Node
-
- org.apache.pivot.wtk.text.TextNode
-
public final class TextNode extends Node
Node representing a sequence of characters.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendText(java.lang.CharSequence text)Nodeduplicate(boolean recursive)Creates a copy of this node.chargetCharacterAt(int index)intgetCharacterCount()java.lang.CharSequencegetCharacters()java.lang.CharSequencegetCharacters(int start, int end)java.lang.CharSequencegetCharacters(CharSpan charSpan)java.lang.CharSequencegetCharacters(Span range)NodegetRange(int offset, int characterCount)Returns a range from the node.java.lang.StringgetSubstring(int start, int end)java.lang.StringgetSubstring(CharSpan charSpan)java.lang.StringgetSubstring(Span range)java.lang.StringgetText()java.lang.StringgetText(int beginIndex, int endIndex)java.lang.StringgetText(CharSpan charSpan)java.lang.StringgetText(Span span)ListenerList<TextNodeListener>getTextNodeListeners()voidinsertRange(Node range, int offset)Inserts a range into the node.voidinsertText(java.lang.CharSequence text, int index)NoderemoveRange(int offset, int characterCount)Removes a range from the node.voidremoveText(int index, int count)voidsetText(java.lang.String text)java.lang.StringtoString()-
Methods inherited from class org.apache.pivot.wtk.text.Node
getDocumentOffset, getDocumentSpan, getNodeListeners, getOffset, getParagraph, getParent, getUserData, nodeInserted, nodesRemoved, rangeInserted, rangeRemoved, replaceRange, setOffset, setParent, setUserData
-
-
-
-
Constructor Detail
-
TextNode
public TextNode()
-
TextNode
public TextNode(TextNode textNode)
-
TextNode
public TextNode(java.lang.String text)
-
-
Method Detail
-
getText
public java.lang.String getText()
-
getText
public java.lang.String getText(int beginIndex, int endIndex)
-
getText
public java.lang.String getText(Span span)
-
getText
public java.lang.String getText(CharSpan charSpan)
-
setText
public void setText(java.lang.String text)
-
appendText
public void appendText(java.lang.CharSequence text)
-
insertText
public void insertText(java.lang.CharSequence text, int index)- Parameters:
text- The new text to insert into this node.index- Starting index into this node for the insertion.
-
removeText
public void removeText(int index, int count)- Parameters:
index- Index into this node.count- Count of characters to remove.
-
getSubstring
public java.lang.String getSubstring(Span range)
-
getSubstring
public java.lang.String getSubstring(int start, int end)
-
getSubstring
public java.lang.String getSubstring(CharSpan charSpan)
-
getCharacters
public java.lang.CharSequence getCharacters()
- Specified by:
getCharactersin classNode- Returns:
- The character sequence in this node.
-
getCharacters
public java.lang.CharSequence getCharacters(int start, int end)
-
getCharacters
public java.lang.CharSequence getCharacters(Span range)
-
getCharacters
public java.lang.CharSequence getCharacters(CharSpan charSpan)
-
getCharacterAt
public char getCharacterAt(int index)
- Specified by:
getCharacterAtin classNode- Parameters:
index- Offset relative to this node.- Returns:
- The character at the given offset.
-
getCharacterCount
public int getCharacterCount()
- Specified by:
getCharacterCountin classNode- Returns:
- The number of characters in this node.
-
insertRange
public void insertRange(Node range, int offset)
Description copied from class:NodeInserts a range into the node. Note that the contents of the range, rather than the range itself, is added to the node.- Specified by:
insertRangein classNode- Parameters:
offset- Offset into this text node.range- The node containing the text to insert.
-
removeRange
public Node removeRange(int offset, int characterCount)
Description copied from class:NodeRemoves a range from the node.- Specified by:
removeRangein classNode- Parameters:
offset- Offset relative to this node.characterCount- Count of characters to remove.- 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:NodeReturns a range from the node.
-
duplicate
public Node duplicate(boolean recursive)
Description copied from class:NodeCreates a copy of this node.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getTextNodeListeners
public ListenerList<TextNodeListener> getTextNodeListeners()
-
-