com.bluemarsh.jswat.view
Class HighlightDrawLayer

java.lang.Object
  |
  +--com.bluemarsh.jswat.view.BasicDrawLayer
        |
        +--com.bluemarsh.jswat.view.HighlightDrawLayer
All Implemented Interfaces:
DrawLayer
Direct Known Subclasses:
SelectionDrawLayer

public class HighlightDrawLayer
extends BasicDrawLayer

Class HighlightDrawLayer is responsible for drawing the highlight on a particular region in the text area.

Author:
Nathan Fiedler

Field Summary
protected  java.awt.Color highlightColor
          Color used to highlight some area.
protected  int highlightEnd
          End of the text highlight.
protected  int highlightStart
          Start of the text highlight.
 
Fields inherited from class com.bluemarsh.jswat.view.BasicDrawLayer
active, extendsEOL
 
Fields inherited from interface com.bluemarsh.jswat.view.DrawLayer
PRIORITY_COLORIZER, PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SELECTION, PRIORITY_STEPPING
 
Constructor Summary
HighlightDrawLayer(java.awt.Color color)
          Constructs a HighlightDrawLayer to highlight using the given color.
 
Method Summary
 void setHighlight(int start, int end)
          Selects the text found between the specified start and end locations.
 int updateContext(DrawContext ctx, int offset)
          Update the draw context by setting colors, fonts and possibly other draw properties.
 
Methods inherited from class com.bluemarsh.jswat.view.BasicDrawLayer
extendsEOL, isActive, setExtendsEOL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

highlightColor

protected java.awt.Color highlightColor
Color used to highlight some area.

highlightStart

protected int highlightStart
Start of the text highlight.

highlightEnd

protected int highlightEnd
End of the text highlight.
Constructor Detail

HighlightDrawLayer

public HighlightDrawLayer(java.awt.Color color)
Constructs a HighlightDrawLayer to highlight using the given color.
Parameters:
color - highlight color.
Method Detail

setHighlight

public void setHighlight(int start,
                         int end)
Selects the text found between the specified start and end locations.
Parameters:
start - start offset of the highlight.
end - end offset of the highlight.

updateContext

public int updateContext(DrawContext ctx,
                         int offset)
Update the draw context by setting colors, fonts and possibly other draw properties. After making the changes, the draw layer should return of the offset at which it would like to update the context again. This is an efficiency heuristic.
Overrides:
updateContext in class BasicDrawLayer
Parameters:
ctx - draw context.
offset - offset into character buffer indicating where drawing is presently taking place.
Returns:
offset into character buffer at which this draw layer would like to update the draw context again. In other words, how long this updated context is valid for in terms of characters in the buffer.