Package io.github.jonestimd.swing
Class HtmlHighlighter
- java.lang.Object
-
- io.github.jonestimd.swing.HtmlHighlighter
-
- All Implemented Interfaces:
Highlighter
public class HtmlHighlighter extends java.lang.Object implements Highlighter
Highlights occurrences of values in a string by wrapping them with a HTML tag.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
HtmlHighlighter.Range
-
Field Summary
-
Fields inherited from interface io.github.jonestimd.swing.table.Highlighter
NOOP_HIGHLIGHTER
-
-
Constructor Summary
Constructors Constructor Description HtmlHighlighter(java.lang.String startTag, java.lang.String endTag)
Create a highlighter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<HtmlHighlighter.Range>
findMatches(java.lang.String lowerValue, java.util.Collection<java.lang.String> highlightText)
java.lang.String
highlight(java.lang.String value, java.util.Collection<java.lang.String> highlightText)
Apply highlighting to a string.protected java.lang.String
highlightRanges(java.lang.String value, java.util.Set<HtmlHighlighter.Range> ranges)
-
-
-
Method Detail
-
highlight
public java.lang.String highlight(java.lang.String value, java.util.Collection<java.lang.String> highlightText)
Description copied from interface:Highlighter
Apply highlighting to a string.- Specified by:
highlight
in interfaceHighlighter
- Parameters:
value
- the string to highlighthighlightText
- the substrings to highlight withinvalue
- Returns:
- an HTML string with values in
highlightText
wrapped by the start and end tags.
-
highlightRanges
protected java.lang.String highlightRanges(java.lang.String value, java.util.Set<HtmlHighlighter.Range> ranges)
-
findMatches
protected java.util.Set<HtmlHighlighter.Range> findMatches(java.lang.String lowerValue, java.util.Collection<java.lang.String> highlightText)
-
-