org.fife.ui.rtextarea
Class RTextAreaHighlighter

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
All Implemented Interfaces:
javax.swing.plaf.UIResource, javax.swing.text.Highlighter
Direct Known Subclasses:
RSyntaxTextAreaHighlighter

public class RTextAreaHighlighter
extends javax.swing.plaf.basic.BasicTextUI.BasicHighlighter

The highlighter implementation used by RTextAreas. 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
static interface RTextAreaHighlighter.HighlightInfo
          Information about a highlight being painted by this highlighter.
protected static class RTextAreaHighlighter.HighlightInfoImpl
          A straightforward implementation of HighlightInfo.
static interface RTextAreaHighlighter.LayeredHighlightInfo
          Information about a layered highlight being painted by this highlighter.
protected static class RTextAreaHighlighter.LayeredHighlightInfoImpl
          A straightforward implementation of HighlightInfo for painting layered highlights.
 
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
protected  RTextArea textArea
          The text component we are the highlighter for.
 
Fields inherited from class javax.swing.text.DefaultHighlighter
DefaultPainter
 
Constructor Summary
RTextAreaHighlighter()
          Constructor.
 
Method Summary
 void deinstall(javax.swing.text.JTextComponent c)
          
 int getMarkAllHighlightCount()
          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.
 void install(javax.swing.text.JTextComponent c)
          
 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.
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)
           
protected  void repaintListHighlight(RTextAreaHighlighter.HighlightInfo info)
           
 
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
 

Field Detail

textArea

protected RTextArea textArea
The text component we are the highlighter for.

Constructor Detail

RTextAreaHighlighter

public RTextAreaHighlighter()
Constructor.

Method Detail

deinstall

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

Specified by:
deinstall in interface javax.swing.text.Highlighter
Overrides:
deinstall in class javax.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:
install in interface javax.swing.text.Highlighter
Overrides:
install in class javax.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:
paintLayeredHighlights in class javax.swing.text.DefaultHighlighter
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

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)