Class TableSearchable

    • Field Detail

    • Constructor Detail

      • TableSearchable

        public TableSearchable​(JXTable table)
        Parameters:
        table -
    • Method Detail

      • findMatchAndUpdateState

        protected void findMatchAndUpdateState​(java.util.regex.Pattern pattern,
                                               int startRow,
                                               boolean backwards)
        Description copied from class: AbstractSearchable
        Loops through the searchable until a match is found or the end is reached. Updates internal search state.
        Specified by:
        findMatchAndUpdateState in class AbstractSearchable
        Parameters:
        pattern - Pattern that we will try to locate
        startRow - position in the document in the appropriate coordinates from which we will start search or -1 to start from the beginning
        backwards - true if we should perform search towards the beginning
      • findExtendedMatch

        protected AbstractSearchable.SearchResult findExtendedMatch​(java.util.regex.Pattern pattern,
                                                                    int row)
        called if sameRowIndex && !hasEqualRegEx. Matches the cell at row/lastFoundColumn against the pattern. PRE: lastFoundColumn valid.
        Specified by:
        findExtendedMatch in class AbstractSearchable
        Parameters:
        pattern -
        row -
        Returns:
        an appropriate SearchResult if matching or null
      • findMatchAt

        protected AbstractSearchable.SearchResult findMatchAt​(java.util.regex.Pattern pattern,
                                                              int row,
                                                              int column)
        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
        column - a valid column index in view coordinates
        Returns:
        an appropriate SearchResult if matching or null
      • adjustStartPosition

        protected int adjustStartPosition​(int startIndex,
                                          boolean backwards)
        Called if startIndex is different from last search, reset the column to -1 and make sure a backwards/forwards search starts at last/first row, respectively.
        Overrides:
        adjustStartPosition in class AbstractSearchable
        Parameters:
        startIndex -
        backwards -
        Returns:
        adjusted startIndex
      • moveStartPosition

        protected int moveStartPosition​(int startRow,
                                        boolean backwards)
        Moves the internal start for matching as appropriate and returns the new startIndex to use. Called if search was messaged with the same startIndex as previously.
        Overrides:
        moveStartPosition in class AbstractSearchable
        Parameters:
        startRow -
        backwards -
        Returns:
        new start index to use
      • isEqualStartIndex

        protected boolean isEqualStartIndex​(int startIndex)
        Checks if the startIndex is a candidate for trying a re-match.
        Overrides:
        isEqualStartIndex in class AbstractSearchable
        Parameters:
        startIndex -
        Returns:
        true if the startIndex should be re-matched, false if not.
      • moveMatchByHighlighter

        protected void moveMatchByHighlighter()
        use and move the match highlighter. PRE: markByHighlighter
      • getConfiguredMatchHighlighter

        protected AbstractHighlighter getConfiguredMatchHighlighter()
        Returns:
        a highlighter configured for matching
      • hasMatch

        protected boolean hasMatch​(AbstractSearchable.SearchResult result)
        Parameters:
        result -
        Returns:
        true if the result contains a match; false otherwise
      • moveMatchBySelection

        protected void moveMatchBySelection()
      • markByHighlighter

        protected boolean markByHighlighter()
      • getMatchHighlighter

        protected AbstractHighlighter getMatchHighlighter()
        Returns:
        a highlighter used for matching
      • createMatchHighlighter

        protected AbstractHighlighter createMatchHighlighter()
        Returns:
        a highlighter used for matching