wugle.expressionui
Class ExpressionViewHighlighter

java.lang.Object
  |
  +--wugle.expressionui.ExpressionViewHighlighter
All Implemented Interfaces:
java.util.EventListener, java.awt.event.ItemListener

public class ExpressionViewHighlighter
extends java.lang.Object
implements java.awt.event.ItemListener

Version:
0.1.4
Author:
Malcolm Fortune

Field Summary
protected  java.awt.Color hilightedColor
           
protected  java.awt.Font hilightedFont
           
protected  int LEFT
           
protected  java.lang.String LEFT_PAREN
           
protected  java.awt.Color normalColor
           
protected  java.awt.Font normalFont
           
protected  int RIGHT
           
protected  java.lang.String RIGHT_PAREN
           
 
Constructor Summary
ExpressionViewHighlighter()
           
ExpressionViewHighlighter(java.awt.Color hilightedColor)
          Constructor takes a color to be used for highlighting the text
 
Method Summary
protected  int getIndex(int startIdx, int direction)
          Searches left or right from the start pos looking for either a left or right parenthesis respectively.
 int getIndex(int startIdx, int direction, java.lang.String targetString)
          Searches left or right from the start pos looking for the targetString
protected  void highLightView(java.lang.String expressionString, int buttonIdx)
          This method gets the left and right indexes(inclusive) for the expression selected and highlights the JComponets between them
 void itemStateChanged(java.awt.event.ItemEvent e)
          ItemListener interface method
 void registerView(ExpressionSelection expressionGroup, java.util.List expressionList)
          Registers the class as an item listener for the button group and also takes a referece to the list of JComponents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

protected final int LEFT
See Also:
Constant Field Values

RIGHT

protected final int RIGHT
See Also:
Constant Field Values

LEFT_PAREN

protected final java.lang.String LEFT_PAREN
See Also:
Constant Field Values

RIGHT_PAREN

protected final java.lang.String RIGHT_PAREN
See Also:
Constant Field Values

normalFont

protected java.awt.Font normalFont

hilightedFont

protected java.awt.Font hilightedFont

normalColor

protected java.awt.Color normalColor

hilightedColor

protected java.awt.Color hilightedColor
Constructor Detail

ExpressionViewHighlighter

public ExpressionViewHighlighter()

ExpressionViewHighlighter

public ExpressionViewHighlighter(java.awt.Color hilightedColor)
Constructor takes a color to be used for highlighting the text

Method Detail

registerView

public void registerView(ExpressionSelection expressionGroup,
                         java.util.List expressionList)
Registers the class as an item listener for the button group and also takes a referece to the list of JComponents. Also, calls the setFonts method


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
ItemListener interface method

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

highLightView

protected void highLightView(java.lang.String expressionString,
                             int buttonIdx)
This method gets the left and right indexes(inclusive) for the expression selected and highlights the JComponets between them


getIndex

protected int getIndex(int startIdx,
                       int direction)
Searches left or right from the start pos looking for either a left or right parenthesis respectively. Increments the zeroTarget variable when an opposite parenthesis is encoutered.


getIndex

public int getIndex(int startIdx,
                    int direction,
                    java.lang.String targetString)
Searches left or right from the start pos looking for the targetString