org.jdesktop.swingx.search
Class AbstractSearchable
- java.lang.Object
-
- org.jdesktop.swingx.search.AbstractSearchable
-
- All Implemented Interfaces:
- Searchable
- Direct Known Subclasses:
- ListSearchable, TableSearchable, TreeSearchable
public abstract class AbstractSearchable extends java.lang.Object implements Searchable
An abstract implementation of Searchable supporting incremental search. Keeps internal state to represent the previous search result. For all methods taking a String as parameter: compiles the String to a Pattern as-is and routes to the central method taking a Pattern.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classAbstractSearchable.SearchResultA convenience class to hold search state.
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringMATCH_HIGHLIGHTERkey for client property to use SearchHighlighter as match marker.
-
Constructor Summary
Constructors Constructor and Description AbstractSearchable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract javax.swing.JComponentgetTarget()It's the responsibility of subclasses to covariant override.intsearch(java.util.regex.Pattern pattern)Performs a forward search starting at the beginning across the Searchable using the pattern;Pattern.intsearch(java.util.regex.Pattern pattern, int startIndex)Performs a forward search starting at the given startIndex using the Pattern;Pattern.intsearch(java.util.regex.Pattern pattern, int startIndex, boolean backwards)Performs a search starting at the given startIndex using the pattern;Pattern.intsearch(java.lang.String searchString)Performs a forward search starting at the beginning across the Searchable using String that represents a regex pattern;Pattern.intsearch(java.lang.String searchString, int startIndex)Performs a forward search starting at the given startIndex using String that represents a regex pattern;Pattern.intsearch(java.lang.String searchString, int startIndex, boolean backward)Performs a search starting at the given startIndex using String that represents a regex pattern;Pattern.voidsetMatchHighlighter(AbstractHighlighter hl)Sets the AbstractHighlighter to use as match marker, if enabled.
-
-
-
Field Detail
-
MATCH_HIGHLIGHTER
public static final java.lang.String MATCH_HIGHLIGHTER
key for client property to use SearchHighlighter as match marker.- See Also:
- Constant Field Values
-
-
Method Detail
-
search
public int search(java.lang.String searchString)
Performs a forward search starting at the beginning across the Searchable using String that represents a regex pattern;Pattern.- Specified by:
searchin interfaceSearchable- Parameters:
searchString-Stringthat we will try to locate- Returns:
- the position of the match in appropriate coordinates or -1 if no match found.
-
search
public int search(java.lang.String searchString, int startIndex)Performs a forward search starting at the given startIndex using String that represents a regex pattern;Pattern.- Specified by:
searchin interfaceSearchable- Parameters:
searchString-Stringthat we will try to locatestartIndex- position in the document in the appropriate coordinates from which we will start search or -1 to start from the beginning- Returns:
- the position of the match in appropriate coordinates or -1 if no match found.
-
search
public int search(java.lang.String searchString, int startIndex, boolean backward)Performs a search starting at the given startIndex using String that represents a regex pattern;Pattern. The search direction depends on the boolean parameter: forward/backward if false/true, respectively.- Specified by:
searchin interfaceSearchable- Parameters:
searchString-Stringthat we will try to locatestartIndex- position in the document in the appropriate coordinates from which we will start search or -1 to start from the beginningbackward-trueif we should perform search towards the beginning- Returns:
- the position of the match in appropriate coordinates or -1 if no match found.
-
search
public int search(java.util.regex.Pattern pattern)
Performs a forward search starting at the beginning across the Searchable using the pattern;Pattern.- Specified by:
searchin interfaceSearchable- Parameters:
pattern-Patternthat we will try to locate- Returns:
- the position of the match in appropriate coordinates or -1 if no match found.
-
search
public int search(java.util.regex.Pattern pattern, int startIndex)Performs a forward search starting at the given startIndex using the Pattern;Pattern.- Specified by:
searchin interfaceSearchable- Parameters:
pattern-Patternthat we will try to locatestartIndex- position in the document in the appropriate coordinates from which we will start search or -1 to start from the beginning- Returns:
- the position of the match in appropriate coordinates or -1 if no match found.
-
search
public int search(java.util.regex.Pattern pattern, int startIndex, boolean backwards)Performs a search starting at the given startIndex using the pattern;Pattern. The search direction depends on the boolean parameter: forward/backward if false/true, respectively.Updates visible and internal search state.
- Specified by:
searchin interfaceSearchable- Parameters:
pattern-Patternthat we will try to locatestartIndex- position in the document in the appropriate coordinates from which we will start search or -1 to start from the beginningbackwards-trueif we should perform search towards the beginning- Returns:
- the position of the match in appropriate coordinates or -1 if no match found.
-
getTarget
public abstract javax.swing.JComponent getTarget()
It's the responsibility of subclasses to covariant override.- Returns:
- the target component
-
setMatchHighlighter
public void setMatchHighlighter(AbstractHighlighter hl)
Sets the AbstractHighlighter to use as match marker, if enabled. A null value will re-install the default.- Parameters:
hl- the Highlighter to use as match marker.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG