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:
javax.swing.plaf.UIResource,javax.swing.text.Highlighter
- Direct Known Subclasses:
RSyntaxTextAreaHighlighter
public class RTextAreaHighlighter extends javax.swing.plaf.basic.BasicTextUI.BasicHighlighterThe highlighter implementation used byRTextAreas. 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 Classes Modifier and Type Class Description static interfaceRTextAreaHighlighter.HighlightInfoInformation about a highlight being painted by this highlighter.protected static classRTextAreaHighlighter.HighlightInfoImplA straightforward implementation ofHighlightInfo.static interfaceRTextAreaHighlighter.LayeredHighlightInfoInformation about a layered highlight being painted by this highlighter.protected static classRTextAreaHighlighter.LayeredHighlightInfoImplA straightforward implementation ofHighlightInfofor painting layered highlights.-
Nested classes/interfaces inherited from class javax.swing.text.DefaultHighlighter
javax.swing.text.DefaultHighlighter.DefaultHighlightPainter
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<RTextAreaHighlighter.HighlightInfo>markAllHighlightsThe "mark all" highlights (to be painted separately from other highlights).protected RTextAreatextAreaThe text component we are the highlighter for.
-
Constructor Summary
Constructors Constructor Description RTextAreaHighlighter()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.ObjectaddMarkAllHighlight(int start, int end, javax.swing.text.Highlighter.HighlightPainter p)Adds a special "marked occurrence" highlight.(package private) voidclearMarkAllHighlights()Removes all "mark all" highlights from the view.voiddeinstall(javax.swing.text.JTextComponent c)intgetMarkAllHighlightCount()Returns the number of "mark all" highlights currently shown in the editor.java.util.List<DocumentRange>getMarkAllHighlightRanges()Returns a list of "mark all" highlights in the text area.voidinstall(javax.swing.text.JTextComponent c)voidpaintLayeredHighlights(java.awt.Graphics g, int lineStart, int lineEnd, java.awt.Shape viewBounds, javax.swing.text.JTextComponent editor, javax.swing.text.View view)When leaf Views (such as LabelView) are rendering they should call into this method.protected voidpaintListLayered(java.awt.Graphics g, int lineStart, int lineEnd, java.awt.Shape viewBounds, javax.swing.text.JTextComponent editor, javax.swing.text.View view, java.util.List<? extends RTextAreaHighlighter.HighlightInfo> highlights)protected voidrepaintListHighlight(RTextAreaHighlighter.HighlightInfo info)
-
-
-
Field Detail
-
textArea
protected RTextArea textArea
The text component we are the highlighter for.
-
markAllHighlights
private java.util.List<RTextAreaHighlighter.HighlightInfo> markAllHighlights
The "mark all" highlights (to be painted separately from other highlights).
-
-
Method Detail
-
addMarkAllHighlight
java.lang.Object addMarkAllHighlight(int start, int end, javax.swing.text.Highlighter.HighlightPainter p) throws javax.swing.text.BadLocationExceptionAdds 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:
javax.swing.text.BadLocationException- If one of the offsets specified is invalid.- See Also:
clearMarkAllHighlights()
-
clearMarkAllHighlights
void clearMarkAllHighlights()
Removes all "mark all" highlights from the view.
-
deinstall
public void deinstall(javax.swing.text.JTextComponent c)
- Specified by:
deinstallin interfacejavax.swing.text.Highlighter- Overrides:
deinstallin classjavax.swing.text.DefaultHighlighter
-
getMarkAllHighlightCount
public int getMarkAllHighlightCount()
Returns the number of "mark all" highlights currently shown in the editor.- Returns:
- The "mark all" highlight count.
-
getMarkAllHighlightRanges
public java.util.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(javax.swing.text.JTextComponent c)
- Specified by:
installin interfacejavax.swing.text.Highlighter- Overrides:
installin classjavax.swing.text.DefaultHighlighter
-
paintLayeredHighlights
public void paintLayeredHighlights(java.awt.Graphics g, int lineStart, int lineEnd, java.awt.Shape viewBounds, javax.swing.text.JTextComponent editor, javax.swing.text.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:
paintLayeredHighlightsin classjavax.swing.text.DefaultHighlighter- 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(java.awt.Graphics g, int lineStart, int lineEnd, java.awt.Shape viewBounds, javax.swing.text.JTextComponent editor, javax.swing.text.View view, java.util.List<? extends RTextAreaHighlighter.HighlightInfo> highlights)
-
repaintListHighlight
protected void repaintListHighlight(RTextAreaHighlighter.HighlightInfo info)
-
-