SWT LPEX
v3.0.5

com.ibm.lpex.samples
Class CursorHairline

java.lang.Object
  extended bycom.ibm.lpex.core.LpexViewAdapter
      extended bycom.ibm.lpex.samples.CursorHairline
All Implemented Interfaces:
DisposeListener, EventListener, LpexViewListener, PaintListener, SWTEventListener

public class CursorHairline
extends LpexViewAdapter
implements PaintListener, DisposeListener

Sample class to display a vertical hairline.

Installing this class in a document view adds a vertical hairline that either tracks the cursor, or is fixed at the cursor location in effect when it is installed.

Here is the CursorHairline source code.

A user profile (such as TestUserProfile) can install this feature in a document view by calling, for example:

  CursorHairline.install(lpexView, false);

See also HairlineCommand as an example of an editor command that controls the display of the cursor hairline.

See Also:
All the samples

Method Summary
 void disposed(LpexView lpexView)
          View listener - the view is being disposed.
static void install(LpexView lpexView, boolean trackCursor)
          Installs the hairline in the given document view.
 void paintControl(PaintEvent e)
          Text window paint listener - paint event notification.
 void shown(LpexView lpexView)
          View listener - the view has been refreshed.
static void uninstall(LpexView lpexView)
          Uninstalls the cursor hairline from the given view.
 void widgetDisposed(DisposeEvent e)
          Text window dispose listener - the window is being disposed.
 
Methods inherited from class com.ibm.lpex.core.LpexViewAdapter
readonly, renamed, renaming, saved, saving, showing, updateProfile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

install

public static void install(LpexView lpexView,
                           boolean trackCursor)
Installs the hairline in the given document view.

Parameters:
trackCursor - true = hairline follows the cursor, false = fixed hairline at the current position

uninstall

public static void uninstall(LpexView lpexView)
Uninstalls the cursor hairline from the given view.


shown

public void shown(LpexView lpexView)
View listener - the view has been refreshed. Installs our listeners as soon as an LPEX window has been associated with the view. Assumes that the specified document view will only ever be shown in this window.

Specified by:
shown in interface LpexViewListener
Overrides:
shown in class LpexViewAdapter

disposed

public void disposed(LpexView lpexView)
View listener - the view is being disposed. Uninstalls the cursor hairline from this view.

Specified by:
disposed in interface LpexViewListener
Overrides:
disposed in class LpexViewAdapter

widgetDisposed

public void widgetDisposed(DisposeEvent e)
Text window dispose listener - the window is being disposed. Uninstalls the cursor hairline.

Specified by:
widgetDisposed in interface DisposeListener

paintControl

public void paintControl(PaintEvent e)
Text window paint listener - paint event notification. Draws the cursor hairline.

Specified by:
paintControl in interface PaintListener

SWT LPEX
v3.0.5

(C) Copyright IBM Corporation 1998, 2005.  All Rights Reserved.