de.hunsicker.jalopy.swing.syntax
Interface SyntaxDocument

All Superinterfaces:
javax.swing.text.Document
All Known Implementing Classes:
DefaultSyntaxDocument

public interface SyntaxDocument
extends javax.swing.text.Document

The interface a document must implement to be colorizable by the SyntaxEditorKit. It defines two methods, one that returns the TokenMarker that will split a line into a list of tokens, and a method that returns a color array that maps identification tags returned by the token marker into Color objects. The possible token identifiers are defined as static fields in the Token class.

Version:
$Id: SyntaxDocument.java,v 1.2 2002/11/11 22:09:53 marcohu Exp $
Author:
Slava Pestov

Field Summary
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Method Summary
 java.awt.Color[] getColors()
          Returns the color array that maps token identifiers to java.awt.Color objects.
 TokenMarker getTokenMarker()
          Returns the token marker that is to be used to split lines of this document up into tokens.
 void setColors(java.awt.Color[] colors)
          Sets the color array that maps token identifiers to java.awt.Color ojects.
 void setTokenMarker(TokenMarker tm)
          Sets the token marker that is to be used to split lines of this document up into tokens.
 void tokenizeLines()
          Reparses the document, by passing all lines to the token marker.
 void tokenizeLines(int start, int len)
          Reparses the document, by passing the specified lines to the token marker.
 
Methods inherited from interface javax.swing.text.Document
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render
 

Method Detail

setColors

public void setColors(java.awt.Color[] colors)
Sets the color array that maps token identifiers to java.awt.Color ojects. May throw an exception if this is not supported for this type of document.

Parameters:
colors - The new color list

getColors

public java.awt.Color[] getColors()
Returns the color array that maps token identifiers to java.awt.Color objects. Each index in the array is a token type.

Returns:
DOCUMENT ME!

setTokenMarker

public void setTokenMarker(TokenMarker tm)
Sets the token marker that is to be used to split lines of this document up into tokens. May throw an exception if this is not supported for this type of document.

Parameters:
tm - The new token marker

getTokenMarker

public TokenMarker getTokenMarker()
Returns the token marker that is to be used to split lines of this document up into tokens. May return null if this document is not to be colorized.

Returns:
DOCUMENT ME!

tokenizeLines

public void tokenizeLines()
Reparses the document, by passing all lines to the token marker. This should be called after the document is first loaded.


tokenizeLines

public void tokenizeLines(int start,
                          int len)
Reparses the document, by passing the specified lines to the token marker. This should be called after a large quantity of text is first inserted.

Parameters:
start - The first line to parse
len - The number of lines, after the first one to parse


Copyright © 1997-2005 Jalopy. All Rights Reserved.