Class JXEditorPane.DocumentSearchable

java.lang.Object
org.jdesktop.swingx.JXEditorPane.DocumentSearchable
All Implemented Interfaces:
Searchable
Enclosing class:
JXEditorPane

public class JXEditorPane.DocumentSearchable extends Object implements Searchable
A Searchable implementation for Documents.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    isEmpty(String searchString)
    checks if the searchString should be interpreted as empty.
    int
    search(String searchString)
    Search searchString from the beginning of a document.
    int
    search(String searchString, int columnIndex)
    Search searchString from the given position in a document.
    int
    search(String searchString, int columnIndex, boolean backward)
    Search searchString in the given direction from the some position in a document.
    int
    search(Pattern pattern)
    Search for the pattern from the beginning of the document.
    int
    search(Pattern pattern, int startIndex)
    Search for the pattern from the start index.
    int
    search(Pattern pattern, int startIndex, boolean backwards)
    Search for the pattern from the start index.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DocumentSearchable

      public DocumentSearchable()
  • Method Details

    • search

      public int search(String searchString)
      Search searchString from the beginning of a document.
      Specified by:
      search in interface Searchable
      Parameters:
      searchString - String we should find in a document.
      Returns:
      index of matched String or -1 if a match cannot be found.
    • search

      public int search(String searchString, int columnIndex)
      Search searchString from the given position in a document.
      Specified by:
      search in interface Searchable
      Parameters:
      searchString - String we should find in a document.
      columnIndex - Start position in a document or -1 if we want to search from the beginning.
      Returns:
      index of matched String or -1 if a match cannot be found.
    • search

      public int search(String searchString, int columnIndex, boolean backward)
      Search searchString in the given direction from the some position in a document.
      Specified by:
      search in interface Searchable
      Parameters:
      searchString - String we should find in a document.
      columnIndex - Start position in a document or -1 if we want to search from the beginning.
      backward - Indicates search direction, will search from the given position towards the beginning of a document if this parameter is true.
      Returns:
      index of matched String or -1 if a match cannot be found.
    • isEmpty

      protected boolean isEmpty(String searchString)
      checks if the searchString should be interpreted as empty. here: returns true if string is null or has zero length. TODO: This should be in a utility class.
      Parameters:
      searchString - String
      Returns:
      true if string is null or has zero length
    • search

      public int search(Pattern pattern)
      Search for the pattern from the beginning of the document.
      Specified by:
      search in interface Searchable
      Parameters:
      pattern - Pattern for search
      Returns:
      index of matched Pattern or -1 if a match cannot be found.
    • search

      public int search(Pattern pattern, int startIndex)
      Search for the pattern from the start index.
      Specified by:
      search in interface Searchable
      Parameters:
      pattern - Pattern for search
      startIndex - starting index of search. If -1 then start from the beginning
      Returns:
      index of matched pattern or -1 if a match cannot be found.
    • search

      public int search(Pattern pattern, int startIndex, boolean backwards)
      Search for the pattern from the start index.
      Specified by:
      search in interface Searchable
      Parameters:
      pattern - Pattern for search
      startIndex - starting index of search. If -1 then start from the beginning
      backwards - indicates the direction if true then search is backwards
      Returns:
      index of matched pattern or -1 if a match cannot be found.