LPEX
3.6.5

com.ibm.lpex.core
Interface LpexDocumentSectionListener


public interface LpexDocumentSectionListener

Interface LpexDocumentSectionListener can be implemented to manage the document section currently loaded in the editor. After loading a document section and setting information regarding the number of lines in the complete document, the application responds to the document-listener notifications by expanding the document section as requested.

Create a listener object using this class, and then register it with a document view using the view's addLpexDocumentSectionListener() method. When the editor determines that the currently-loaded document section must be extended, the addLines() method in the listener object is invoked. Example:

 
 lpexView.addLpexDocumentSectionListener(new LpexDocumentSectionListener() { 
  // we must extend the document section
  public boolean addLines(LpexView view, int lineNeeded)
  {
   return loadItUp(view, lineNeeded);
  }
 }); 

Note: This feature is only provided for certain specific applications. Normally, the editor loads and operates on complete documents (files).

When an application only loads a section of the document, it should take certain features into consideration:

See Also:
LpexView.addLpexDocumentSectionListener(com.ibm.lpex.core.LpexDocumentSectionListener), LpexView.removeLpexDocumentSectionListener(com.ibm.lpex.core.LpexDocumentSectionListener), LpexView.setLinesOutsideDocumentSection(int, int), LpexView.linesBeforeStart(), LpexView.linesAfterEnd()

Method Summary
 boolean addLines(LpexView lpexView, int lineNeeded)
          This method is invoked when it was determined that the currently-loaded document section should be extended.
 

Method Detail

addLines

boolean addLines(LpexView lpexView,
                 int lineNeeded)
This method is invoked when it was determined that the currently-loaded document section should be extended. A minimum of about two screen rows of lines is expected to be loaded around the current line in each document view.

Scroll down example:

 
                   before               after
                   scroll down          scroll down
                  -----------------    -----------------
        ^         |               |    |               |        ^
        |         |               |    |               |        |
 linesBeforeStart |               |    |               | linesBeforeStart
                  |XXXXXXXXXXXXXXX| .. |XXXXXXXXXXXXXXX|
                  |XXXXXXXXXXXXXXX|    |XXXXXXXXXXXXXXX|
                  |XXXXXXXXXXXXXXX|    |XXXXXXXXXXXXXXX|
                  | cursor        |    |XXXXXXXXXXXXXXX|
                  |XXXXXXXXXXXXXXX|    |XXXXXXXXXXXXXXX|
                  |XXXXXXXXXXXXXXX|    |XXXXXXXXXXXXXXX|
  linesAfterEnd   |               |    |XXXXXXXXXXXXXXX|
        |         |               |    |XXXXXXXXXXXXXXX|
        |         | scroll target | .. | cursor        |
        |         |               |    |XXXXXXXXXXXXXXX|
        |         |  [threshold]  |    |XXXXXXXXXXXXXXX|
        |         |               |    |XXXXXXXXXXXXXXX|
        |         | lineNeeded    | .. |XXXXXXXXXXXXXXX|
        |         |               |    |               |  linesAfterEnd
        |         |               |    |               |        |
        v         |               |    |               |        v
                  -----------------    ----------------- 

Parameters:
lpexView - the view of the editor document which triggered the request to add lines
lineNeeded - the document line delimiting the new range needed to expand the current document section in the implied direction. This is
  • the first line prior to the start of the current document section, or
  • the last line beyond the end of the current document section
in the range of lines with which the current document section must be expanded; lineNeeded already includes the minimum threshold indicated
Returns:
true to indicate that the document section has been updated (any other registered document-section listeners will not be called)

LPEX
3.6.5

Copyright © 2012 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.