## net.sf.colorer.editor
Interface BaseEditor

All Known Implementing Classes:
  BaseEditorNative

    public interface BaseEditor

Method Summary
`void` `addEditorListener(EditorListener el)` Adds specified EditorListener object into parse process.
`void` `addRegionHandler(RegionHandler rh, Region filter)` Adds specified RegionHandler object into the parse process.
`FileType` `chooseFileType(java.lang.String fname)` Chooses filetype according to the filename and first line of text
`void` `dispose()` Dispose this Editor's resources
`RegionDefine` `getBackground()` Current Background Region (def:Text)
`FileType` `getFileType()` Returns Currently selected file type
`RegionDefine` `getHorzCross()` Current Horizontal Rule (def:HorzCross)
`LineRegion[]` `getLineRegions(int lno)` Return parsed and colored LineRegions of requested line.
`PairMatch` `getPairMatch(int lineNo, int pos)` Searches and creates pair match object.
`RegionDefine` `getVertCross()` Current Vertical Rule (def:VertCross)
`void` `idleJob(int time)` Tries to do some parsing job while user is doing nothing.
`void` `lineCountEvent(int newLineCount)` Informs about total lines count change.
`void` `modifyEvent(int topLine)` Informs BaseEditor object about text modification event.
`void` `modifyLineEvent(int line)` Informs about single line modification event.
`void` `removeEditorListener(EditorListener el)` Removes previously added EditorListener object.
`void` `removeRegionHandler(RegionHandler rh)` Removes previously added region handler.
`void` `searchGlobalPair(PairMatch pm)` Searches pair match in all available text, possibly, making additional processing.
`void` `searchLocalPair(PairMatch pm)` Searches pair match in currently visible text.
`void` `setBackParse(int backParse)` Specifies number of lines, for which parser would be able to run continual processing without highlight invalidation.
`void` `setFileType(FileType typeName)` Changes used file type
`void` `setRegionCompact(boolean compact)` LineRegionsSupport object preferences.
`void` `setRegionMapper(RegionMapper regionMapper)` Installs specified external RegionMapper.
`void` `setRegionMapper(java.lang.String hrdClass, java.lang.String hrdName)` Installs specified internal RegionMapper.
`void` `validate(int lno)` Validates current state of the editor and runs parser, if needed.
`void` `visibleTextEvent(int wStart, int wSize)` Informs about changes in visible range of text lines.

Method Detail

### dispose

    void dispose()

  Dispose this Editor's resources

### setRegionCompact

    void setRegionCompact(boolean compact)

  LineRegionsSupport object preferences. Installs specified RegionStore (basically HRDRegionStore), which maps HRC Regions into color data, sets default size (in lines) of Regions structure cache.

  Parameters:
    `compact` - Creates LineRegionsSupport (false) or LineRegionsCompactSupport (true) object to store lists of RegionDefine's

### setFileType

    void setFileType(FileType typeName)

  Changes used file type

### chooseFileType

    FileType chooseFileType(java.lang.String fname)

  Chooses filetype according to the filename and first line of text

### getFileType

    FileType getFileType()

  Returns Currently selected file type

### setBackParse

    void setBackParse(int backParse)

  Specifies number of lines, for which parser would be able to run continual processing without highlight invalidation.

  Parameters:
    `backParse` - Number of lines. If <= 0, dropped into default value.

### setRegionMapper

    void setRegionMapper(RegionMapper regionMapper)

  Installs specified external RegionMapper.

### setRegionMapper

    void setRegionMapper(java.lang.String hrdClass,
                         java.lang.String hrdName)

  Installs specified internal RegionMapper.

### addRegionHandler

    void addRegionHandler(RegionHandler rh,
                          Region filter)

  Adds specified RegionHandler object into the parse process.

  Parameters:
    `filter` - If not null, handler would be activated only if passed regions have specified `filter` parent. This allows to optimize performance and disable unnecesary JNI context switches.

### removeRegionHandler

    void removeRegionHandler(RegionHandler rh)

  Removes previously added region handler.

### addEditorListener

    void addEditorListener(EditorListener el)

  Adds specified EditorListener object into parse process.

### removeEditorListener

    void removeEditorListener(EditorListener el)

  Removes previously added EditorListener object.

### getBackground

    RegionDefine getBackground()

  Current Background Region (def:Text)

### getVertCross

    RegionDefine getVertCross()

  Current Vertical Rule (def:VertCross)

### getHorzCross

    RegionDefine getHorzCross()

  Current Horizontal Rule (def:HorzCross)

### getPairMatch

    PairMatch getPairMatch(int lineNo,
                           int pos)

  Searches and creates pair match object. Returned object can be used later in the pair search methods. This object is valid only until reparse of it's line occured. After that event information about line region's references in it becomes invalid and, if used, can produce faults.

  Parameters:
    `lineNo` - Line number, where to search paired region.
    `pos` - Position in line, where paired region to be searched. Paired Region is found, if it includes specified position or ends directly at one char before line position.

### searchLocalPair

    void searchLocalPair(PairMatch pm)

  Searches pair match in currently visible text.

  Parameters:
    `pm` - Unmatched pair match

### searchGlobalPair

    void searchGlobalPair(PairMatch pm)

  Searches pair match in all available text, possibly, making additional processing.

  Parameters:
    `pm` - Unmatched pair match

### getLineRegions

    LineRegion[] getLineRegions(int lno)

  Return parsed and colored LineRegions of requested line. This method validates current cache state and, if needed, calls Colorer parser to validate modified block of text. Size of reparsed text is choosed according to information about visible text range and modification events.

  To do:
    If number of lines, to be reparsed is more, than backParse parameter, then method will return null, until validate() method is called.

### validate

    void validate(int lno)

  Validates current state of the editor and runs parser, if needed. This method can be called periodically in background thread to make possible background parsing process.

  Parameters:
    `lno` - Line number, for which validation is requested. If this number is in the current visible window range, the part of text is validated, which is required for visual repaint. If this number is equals to -1, all the text is validated. If this number is not in visible range, optimal partial validation is used

### idleJob

    void idleJob(int time)

  Tries to do some parsing job while user is doing nothing.

  Parameters:
    `time` - integer between 0 and 100, shows an abount of time, available for this job.

### modifyEvent

    void modifyEvent(int topLine)

  Informs BaseEditor object about text modification event. All the text becomes invalid after the specified line.

  Parameters:
    `topLine` - Topmost modified line of text.

### modifyLineEvent

    void modifyLineEvent(int line)

  Informs about single line modification event. Generally, this type of event can be processed much faster because of pre-checking line's changed structure and cancelling further parsing in case of unmodified text structure.

  Parameters:
    `line` - Modified line of text.
  To do:
    Not used yet! This must include special 'try' parse method.

### visibleTextEvent

    void visibleTextEvent(int wStart,
                          int wSize)

  Informs about changes in visible range of text lines. This information is used to make assumptions about text structure and to make faster parsing.

  Parameters:
    `wStart` - Topmost visible line of text.
    `wSize` - Number of currently visible text lines. This number must includes all partially visible lines.

### lineCountEvent

    void lineCountEvent(int newLineCount)

  Informs about total lines count change. This must include initial lines number setting.

Copyright © 2003 Cail Lomecb. All Rights Reserved.