sos.reports
Class DefaultTextHighlighter

java.lang.Object
  |
  +--sos.reports.DefaultTextHighlighter
All Implemented Interfaces:
TextHighlighter

public class DefaultTextHighlighter
extends java.lang.Object
implements TextHighlighter

A default implementation of TextHighlighter that uses a hash map to associate lists of text highlights to report elements.

Since:
1.0

Constructor Summary
DefaultTextHighlighter()
          Creates a n instance of DefaultTextHighlighter.
 
Method Summary
 void addHighlight(Element element, javax.swing.text.Highlighter.Highlight highlight)
          Adds the specified text highlight to the list of highlights associated with the specified element.
 void clear()
          Removes all text highlighting for all report elements.
 java.util.List getHighlights(Element element)
          Returns the list of text highlights associated with the specified element.
 void removeAllHighlights(Element element)
          Removes all text highlights associated with the specified element.
 void removeHighlight(Element element, javax.swing.text.Highlighter.Highlight highlight)
          Removes the specified text highlight for the list of highlights associated with the specified element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTextHighlighter

public DefaultTextHighlighter()
Creates a n instance of DefaultTextHighlighter.

Method Detail

addHighlight

public void addHighlight(Element element,
                         javax.swing.text.Highlighter.Highlight highlight)
Description copied from interface: TextHighlighter
Adds the specified text highlight to the list of highlights associated with the specified element. When the element is rendered, the region of text, as described by the highlight, is highlighted.

Specified by:
addHighlight in interface TextHighlighter
Parameters:
element - report element for which to use the highlighting
highlight - a start offset, end offset, and painter describing how to highlight the element's text
See Also:
TextHighlighter.getHighlights(sos.reports.Element), TextHighlighter.removeHighlight(sos.reports.Element, javax.swing.text.Highlighter.Highlight)

clear

public void clear()
Description copied from interface: TextHighlighter
Removes all text highlighting for all report elements.

Specified by:
clear in interface TextHighlighter
See Also:
TextHighlighter.removeAllHighlights(sos.reports.Element)

getHighlights

public java.util.List getHighlights(Element element)
Description copied from interface: TextHighlighter
Returns the list of text highlights associated with the specified element.

Specified by:
getHighlights in interface TextHighlighter
Parameters:
element - report element for which the associated highlights are requested
Returns:
an unmodifiable list of element's highlights

removeAllHighlights

public void removeAllHighlights(Element element)
Description copied from interface: TextHighlighter
Removes all text highlights associated with the specified element.

Specified by:
removeAllHighlights in interface TextHighlighter
Parameters:
element - report element for which to remove all associated highlights
See Also:
TextHighlighter.clear()

removeHighlight

public void removeHighlight(Element element,
                            javax.swing.text.Highlighter.Highlight highlight)
Description copied from interface: TextHighlighter
Removes the specified text highlight for the list of highlights associated with the specified element.

Specified by:
removeHighlight in interface TextHighlighter
Parameters:
element - report element for which to remove the highlighting
highlight - text highlighting to unassociate with element
See Also:
TextHighlighter.addHighlight(sos.reports.Element, javax.swing.text.Highlighter.Highlight)


Copyright 2003, 2004 Side of Software (SOS). All rights reserved.