edu.rice.cs.util.swing
Class HighlightManager.HighlightInfo

java.lang.Object
  |
  +--edu.rice.cs.util.swing.HighlightManager.HighlightInfo
Enclosing class:
HighlightManager

public class HighlightManager.HighlightInfo
extends Object

The public inner class defining a "smart" highlight, which can return the value of its start and end offsets for comparison with other highlights. Also keeps a tag to its actual highlight in the component's highlighter for easy removal.


Field Summary
private  Position _endPos
           
private  Object _highlightTag
           
private  Highlighter.HighlightPainter _p
           
private  Position _startPos
           
 
Constructor Summary
HighlightManager.HighlightInfo(int from, int to, Highlighter.HighlightPainter p)
          Constructor takes the bounds and the painter for a highlighter
 
Method Summary
 boolean equals(Object o)
          Tests equivalency of one HighlightInfo object with this HighlightInfo object.
 int getEndOffset()
          Accessor for the ending offset of this highlight
 Object getHighlightTag()
          Accessor for the highlight tag
 Highlighter.HighlightPainter getPainter()
          Accessor for the painter
 int getStartOffset()
          Accessor for the starting offset of this highlight
 boolean matchesRegion(int from, int to)
          Tests to see if the given offsets correspond to the offsets specified within this highlight.
 void refresh(Highlighter.HighlightPainter p)
          Refreshes this HighlightInfo object, obtaining a new Highlighter
 void remove()
           
 void setHighlightTag(Object highlightTag)
          Set the highlight tag for later access to the highlight as it is stored in the components highlighter.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_highlightTag

private Object _highlightTag

_startPos

private Position _startPos

_endPos

private Position _endPos

_p

private Highlighter.HighlightPainter _p
Constructor Detail

HighlightManager.HighlightInfo

public HighlightManager.HighlightInfo(int from,
                                      int to,
                                      Highlighter.HighlightPainter p)
Constructor takes the bounds and the painter for a highlighter
Parameters:
from - the offset at which the new highlight will start.
to - the offset at which the new highlight will end.
p - the Highlighter.HighlightPainter for painting
Method Detail

setHighlightTag

public void setHighlightTag(Object highlightTag)
Set the highlight tag for later access to the highlight as it is stored in the components highlighter.
Parameters:
highlightTag - the Object for keeping track of a stored highlight

equals

public boolean equals(Object o)
Tests equivalency of one HighlightInfo object with this HighlightInfo object. Compares start and end offsets, and the Highlighter.HighlightPainter -- returns true, if they are the same in both.
Overrides:
equals in class Object
Parameters:
o - the other HighlightInfo object to compare to this one.
Returns:
boolean true, if equivalent; false otherwise.

remove

public void remove()

getHighlightTag

public Object getHighlightTag()
Accessor for the highlight tag
Returns:
the highlight tag

getPainter

public Highlighter.HighlightPainter getPainter()
Accessor for the painter
Returns:
the painter

getStartOffset

public int getStartOffset()
Accessor for the starting offset of this highlight
Returns:
the start offset

getEndOffset

public int getEndOffset()
Accessor for the ending offset of this highlight
Returns:
the end offset

matchesRegion

public boolean matchesRegion(int from,
                             int to)
Tests to see if the given offsets correspond to the offsets specified within this highlight.
Parameters:
from - the start offset
to - the end offset
Returns:
true, if the supplied offsets are the same as those of this highlight.

refresh

public void refresh(Highlighter.HighlightPainter p)
Refreshes this HighlightInfo object, obtaining a new Highlighter