com.raelity.jvi.swing
Class TextViewCache

java.lang.Object
  extended by com.raelity.jvi.swing.TextViewCache
All Implemented Interfaces:
PropertyChangeListener, EventListener, ChangeListener

public class TextViewCache
extends Object
implements PropertyChangeListener, ChangeListener

This class caches information about the various components that make up the VI model. This class listens to these components as needed to keep the cache up to date. All info is derived through a JEditorPane.


Nested Class Summary
static class TextViewCache.FreezeViewport
          Stabilize (do not allow scrolling) the JViewport displaying the indicated JEditorPane.
 
Field Summary
static BooleanOption cacheTrace
           
 
Constructor Summary
TextViewCache(TextView textView)
           
 
Method Summary
 void attach(JEditorPane editor)
          This is called from the managing textview, listen to things that affect the cache.
 void detach(JEditorPane ep)
          Dissassociate from the observed components.
protected  void fillLinePositions()
           
protected  void fillLinePositionsFinally()
          determine document indicators visible in the viewport
 ViFPOS getCursor()
           
 int getFheight()
           
 int getViewBlankLines()
           
 int getViewBottomLine()
           
 int getViewLines()
           
 JViewport getViewport()
           
 int getViewTopLine()
           
 Rectangle modelToView(int offset)
           
 void propertyChange(PropertyChangeEvent e)
           
 void setViewTopLine(int line)
           
 void shutdown(JEditorPane ep)
           
 void stateChanged(ChangeEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheTrace

public static BooleanOption cacheTrace
Constructor Detail

TextViewCache

public TextViewCache(TextView textView)
Method Detail

getCursor

public final ViFPOS getCursor()

getViewport

public final JViewport getViewport()

getFheight

public final int getFheight()

getViewTopLine

public int getViewTopLine()
Returns:
the top line number

setViewTopLine

public void setViewTopLine(int line)

getViewBottomLine

public int getViewBottomLine()

getViewBlankLines

public int getViewBlankLines()

getViewLines

public int getViewLines()
Returns:
number of lines on viewport

fillLinePositions

protected void fillLinePositions()

fillLinePositionsFinally

protected void fillLinePositionsFinally()
determine document indicators visible in the viewport


modelToView

public Rectangle modelToView(int offset)
                      throws BadLocationException
Throws:
BadLocationException

attach

public void attach(JEditorPane editor)
This is called from the managing textview, listen to things that affect the cache.


detach

public void detach(JEditorPane ep)
Dissassociate from the observed components.


shutdown

public void shutdown(JEditorPane ep)

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener

stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener