Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

org.bounce.text
Class SyntaxHighlightingScanner

java.lang.Object
  extended by org.bounce.text.SyntaxHighlightingScanner
Direct Known Subclasses:
XMLScanner

public abstract class SyntaxHighlightingScanner
extends java.lang.Object

Associates input stream characters with specific styles.

Note: The Editor package is based on the JavaEditorKit example as described in the article 'Customizing a Text Editor' by Timothy Prinzing . See: http://java.sun.com/products/jfc/tsc/articles/text/editor_kit/

Version:
$Revision: 1.5 $, $Date: 2009/01/22 22:14:59 $
Author:
Edwin Dankert

Field Summary
protected  boolean error
           
protected  DocumentInputReader in
           
protected  long pos
           
protected  int start
           
 java.lang.String token
          The last token scanned
protected  boolean valid
           
 
Constructor Summary
SyntaxHighlightingScanner(javax.swing.text.Document document)
          Constructs a scanner for the Document.
 
Method Summary
 int getEndOffset()
          Gets the end location of the current token in the document.
 int getStartOffset()
          Gets the starting location of the current token in the document.
 boolean isError()
           
 boolean isValid()
          Returns true when no paint has invalidated the scanner.
abstract  long scan()
          Scans the Xml Stream for XML specific tokens.
 void setRange(int start, int end)
          Sets the scanning range.
 void setValid(boolean valid)
          Set valid when correct range is set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

protected int start

pos

protected long pos

error

protected boolean error

in

protected DocumentInputReader in

valid

protected boolean valid

token

public java.lang.String token
The last token scanned

Constructor Detail

SyntaxHighlightingScanner

public SyntaxHighlightingScanner(javax.swing.text.Document document)
                          throws java.io.IOException
Constructs a scanner for the Document.

Parameters:
document - the document containing the XML content.
Throws:
java.io.IOException
Method Detail

isError

public boolean isError()

isValid

public boolean isValid()
Returns true when no paint has invalidated the scanner.

Returns:
true when no paint has invalidated the output.

setValid

public void setValid(boolean valid)
Set valid when correct range is set.

Parameters:
valid - when correct range set.

setRange

public void setRange(int start,
                     int end)
              throws java.io.IOException
Sets the scanning range.

Parameters:
start - the start of the range.
end - the end of the range.
Throws:
java.io.IOException

getStartOffset

public final int getStartOffset()
Gets the starting location of the current token in the document.

Returns:
the starting location.

getEndOffset

public final int getEndOffset()
Gets the end location of the current token in the document.

Returns:
the end location.

scan

public abstract long scan()
                   throws java.io.IOException
Scans the Xml Stream for XML specific tokens.

Returns:
the last location.
Throws:
java.io.IOException

Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

Copyright 2002-2002-2009 Edwin Dankert. All Rights Reserved.