com.webrenderer.swing
Interface IFindService


public interface IFindService

Companion interface to IMozillaBrowserCanvas that exposes the browser's advanced text-finding functionality.

See Also:
IMozillaBrowserCanvas.getFindService()

Method Summary
 void cancelAllSearches()
          Cancels all searches that are currently in progress.
 void clearAllMatches()
          Clears all previously-found matches.
 void findAndHighlight(String text, Color color)
          Searches through the current document for instances of the given string, and highlights those matches with the given color.
 void findAndHighlight(String text, Color color, FindFlag[] flags)
          Searches through the current document for instances of the given string, and highlights those matches with the given color.
 void nextMatch()
          Selects the next match after the current selection, and scrolls it into view if necessary.
 void previousMatch()
          Selects the previous match before the current selection, and scrolls it into view if necessary.
 

Method Detail

findAndHighlight

void findAndHighlight(String text,
                      Color color)
Searches through the current document for instances of the given string, and highlights those matches with the given color.

This method always performs case-sensitive matching. For case-insensitive matching, pass the appropriate flag to findAndHighlight(String, Color, FindFlag[]).

Parameters:
text - string to search for
color - color used to highlight matches
See Also:
findAndHighlight(String, Color, FindFlag[])

findAndHighlight

void findAndHighlight(String text,
                      Color color,
                      FindFlag[] flags)
Searches through the current document for instances of the given string, and highlights those matches with the given color.

Searching is case-sensitive by default. The following calls are all equivalent, and will perform a case-sensitive search:

 findService.findAndHighlight("needle", Color.RED, null);
 findService.findAndHighlight("needle", Color.RED, new FindFlag[0]);
 findService.findAndHighlight("needle", Color.RED, new FindFlag[] {});
 

To perform a case-insensitive search, pass FindFlag.IGNORE_CASE as a flag. For example, the following call will find treasure, Treasure, TREASURE, and other variations:

 FindFlag[] flags = { FindFlag.IGNORE_CASE };
 findService.findAndHighlight("treasure", Color.YELLOW, flags);
 

Parameters:
text - string to search for
color - color used to highlight matches
flags - array of flags used to customize the search process, or null to specify no flags
See Also:
FindFlag.IGNORE_CASE, findAndHighlight(String, Color)

cancelAllSearches

void cancelAllSearches()
Cancels all searches that are currently in progress. This is useful if findAndHighlight(String, Color, FindFlag[]) is taking too long.

Any matches that have already been found will still be highlighted.


clearAllMatches

void clearAllMatches()
Clears all previously-found matches. Those matches will no longer be highlighted, and nextMatch() and previousMatch() will no longer navigate between them.

See Also:
findAndHighlight(String, Color, FindFlag[])

nextMatch

void nextMatch()
Selects the next match after the current selection, and scrolls it into view if necessary.

See Also:
previousMatch()

previousMatch

void previousMatch()
Selects the previous match before the current selection, and scrolls it into view if necessary.

See Also:
nextMatch()