org.odftoolkit.simple.common.navigation
Class TextNavigation

java.lang.Object
  extended by org.odftoolkit.simple.common.navigation.Navigation
      extended by org.odftoolkit.simple.common.navigation.TextNavigation

public class TextNavigation
extends Navigation

A derived Navigation class used to navigate the text content, which can search the document and find the matched text and return TextSelection instance.


Constructor Summary
TextNavigation(String pattern, Document doc)
          Construct TextNavigation with matched condition and navigation scope.
TextNavigation(String pattern, OdfElement element)
          Construct TextNavigation with matched condition and navigation scope.
 
Method Summary
 boolean hasNext()
          Check if has next TextSelection with satisfied content pattern.
 boolean match(Node element)
          Check if the text content of element match the specified matched condition, which is stated when the TextNavigation created.
 Selection nextSelection()
          Get next TextSelection.
 
Methods inherited from class org.odftoolkit.simple.common.navigation.Navigation
getNextMatchElement, getNextMatchElementInTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextNavigation

public TextNavigation(String pattern,
                      Document doc)
Construct TextNavigation with matched condition and navigation scope.

Parameters:
pattern - the matched pattern String
doc - the navigation scope

TextNavigation

public TextNavigation(String pattern,
                      OdfElement element)
Construct TextNavigation with matched condition and navigation scope.

Parameters:
pattern - the matched pattern String
element - the ODF element whose content will be navigated.
Since:
0.5
Method Detail

hasNext

public boolean hasNext()
Check if has next TextSelection with satisfied content pattern.

Specified by:
hasNext in class Navigation
Returns:
true if document still has more matched Selection, and vice versa
See Also:
Navigation.hasNext()

nextSelection

public Selection nextSelection()
Get next TextSelection.

Specified by:
nextSelection in class Navigation
Returns:
the next Selection result
See Also:
Navigation.nextSelection()

match

public boolean match(Node element)
Check if the text content of element match the specified matched condition, which is stated when the TextNavigation created.

Specified by:
match in class Navigation
Parameters:
element - navigate this element
Returns:
true if the text content of this element match this pattern; false if not match


Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.