org.fife.ui.rsyntaxtextarea
Class RSyntaxTextAreaHighlighter

java.lang.Object
  extended by javax.swing.text.LayeredHighlighter
      extended by javax.swing.text.DefaultHighlighter
          extended by javax.swing.plaf.basic.BasicTextUI.BasicHighlighter
              extended by org.fife.ui.rtextarea.RTextAreaHighlighter
                  extended by org.fife.ui.rsyntaxtextarea.RSyntaxTextAreaHighlighter
All Implemented Interfaces:
javax.swing.plaf.UIResource, javax.swing.text.Highlighter

public class RSyntaxTextAreaHighlighter
extends RTextAreaHighlighter

The highlighter implementation used by RSyntaxTextAreas. It knows to always paint "marked occurrences" highlights below selection highlights, and squiggle underline highlights above all other 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
Author:
Robert Futrell

Nested Class Summary
 
Nested classes/interfaces inherited from class org.fife.ui.rtextarea.RTextAreaHighlighter
RTextAreaHighlighter.HighlightInfo, RTextAreaHighlighter.HighlightInfoImpl, RTextAreaHighlighter.LayeredHighlightInfo, RTextAreaHighlighter.LayeredHighlightInfoImpl
 
Nested classes/interfaces inherited from class javax.swing.text.DefaultHighlighter
javax.swing.text.DefaultHighlighter.DefaultHighlightPainter
 
Nested classes/interfaces inherited from class javax.swing.text.LayeredHighlighter
javax.swing.text.LayeredHighlighter.LayerPainter
 
Nested classes/interfaces inherited from interface javax.swing.text.Highlighter
javax.swing.text.Highlighter.Highlight, javax.swing.text.Highlighter.HighlightPainter
 
Field Summary
 
Fields inherited from class org.fife.ui.rtextarea.RTextAreaHighlighter
textArea
 
Fields inherited from class javax.swing.text.DefaultHighlighter
DefaultPainter
 
Constructor Summary
RSyntaxTextAreaHighlighter()
          Constructor.
 
Method Summary
 void clearParserHighlights(Parser parser)
          Removes all of the highlights for a specific parser.
 void deinstall(javax.swing.text.JTextComponent c)
          
 java.util.List<DocumentRange> getMarkedOccurrences()
          Returns a list of "marked occurrences" in the text area.
 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.
 
Methods inherited from class org.fife.ui.rtextarea.RTextAreaHighlighter
getMarkAllHighlightCount, getMarkAllHighlightRanges, install, paintList, paintListLayered, repaintListHighlight
 
Methods inherited from class javax.swing.text.DefaultHighlighter
addHighlight, changeHighlight, getDrawsLayeredHighlights, getHighlights, paint, removeAllHighlights, removeHighlight, setDrawsLayeredHighlights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSyntaxTextAreaHighlighter

public RSyntaxTextAreaHighlighter()
Constructor.

Method Detail

clearParserHighlights

public void clearParserHighlights(Parser parser)
Removes all of the highlights for a specific parser.

Parameters:
parser - The parser.

deinstall

public void deinstall(javax.swing.text.JTextComponent c)

Specified by:
deinstall in interface javax.swing.text.Highlighter
Overrides:
deinstall in class RTextAreaHighlighter

getMarkedOccurrences

public java.util.List<DocumentRange> getMarkedOccurrences()
Returns a list of "marked occurrences" in the text area. If there are no marked occurrences, this will be an empty list.

Returns:
The list of marked occurrences, or an empty list if none. The contents of this list will be of type DocumentRange.

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)
Description copied from class: RTextAreaHighlighter
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 class RTextAreaHighlighter
Parameters:
g - Graphics used to draw
lineStart - starting offset of view
lineEnd - ending offset of view
viewBounds - Bounds of View
editor - JTextComponent
view - View instance being rendered