com.bluemarsh.jswat.view
Class BasicDrawLayer

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

public class BasicDrawLayer
extends java.lang.Object
implements DrawLayer

BasicDrawLayer provides a default implementation of the DrawLayer interface.

Author:
Nathan Fiedler

Field Summary
protected  boolean active
          True if this draw layer is actively affecting the text area.
protected  boolean extendsEOL
          True if this draw layer draws beyond the end of the line.
 
Fields inherited from interface com.bluemarsh.jswat.view.DrawLayer
PRIORITY_COLORIZER, PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SELECTION, PRIORITY_STEPPING
 
Constructor Summary
BasicDrawLayer()
           
 
Method Summary
 boolean extendsEOL()
          Indicates that this layer wants to affect the background color beyond the end of the line of text.
 boolean isActive()
          Returns true if this draw layer wants to take part in the current painting event.
 void setExtendsEOL(boolean extendsEOL)
          Sets the extends end-of-line property.
 int updateContext(DrawContext ctx, int offset)
          Update the draw context by setting colors, fonts and possibly other draw properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

protected boolean active
True if this draw layer is actively affecting the text area.

extendsEOL

protected boolean extendsEOL
True if this draw layer draws beyond the end of the line.
Constructor Detail

BasicDrawLayer

public BasicDrawLayer()
Method Detail

extendsEOL

public boolean extendsEOL()
Indicates that this layer wants to affect the background color beyond the end of the line of text.
Specified by:
extendsEOL in interface DrawLayer
Returns:
true to extend past EOL, false otherwise.

isActive

public boolean isActive()
Returns true if this draw layer wants to take part in the current painting event.
Specified by:
isActive in interface DrawLayer
Returns:
true if active, false otherwise.

setExtendsEOL

public void setExtendsEOL(boolean extendsEOL)
Sets the extends end-of-line property.
Parameters:
extendsEOL - true to extend past the end of the line, false otherwise.

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.
Specified by:
updateContext in interface DrawLayer
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.