jsyntaxpane.components
Class TokenMarker

java.lang.Object
  extended by jsyntaxpane.components.TokenMarker
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.CaretListener, SyntaxComponent

public class TokenMarker
extends java.lang.Object
implements SyntaxComponent, javax.swing.event.CaretListener, java.beans.PropertyChangeListener

This class highlights Tokens within a document whenever the caret is moved to a TokenType provided in the config file.

Author:
Ayman Al-Sairafi

Nested Class Summary
 
Nested classes/interfaces inherited from interface jsyntaxpane.components.SyntaxComponent
SyntaxComponent.Status
 
Field Summary
static java.lang.String DEFAULT_TOKENTYPES
           
static java.lang.String PROPERTY_COLOR
           
static java.lang.String PROPERTY_TOKENTYPES
           
 
Constructor Summary
TokenMarker()
          Constructs a new Token highlighter
 
Method Summary
 void caretUpdate(javax.swing.event.CaretEvent e)
           
 void config(Configuration config)
          Configure the component using the given properties.
 void deinstall(javax.swing.JEditorPane editor)
          Called when the component is to be removed from the editor
 void install(javax.swing.JEditorPane editor)
          Called to install the component on an editor
 void markTokenAt(int pos)
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removeMarkers()
          removes all markers from the pane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TOKENTYPES

public static final java.lang.String DEFAULT_TOKENTYPES
See Also:
Constant Field Values

PROPERTY_COLOR

public static final java.lang.String PROPERTY_COLOR
See Also:
Constant Field Values

PROPERTY_TOKENTYPES

public static final java.lang.String PROPERTY_TOKENTYPES
See Also:
Constant Field Values
Constructor Detail

TokenMarker

public TokenMarker()
Constructs a new Token highlighter

Method Detail

caretUpdate

public void caretUpdate(javax.swing.event.CaretEvent e)
Specified by:
caretUpdate in interface javax.swing.event.CaretListener

markTokenAt

public void markTokenAt(int pos)

removeMarkers

public void removeMarkers()
removes all markers from the pane.


config

public void config(Configuration config)
Description copied from interface: SyntaxComponent
Configure the component using the given properties. The keys needed for configuration will be prefixed by the given prefix

Specified by:
config in interface SyntaxComponent
Parameters:
config - configuration data

install

public void install(javax.swing.JEditorPane editor)
Description copied from interface: SyntaxComponent
Called to install the component on an editor

Specified by:
install in interface SyntaxComponent

deinstall

public void deinstall(javax.swing.JEditorPane editor)
Description copied from interface: SyntaxComponent
Called when the component is to be removed from the editor

Specified by:
deinstall in interface SyntaxComponent

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener