LPEX
3.6.8

com.ibm.lpex.samples
Class CursorHairline

java.lang.Object
  extended by com.ibm.lpex.core.LpexViewAdapter
      extended by com.ibm.lpex.samples.CursorHairline
All Implemented Interfaces:
LpexViewListener

public class CursorHairline
extends LpexViewAdapter

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);

The code fragment below sets the hairline at column 81 (assuming a fixed-pitch font):

  // import com.ibm.lpex.samples.CursorHairline;
  String currentPosition = lpexView.query("displayPosition");
  lpexView.doCommand("set displayPosition 81");
  CursorHairline.install(lpexView, false);
  lpexView.doCommand("screenShow view");
  lpexView.doCommand("set displayPosition " + currentPosition);

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, or 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
See Also:
LpexViewListener.showing(com.ibm.lpex.core.LpexView)

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.


paintControl

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


LPEX
3.6.8

Copyright © 2013 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.