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
public class RTextAreaHighlighter extends BasicTextUI.BasicHighlighter
The highlighter implementation used byRTextArea
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RTextAreaHighlighter.HighlightInfo
Information about a highlight being painted by this highlighter.protected static class
RTextAreaHighlighter.HighlightInfoImpl
A straightforward implementation ofHighlightInfo
.static interface
RTextAreaHighlighter.LayeredHighlightInfo
Information about a layered highlight being painted by this highlighter.protected static class
RTextAreaHighlighter.LayeredHighlightInfoImpl
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
Fields Modifier and Type Field Description protected RTextArea
textArea
The text component we are the highlighter for.-
Fields inherited from class javax.swing.text.DefaultHighlighter
DefaultPainter
-
-
Constructor Summary
Constructors Constructor Description RTextAreaHighlighter()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deinstall(JTextComponent c)
int
getMarkAllHighlightCount()
Returns the number of "mark all" highlights currently shown in the editor.List<DocumentRange>
getMarkAllHighlightRanges()
Returns a list of "mark all" highlights in the text area.void
install(JTextComponent c)
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
repaintListHighlight(RTextAreaHighlighter.HighlightInfo info)
-
Methods inherited from class javax.swing.text.DefaultHighlighter
addHighlight, changeHighlight, getDrawsLayeredHighlights, getHighlights, paint, removeAllHighlights, removeHighlight, setDrawsLayeredHighlights
-
-
-
-
Field Detail
-
textArea
protected RTextArea textArea
The text component we are the highlighter for.
-
-
Method Detail
-
deinstall
public void deinstall(JTextComponent c)
- 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
public List<DocumentRange> 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
public void install(JTextComponent c)
- 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
protected void repaintListHighlight(RTextAreaHighlighter.HighlightInfo info)
-
-