com.lizardtech.djvubean.text
Class TextSearch

java.lang.Object
  extended by com.lizardtech.djvubean.text.TextSearch
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Runnable, java.util.EventListener

public class TextSearch
extends java.lang.Object
implements java.io.Serializable, java.lang.Runnable, java.beans.PropertyChangeListener

This is an optional component neccissary to add search features to the the DjVuBean. The run() method is used to invoke a search with the parameters specified in the DjVuBean.

Version:
$Revision: 1.6 $
Author:
$author$
See Also:
Serialized Form

Field Summary
protected  DjVuBean djvuBean
          DjVuBean to search.
 
Constructor Summary
TextSearch(DjVuBean bean)
          Creates a new TextSearch object.
 
Method Summary
 DjVuText getDjVuText(int page)
          Query the DjVuText data for the specified page.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Called when a property has changed.
 void run()
          Search for text forward or backwards from the last caret position in the whole document or page.
 int searchPage(DjVuText djvuText, java.lang.String searchText, int mask)
          Search for text forward or backwards from the last Caret Position in the current page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

djvuBean

protected final DjVuBean djvuBean
DjVuBean to search.

Constructor Detail

TextSearch

public TextSearch(DjVuBean bean)
Creates a new TextSearch object.

Parameters:
bean - DjVuBean to search.
Method Detail

getDjVuText

public DjVuText getDjVuText(int page)
Query the DjVuText data for the specified page.

Parameters:
page - number to read the text from.
Returns:
DjVuText data for the specified page.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Called when a property has changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - describing the property change.

run

public void run()
Search for text forward or backwards from the last caret position in the whole document or page.

Specified by:
run in interface java.lang.Runnable

searchPage

public int searchPage(DjVuText djvuText,
                      java.lang.String searchText,
                      int mask)
Search for text forward or backwards from the last Caret Position in the current page.

Parameters:
djvuText - to search.
searchText - text to search for.
mask - of search options.
Returns:
the position where the text was found, or -1 if the text was not found.