public abstract class AbstractHighlightsContainer extends Object implements HighlightsContainer
HighlightsContainer
interface.
It provides standard implementation of the methods for adding and removing
HighlightsChangeListener
s and allows subclasses to notify listeners
by calling the fireHighlightsChange
method.ATTR_EXTENDS_EMPTY_LINE, ATTR_EXTENDS_EOL
Modifier | Constructor and Description |
---|---|
protected |
AbstractHighlightsContainer()
Creates a new instance of AbstractHighlightsContainer
|
Modifier and Type | Method and Description |
---|---|
void |
addHighlightsChangeListener(HighlightsChangeListener listener)
Adds
HighlightsChangeListener to this container. |
protected void |
fireHighlightsChange(int changeStartOffset,
int changeEndOffset)
Notifies all registered listeners about a change in this container.
|
abstract 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
HighlightsChangeListener to this container. |
protected AbstractHighlightsContainer()
public abstract HighlightsSequence getHighlights(int startOffset, int endOffset)
HighlightsContainer
The returned highlighted areas (highlights) must obey the following rules:
startOffset
and endOffset
parameters. Any highlights outside of this range will be clipped by the
rendering infrastructure.
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.
getHighlights
in interface HighlightsContainer
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.public final void addHighlightsChangeListener(HighlightsChangeListener listener)
HighlightsChangeListener
to this container.addHighlightsChangeListener
in interface HighlightsContainer
listener
- The listener to add.public final void removeHighlightsChangeListener(HighlightsChangeListener listener)
HighlightsChangeListener
to this container.removeHighlightsChangeListener
in interface HighlightsContainer
listener
- The listener to remove.protected final void fireHighlightsChange(int changeStartOffset, int changeEndOffset)
changeStartOffset
and changeEndOffset
parameters.changeStartOffset
- The starting offset of the changed area.changeEndOffset
- The ending offset of the changed area.