|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.search.AbstractSearchable
org.jdesktop.swingx.search.TableSearchable
public class TableSearchable
An Searchable implementation for use in JXTable.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jdesktop.swingx.search.AbstractSearchable |
---|
AbstractSearchable.SearchResult |
Field Summary | |
---|---|
protected JXTable |
table
The target JXTable. |
Fields inherited from class org.jdesktop.swingx.search.AbstractSearchable |
---|
lastSearchResult, MATCH_HIGHLIGHTER |
Constructor Summary | |
---|---|
TableSearchable(JXTable table)
Instantiates a TableSearchable with the given table as target. |
Method Summary | |
---|---|
protected void |
addHighlighter(Highlighter highlighter)
Adds the highlighter to the target. |
protected int |
adjustStartPosition(int startIndex,
boolean backwards)
Called if startIndex is different from last search
and make sure a backwards/forwards search starts at last/first row,
respectively. |
protected int |
convertColumnIndexToModel(int viewColumn)
Converts and returns the given column index from view coordinates to model coordinates. |
protected AbstractSearchable.SearchResult |
findExtendedMatch(Pattern pattern,
int row)
Matches the cell at row/lastFoundColumn against the pattern. |
protected void |
findMatchAndUpdateState(Pattern pattern,
int startRow,
boolean backwards)
Loops through the searchable until a match is found or the end is reached. |
protected AbstractSearchable.SearchResult |
findMatchAt(Pattern pattern,
int row,
int column)
Matches the cell content at row/col against the given Pattern. |
protected Highlighter[] |
getHighlighters()
Returns the highlighters registered on the search target. |
protected int |
getSize()
Returns the size of this searchable. |
JXTable |
getTarget()
It's the responsibility of subclasses to covariant override. |
protected boolean |
isEqualStartIndex(int startIndex)
Checks if the startIndex should be considered as the same as in the previous search. |
protected void |
moveMatchByHighlighter()
Configures the match highlighter to the current match. |
protected void |
moveMatchBySelection()
Moves the row selection to the matching cell and ensures its visibility, if any. |
protected void |
moveMatchMarker()
Moves the match marker according to current found state. |
protected int |
moveStartPosition(int startRow,
boolean backwards)
Moves the internal start position for matching as appropriate and returns the new startIndex to use. |
protected void |
removeHighlighter(Highlighter searchHighlighter)
Removes the highlighter. |
Methods inherited from class org.jdesktop.swingx.search.AbstractSearchable |
---|
createMatchHighlighter, createMatchPredicate, createSearchResult, doSearch, ensureInsertedSearchHighlighters, getConfiguredMatchHighlighter, getMatchHighlighter, hasMatch, isEmpty, isEqualPattern, isTrivialNoMatch, isValidIndex, markByHighlighter, search, search, search, search, search, search, setMatchHighlighter, updateState |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JXTable table
Constructor Detail |
---|
public TableSearchable(JXTable table)
table
- the JXTable to search.Method Detail |
---|
protected void findMatchAndUpdateState(Pattern pattern, int startRow, boolean backwards)
This implementation loops through the cells in a row to find a match.
findMatchAndUpdateState
in class AbstractSearchable
pattern
- Pattern
that 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
- true
if we should perform search towards the beginningprotected AbstractSearchable.SearchResult findExtendedMatch(Pattern pattern, int row)
Implemented to search for an extension in the cell given by row and foundColumn.
findExtendedMatch
in class AbstractSearchable
pattern
- Pattern
that we will try to matchrow
- position at which we will get the value to match with the provided Pattern
AbstractSearchable.SearchResult
protected AbstractSearchable.SearchResult findMatchAt(Pattern pattern, int row, int column)
pattern
- Pattern
that we will try to locaterow
- a valid row index in view coordinatescolumn
- a valid column index in view coordinates
SearchResult
if matching or nullprotected int adjustStartPosition(int startIndex, boolean backwards)
startIndex
is different from last search
and make sure a backwards/forwards search starts at last/first row,
respectively.
Overridden to adjust the column index to -1.
adjustStartPosition
in class AbstractSearchable
startIndex
- position in the document in the appropriate coordinates
from which we will start search or -1 to start from the beginningbackwards
- true
if we should perform search from towards the beginning
startIndex
protected int moveStartPosition(int startRow, boolean backwards)
This implementation returns a by 1 decremented/incremented startIndex depending on backwards true/false, respectively.
Overridden to loop through all columns in a row.
moveStartPosition
in class AbstractSearchable
startRow
- position in the document in the appropriate coordinates
from which we will start search or -1 to start from the beginningbackwards
- true
if we should perform search towards the beginning
startIndex
protected boolean isEqualStartIndex(int startIndex)
Overridden to check the column index of last find.
isEqualStartIndex
in class AbstractSearchable
startIndex
- startIndex
that we will compare with the index
stored by the previous search request
protected int getSize()
getSize
in class AbstractSearchable
public JXTable getTarget()
getTarget
in class AbstractSearchable
protected void moveMatchByHighlighter()
protected int convertColumnIndexToModel(int viewColumn)
This implementation returns the view coordinate, that is assumes that both coordinate systems are the same.
Overridden to convert the column index in the table's view coordinate system to model coordinate.
PENDING JW: this is only necessary because the SearchPredicate wants its highlight column in model coordinates. But code comments in the SearchPredicate seem to indicate that we probably want to revise that (legacy?).
convertColumnIndexToModel
in class AbstractSearchable
viewColumn
- the column index in view coordinates, must be a valid index
in that system.
protected void moveMatchBySelection()
protected void moveMatchMarker()
moveMatchMarker
in class AbstractSearchable
protected void removeHighlighter(Highlighter searchHighlighter)
removeHighlighter
in class AbstractSearchable
searchHighlighter
- the Highlighter to remove.protected Highlighter[] getHighlighters()
getHighlighters
in class AbstractSearchable
protected void addHighlighter(Highlighter highlighter)
addHighlighter
in class AbstractSearchable
highlighter
- the Highlighter to add.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |