Package org.fife.ui.rtextarea
Class RTextAreaHighlighter
java.lang.Object
javax.swing.text.LayeredHighlighter
javax.swing.text.DefaultHighlighter
javax.swing.plaf.basic.BasicTextUI.BasicHighlighter
org.fife.ui.rtextarea.RTextAreaHighlighter
- All Implemented Interfaces:
UIResource
,Highlighter
- Direct Known Subclasses:
RSyntaxTextAreaHighlighter
The highlighter implementation used by
RTextArea
s. It knows to
always paint "mark all" highlights below selection highlights.Most of this code is copied from javax.swing.text.DefaultHighlighter; unfortunately, we cannot re-use much of it since it is package private.
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Information about a highlight being painted by this highlighter.protected static class
A straightforward implementation ofHighlightInfo
.static interface
Information about a layered highlight being painted by this highlighter.protected static class
A straightforward implementation ofHighlightInfo
for painting layered highlights.Nested classes/interfaces inherited from class javax.swing.text.DefaultHighlighter
DefaultHighlighter.DefaultHighlightPainter
Nested classes/interfaces inherited from class javax.swing.text.LayeredHighlighter
LayeredHighlighter.LayerPainter
Nested classes/interfaces inherited from interface javax.swing.text.Highlighter
Highlighter.Highlight, Highlighter.HighlightPainter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List
<RTextAreaHighlighter.HighlightInfo> The "mark all" highlights (to be painted separately from other highlights).protected RTextArea
The text component we are the highlighter for.Fields inherited from class javax.swing.text.DefaultHighlighter
DefaultPainter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) Object
addMarkAllHighlight
(int start, int end, Highlighter.HighlightPainter p) Adds a special "marked occurrence" highlight.(package private) void
Removes all "mark all" highlights from the view.void
int
Returns the number of "mark all" highlights currently shown in the editor.Returns a list of "mark all" highlights in the text area.void
void
paintLayeredHighlights
(Graphics g, int lineStart, int lineEnd, Shape viewBounds, JTextComponent editor, View view) When leaf Views (such as LabelView) are rendering they should call into this method.protected void
paintListLayered
(Graphics g, int lineStart, int lineEnd, Shape viewBounds, JTextComponent editor, View view, List<? extends RTextAreaHighlighter.HighlightInfo> highlights) protected void
Methods inherited from class javax.swing.text.DefaultHighlighter
addHighlight, changeHighlight, getDrawsLayeredHighlights, getHighlights, paint, removeAllHighlights, removeHighlight, setDrawsLayeredHighlights
-
Field Details
-
textArea
The text component we are the highlighter for. -
markAllHighlights
The "mark all" highlights (to be painted separately from other highlights).
-
-
Constructor Details
-
RTextAreaHighlighter
public RTextAreaHighlighter()Constructor.
-
-
Method Details
-
addMarkAllHighlight
Object addMarkAllHighlight(int start, int end, Highlighter.HighlightPainter p) throws BadLocationException Adds a special "marked occurrence" highlight.- Parameters:
start
- The start offset of the highlight.end
- The end offset of the highlight.p
- The highlight painter.- Returns:
- A tag to reference the highlight later.
- Throws:
BadLocationException
- If one of the offsets specified is invalid.- See Also:
-
clearMarkAllHighlights
void clearMarkAllHighlights()Removes all "mark all" highlights from the view.- See Also:
-
deinstall
- Specified by:
deinstall
in interfaceHighlighter
- Overrides:
deinstall
in classDefaultHighlighter
-
getMarkAllHighlightCount
public int getMarkAllHighlightCount()Returns the number of "mark all" highlights currently shown in the editor.- Returns:
- The "mark all" highlight count.
-
getMarkAllHighlightRanges
Returns a list of "mark all" highlights in the text area. If there are no such highlights, this will be an empty list.- Returns:
- The list of "mark all" highlight ranges.
-
install
- Specified by:
install
in interfaceHighlighter
- Overrides:
install
in classDefaultHighlighter
-
paintLayeredHighlights
public void paintLayeredHighlights(Graphics g, int lineStart, int lineEnd, Shape viewBounds, JTextComponent editor, View view) When leaf Views (such as LabelView) are rendering they should call into this method. If a highlight is in the given region it will be drawn immediately.- Overrides:
paintLayeredHighlights
in classDefaultHighlighter
- Parameters:
g
- Graphics used to drawlineStart
- starting offset of viewlineEnd
- ending offset of viewviewBounds
- Bounds of Vieweditor
- JTextComponentview
- View instance being rendered
-
paintListLayered
protected void paintListLayered(Graphics g, int lineStart, int lineEnd, Shape viewBounds, JTextComponent editor, View view, List<? extends RTextAreaHighlighter.HighlightInfo> highlights) -
repaintListHighlight
-