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

java.lang.Object
  extended by 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.


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
 int hashCode()
          Overrides hashCode() for consistency with override of equals(...)
 boolean matchesRegion(HighlightManager.HighlightInfo h)
          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, notify, notifyAll, toString, wait, wait, wait
 

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.

hashCode

public int hashCode()
Overrides hashCode() for consistency with override of equals(...)

Overrides:
hashCode in class Object

remove

public void remove()

getHighlightTag

public Object getHighlightTag()
Accessor for the highlight tag.

Returns:
the highlight tag (which may be null)

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(HighlightManager.HighlightInfo h)
Tests to see if the given offsets correspond to the offsets specified within this highlight.

Parameters:
h - a HighlightInfo object given the start and end offsets
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.