Package org.jdesktop.swingx.search
Class TreeSearchable
java.lang.Object
org.jdesktop.swingx.search.AbstractSearchable
org.jdesktop.swingx.search.TreeSearchable
- All Implemented Interfaces:
Searchable
A searchable targetting the visible rows of a JXTree.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jdesktop.swingx.search.AbstractSearchable
AbstractSearchable.SearchResult -
Field Summary
FieldsFields inherited from class org.jdesktop.swingx.search.AbstractSearchable
lastSearchResult, MATCH_HIGHLIGHTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddHighlighter(Highlighter highlighter) Adds the highlighter to the target.protected AbstractSearchable.SearchResultfindExtendedMatch(Pattern pattern, int row) Matches the cell at row/lastFoundColumn against the pattern.protected voidfindMatchAndUpdateState(Pattern pattern, int startRow, boolean backwards) Loops through the searchable until a match is found or the end is reached.protected AbstractSearchable.SearchResultfindMatchAt(Pattern pattern, int row) Matches the cell content at row/col against the given Pattern.protected Highlighter[]Returns the highlighters registered on the search target.protected intgetSize()Returns the size of this searchable.It's the responsibility of subclasses to covariant override.protected voiduse and move the match highlighter.protected voidprotected voidMoves the match marker according to current found state.protected voidremoveHighlighter(Highlighter searchHighlighter) Removes the highlighter.Methods inherited from class org.jdesktop.swingx.search.AbstractSearchable
adjustStartPosition, convertColumnIndexToModel, createMatchHighlighter, createMatchPredicate, createSearchResult, doSearch, ensureInsertedSearchHighlighters, getConfiguredMatchHighlighter, getMatchHighlighter, hasMatch, isEmpty, isEqualPattern, isEqualStartIndex, isTrivialNoMatch, isValidIndex, markByHighlighter, moveStartPosition, search, search, search, search, search, search, setMatchHighlighter, updateState
-
Field Details
-
tree
-
-
Constructor Details
-
TreeSearchable
Instantiates a Searchable for the given JTree.- Parameters:
tree- the JTree to search, must not be null.
-
-
Method Details
-
findMatchAndUpdateState
Description copied from class:AbstractSearchableLoops through the searchable until a match is found or the end is reached. Updates internal search state.- Specified by:
findMatchAndUpdateStatein classAbstractSearchable- Parameters:
pattern-Patternthat we will try to locatestartRow- 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
-
findExtendedMatch
Description copied from class:AbstractSearchableMatches the cell at row/lastFoundColumn against the pattern. Called if sameRowIndex && !hasEqualRegEx. PRE: lastFoundColumn valid.- Specified by:
findExtendedMatchin classAbstractSearchable- Parameters:
pattern-Patternthat we will try to matchrow- position at which we will get the value to match with the providedPattern- Returns:
- result of the match;
AbstractSearchable.SearchResult
-
findMatchAt
Matches the cell content at row/col against the given Pattern. Returns an appropriate SearchResult if matching or null if no matching- Parameters:
pattern-row- a valid row index in view coordinates a valid column index in view coordinates- Returns:
- an appropriate
SearchResultif matching or null if no matching
-
getSize
protected int getSize()Description copied from class:AbstractSearchableReturns the size of this searchable.- Specified by:
getSizein classAbstractSearchable- Returns:
- size of this searchable
-
getTarget
It's the responsibility of subclasses to covariant override.- Specified by:
getTargetin classAbstractSearchable- Returns:
- the target component
-
moveMatchMarker
protected void moveMatchMarker()Moves the match marker according to current found state.- Specified by:
moveMatchMarkerin classAbstractSearchable
-
moveMatchBySelection
protected void moveMatchBySelection() -
moveMatchByHighlighter
protected void moveMatchByHighlighter()use and move the match highlighter. PRE: markByHighlighter -
removeHighlighter
Description copied from class:AbstractSearchableRemoves the highlighter.- Specified by:
removeHighlighterin classAbstractSearchable- Parameters:
searchHighlighter-
-
getHighlighters
Description copied from class:AbstractSearchableReturns the highlighters registered on the search target.- Specified by:
getHighlightersin classAbstractSearchable- Returns:
- all registered highlighters
-
addHighlighter
Description copied from class:AbstractSearchableAdds the highlighter to the target.- Specified by:
addHighlighterin classAbstractSearchable- Parameters:
highlighter-
-