net.sf.colorer.editor
Class Outliner

java.lang.Object
  extended by net.sf.colorer.editor.Outliner
All Implemented Interfaces:
EditorListener, RegionHandler
Direct Known Subclasses:
WorkbenchOutliner

public class Outliner
extends java.lang.Object
implements RegionHandler, EditorListener

Basic outliner class, used to capture parser output and filter out only required structure elements.


Field Summary
protected  java.util.Vector outline
           
 
Constructor Summary
Outliner(Region searchRegion)
           
 
Method Summary
 void addRegion(int lno, java.lang.String line, int sx, int ex, Region region)
          Informs handler about lexical region in line.
 void attachOutliner(BaseEditor be)
           
 void clear()
          Cleans out current outline elements.
 void clearLine(int lno, java.lang.String line)
          Clear line event.
 OutlineItem createItem(int lno, int sx, int length, int curLevel, java.lang.String itemLabel, Region region)
           
 void detachOutliner(BaseEditor be)
           
 void endParsing(int lno)
          End of text parsing.
 void enterScheme(int lno, java.lang.String line, int sx, int ex, Region region, java.lang.String scheme)
          Informs handler about entering into specified scheme.
 Region getFilter()
          Returns filter region, used by this handler.
 OutlineItem getItem(int idx)
           
 boolean isOutlined(Region region)
           
 int itemCount()
           
 void leaveScheme(int lno, java.lang.String line, int sx, int ex, Region region, java.lang.String scheme)
          Informs handler about leaveing specified scheme.
 void modifyEvent(int topLine)
          Informs EditorListener object about text modification event.
protected  void notifyUpdate()
           
 void startParsing(int lno)
          Start of text parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outline

protected java.util.Vector outline
Constructor Detail

Outliner

public Outliner(Region searchRegion)
Method Detail

attachOutliner

public void attachOutliner(BaseEditor be)

detachOutliner

public void detachOutliner(BaseEditor be)

getItem

public OutlineItem getItem(int idx)

itemCount

public int itemCount()

getFilter

public Region getFilter()
Description copied from interface: RegionHandler
Returns filter region, used by this handler. This region is used internally to filter parser stream and speedup JNI switches.

Specified by:
getFilter in interface RegionHandler

isOutlined

public boolean isOutlined(Region region)

clear

public void clear()
Cleans out current outline elements.


createItem

public OutlineItem createItem(int lno,
                              int sx,
                              int length,
                              int curLevel,
                              java.lang.String itemLabel,
                              Region region)

notifyUpdate

protected void notifyUpdate()

modifyEvent

public void modifyEvent(int topLine)
Description copied from interface: EditorListener
Informs EditorListener object about text modification event. All the text becomes invalid after the specified line.

Specified by:
modifyEvent in interface EditorListener
Parameters:
topLine - Topmost modified line of text.

startParsing

public void startParsing(int lno)
Description copied from interface: RegionHandler
Start of text parsing. Called only once, when TextParser starts parsing of the specified block of text. All other event messages comes between this call and endParsing call.

Specified by:
startParsing in interface RegionHandler
Parameters:
lno - Start line number

endParsing

public void endParsing(int lno)
Description copied from interface: RegionHandler
End of text parsing. Called only once, when TextParser stops parsing of the specified block of text.

Specified by:
endParsing in interface RegionHandler
Parameters:
lno - End line number

clearLine

public void clearLine(int lno,
                      java.lang.String line)
Description copied from interface: RegionHandler
Clear line event. Called once for each parsed text line, when TextParser starts to parse specified line of text. This method is called before any of the region information passed, and used often to clear internal handler structure of this line before adding new one.

Specified by:
clearLine in interface RegionHandler
Parameters:
lno - Line number

addRegion

public void addRegion(int lno,
                      java.lang.String line,
                      int sx,
                      int ex,
                      Region region)
Description copied from interface: RegionHandler
Informs handler about lexical region in line. This is a basic method, wich transfer information from parser to application. Positions of different passed regions can be overlapped.

Specified by:
addRegion in interface RegionHandler
Parameters:
lno - Current line number
sx - Start X position of region in line
ex - End X position of region in line
region - Region information

enterScheme

public void enterScheme(int lno,
                        java.lang.String line,
                        int sx,
                        int ex,
                        Region region,
                        java.lang.String scheme)
Description copied from interface: RegionHandler
Informs handler about entering into specified scheme. Parameter region is used to specify scheme background region information. If text is parsed not from the first line, this method is called with fake parameters to compensate required scheme structure.

Specified by:
enterScheme in interface RegionHandler
Parameters:
lno - Current line number
sx - Start X position of region in line
ex - End X position of region in line
region - Scheme Region information (background)
scheme - Additional Scheme information

leaveScheme

public void leaveScheme(int lno,
                        java.lang.String line,
                        int sx,
                        int ex,
                        Region region,
                        java.lang.String scheme)
Description copied from interface: RegionHandler
Informs handler about leaveing specified scheme. Parameter region is used to specify scheme background region information. If text parse process ends, but current schemes stack is not balanced (this can happends because of bad balanced structure of source text, or partial text parse) this method is not called for unbalanced levels.

Specified by:
leaveScheme in interface RegionHandler
Parameters:
lno - Current line number
sx - Start X position of region in line
ex - End X position of region in line
region - Scheme Region information (background)
scheme - Additional Scheme information


Copyright © 2003 Cail Lomecb. All Rights Reserved.