org.netbeans.modules.editor.lib2/1 1.43.1 10

org.netbeans.spi.editor.highlighting
Interface HighlightsContainer

All Known Implementing Classes:
AbstractHighlightsContainer, OffsetsBag, PositionsBag

public interface HighlightsContainer

The container of highlighted areas and their attributes.


Field Summary
static String ATTR_EXTENDS_EMPTY_LINE
          The attribute key for highlights that need to show up on empty lines.
static String ATTR_EXTENDS_EOL
          The attribute key for highlights that need to span across a whole line.
 
Method Summary
 void addHighlightsChangeListener(HighlightsChangeListener listener)
          Adds a listener to this highlights container.
 HighlightsSequence getHighlights(int startOffset, int endOffset)
          Provides the list of highlighted areas that should be used for rendering a document.
 void removeHighlightsChangeListener(HighlightsChangeListener listener)
          Removes a listener from this highlights container.
 

Field Detail

ATTR_EXTENDS_EOL

static final String ATTR_EXTENDS_EOL
The attribute key for highlights that need to span across a whole line.

Typically highlights only affect rendering of a small part of text (perhaps just several characters). Some layers, however, need to highlight a whole line in an editor window regardless of how much text the line contains. The highlighting of a line with a caret is an example of such a layer.

If you want a highlight that spans accross the whole editor pane you can add this attribute key to the highlight's AttributeSet and set its value to Boolean.TRUE. The highlighted area must contain the new-line character at the end of the line.

See Also:
Constant Field Values

ATTR_EXTENDS_EMPTY_LINE

static final String ATTR_EXTENDS_EMPTY_LINE
The attribute key for highlights that need to show up on empty lines.

If you use this key for a highlight which contains the new-line character at the end of an empty line and set the value of this attribute to Boolean.TRUE then the highlight will be drawn as a half-character-wide stripe at the beginning of the line.

See Also:
Constant Field Values
Method Detail

getHighlights

HighlightsSequence getHighlights(int startOffset,
                                 int endOffset)
Provides the list of highlighted areas that should be used for rendering a document.

The returned highlighted areas (highlights) must obey the following rules:

The editor infrastructure will log any problems it may encounter with provided implementations of this interface. Although the infrastructure will try to do its best to render all highlights supplied by the implementors, if the above rules are violated the results can't be garanteed.

Parameters:
startOffset - The starting offset of the area which the caller attempts to repaint (or create views for). The staring offset is always >=0.
endOffset - The ending offset of the rendered area. The Integer.MAX_VALUE can be passed in if the end offset is unknown to the caller. The highlights container is then expected to return all highlights up to the end of the document.
Returns:
non-null iterator of highlights sorted by offsets.

addHighlightsChangeListener

void addHighlightsChangeListener(HighlightsChangeListener listener)
Adds a listener to this highlights container.

Parameters:
listener - The listener to add.

removeHighlightsChangeListener

void removeHighlightsChangeListener(HighlightsChangeListener listener)
Removes a listener from this highlights container.

Parameters:
listener - The listener to remove.

org.netbeans.modules.editor.lib2/1 1.43.1 10

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.