/** * Returns a Searchable for this component, guaranteed to be not null. This * implementation lazily creates a TreeSearchable if necessary. * * * @return a not-null Searchable for this component. * * @see #setSearchable(Searchable) * @see org.jdesktop.swingx.search.TreeSearchable */ public Searchable getSearchable() { if (searchable == null) { searchable = new TreeSearchable(this); } return searchable; }
@Override protected void findMatchAndUpdateState(Pattern pattern, int startRow, boolean backwards) { SearchResult searchResult = null; if (backwards) { for (int index = startRow; index >= 0 && searchResult == null; index--) { searchResult = findMatchAt(pattern, index); } } else { for (int index = startRow; index < getSize() && searchResult == null; index++) { searchResult = findMatchAt(pattern, index); } } updateState(searchResult); }
/** * {@inheritDoc} */ @Override protected void moveMatchMarker() { if (markByHighlighter()) { moveMatchByHighlighter(); } else { // use selection moveMatchBySelection(); } }
/** * use and move the match highlighter. PRE: markByHighlighter * */ protected void moveMatchByHighlighter() { AbstractHighlighter searchHL = getConfiguredMatchHighlighter(); // no match if (!hasMatch()) { return; } else { ensureInsertedSearchHighlighters(searchHL); tree.scrollRowToVisible(lastSearchResult.foundRow); } }
protected void moveMatchBySelection() { // // the common behaviour (JXList, JXTable) is to not // // move the selection if not found if (!hasMatch()) { return; } tree.setSelectionRow(lastSearchResult.foundRow); tree.scrollRowToVisible(lastSearchResult.foundRow); }
@Override protected SearchResult findExtendedMatch(Pattern pattern, int row) { return findMatchAt(pattern, row); }
/** * Matches the cell content at row/col against the given Pattern. Returns an * appropriate SearchResult if matching or null if no matching * * @param pattern * @param row a valid row index in view coordinates a valid column index in * view coordinates * @return an appropriate <code>SearchResult</code> if matching or null if * no matching */ protected SearchResult findMatchAt(Pattern pattern, int row) { String text = tree.getStringAt(row); if ((text != null) && (text.length() > 0)) { Matcher matcher = pattern.matcher(text); if (matcher.find()) { return createSearchResult(matcher, row, 0); } } return null; }
/** * use and move the match highlighter. PRE: markByHighlighter * */ protected void moveMatchByHighlighter() { AbstractHighlighter searchHL = getConfiguredMatchHighlighter(); // no match if (!hasMatch()) { return; } else { ensureInsertedSearchHighlighters(searchHL); tree.scrollRowToVisible(lastSearchResult.foundRow); } }
protected void moveMatchBySelection() { // // the common behaviour (JXList, JXTable) is to not // // move the selection if not found if (!hasMatch()) { return; } tree.setSelectionRow(lastSearchResult.foundRow); tree.scrollRowToVisible(lastSearchResult.foundRow); }
@Override protected SearchResult findExtendedMatch(Pattern pattern, int row) { return findMatchAt(pattern, row); }
/** * Matches the cell content at row/col against the given Pattern. Returns an * appropriate SearchResult if matching or null if no matching * * @param pattern * @param row a valid row index in view coordinates a valid column index in * view coordinates * @return an appropriate <code>SearchResult</code> if matching or null if * no matching */ protected SearchResult findMatchAt(Pattern pattern, int row) { String text = tree.getStringAt(row); if ((text != null) && (text.length() > 0)) { Matcher matcher = pattern.matcher(text); if (matcher.find()) { return createSearchResult(matcher, row, 0); } } return null; }
/** * {@inheritDoc} */ @Override protected void moveMatchMarker() { if (markByHighlighter()) { moveMatchByHighlighter(); } else { // use selection moveMatchBySelection(); } }
/** * use and move the match highlighter. PRE: markByHighlighter * */ protected void moveMatchByHighlighter() { AbstractHighlighter searchHL = getConfiguredMatchHighlighter(); // no match if (!hasMatch()) { return; } else { ensureInsertedSearchHighlighters(searchHL); tree.scrollRowToVisible(lastSearchResult.foundRow); } }
@Override protected void findMatchAndUpdateState(Pattern pattern, int startRow, boolean backwards) { SearchResult searchResult = null; if (backwards) { for (int index = startRow; index >= 0 && searchResult == null; index--) { searchResult = findMatchAt(pattern, index); } } else { for (int index = startRow; index < getSize() && searchResult == null; index++) { searchResult = findMatchAt(pattern, index); } } updateState(searchResult); }
protected void moveMatchBySelection() { // // the common behaviour (JXList, JXTable) is to not // // move the selection if not found if (!hasMatch()) { return; } tree.setSelectionRow(lastSearchResult.foundRow); tree.scrollRowToVisible(lastSearchResult.foundRow); }
@Override protected SearchResult findExtendedMatch(Pattern pattern, int row) { return findMatchAt(pattern, row); }
/** * Returns a Searchable for this component, guaranteed to be not null. This * implementation lazily creates a TreeSearchable if necessary. * * * @return a not-null Searchable for this component. * * @see #setSearchable(Searchable) * @see org.jdesktop.swingx.search.TreeSearchable */ public Searchable getSearchable() { if (searchable == null) { searchable = new TreeSearchable(this); } return searchable; }
/** * Matches the cell content at row/col against the given Pattern. Returns an * appropriate SearchResult if matching or null if no matching * * @param pattern * @param row a valid row index in view coordinates a valid column index in * view coordinates * @return an appropriate <code>SearchResult</code> if matching or null if * no matching */ protected SearchResult findMatchAt(Pattern pattern, int row) { String text = tree.getStringAt(row); if ((text != null) && (text.length() > 0)) { Matcher matcher = pattern.matcher(text); if (matcher.find()) { return createSearchResult(matcher, row, 0); } } return null; }
/** * {@inheritDoc} */ @Override protected void moveMatchMarker() { if (markByHighlighter()) { moveMatchByHighlighter(); } else { // use selection moveMatchBySelection(); } }
/** * use and move the match highlighter. * PRE: markByHighlighter * */ protected void moveMatchByHighlighter() { AbstractHighlighter searchHL = getConfiguredMatchHighlighter(); // no match if (!hasMatch()) { return; } else { ensureInsertedSearchHighlighters(searchHL); tree.scrollRowToVisible(lastSearchResult.foundRow); } }