|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.editor.highlight.HighlightLayer
A HighlightedLayer
is a container for highlights added
to an editor pane. Highlights are segments of text are created in
a specific highlight layer rather than directly in the editor pane.
This allows different modules to maintain and manipulate their
highlights in separate layers without affect each other.
Let's visit an example of how to highlight text - take the example of the selected text maintained by the caret. In order for the caret to have the selected text highlighted, it needs to create a highlight layer and add it to the editor pane. Once the layer is added, it can add, change, or remove highlights using the highlight layer directly. The highlight layer will take care of making sure the editor view is kept up-to-date as far as painting is concerned.
There are certain highlights that track a line, such as a caret
line, or breakpoint line. Use addLineHighlight()
for creating such a line highlight. Line highlights cannot be
changed to non-line highlights once created.
Note that highlighted text are created using buffer
OffsetMarks
and will track those offsets when the buffer
changes.
Constructor Summary | |
HighlightLayer(BasicEditorPane editor)
Constructs a new highlight layer associated with the given editor. |
Method Summary | |
HighlightedText |
addHighlight(HighlightStyle style,
int startOffset,
int endOffset)
Adds a highlight to the editor pane using the specified style and offsets. |
HighlightedText |
addLineHighlight(HighlightStyle style,
int line)
Adds a highlight to the editor pane using the specified style and offsets. |
void |
changeHighlight(HighlightedText highlightedText,
HighlightStyle newHighlightStyle)
Changes the highlight style of the previously created highlighted region of text. |
void |
changeHighlight(HighlightedText highlightedText,
HighlightStyle newHighlightStyle,
int newStartOffset,
int newEndOffset)
Moves the highlight region to a new set of offsets in the editor, and changes the highlight style used. |
void |
changeHighlight(HighlightedText highlightedText,
int newStartOffset,
int newEndOffset)
Moves the highlight region to a new set of offsets in the editor. |
void |
removeAllHighlights()
Removes all highlights in this layer from the associated editor pane. |
void |
removeHighlight(HighlightedText highlightedText)
Removes the given highlight from the editor pane. |
void |
renderHighlights(HighlightedFragmentsList fragmentsList,
int startOffset,
int endOffset)
This routine is used by the editor view to obtain all of the highlights in this highlight layer in the given offset range. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HighlightLayer(BasicEditorPane editor)
Method Detail |
public HighlightedText addHighlight(HighlightStyle style, int startOffset, int endOffset)
style
- the highlight style to usestartOffset
- the start of the highlighted segment of textendOffset
- the end of the highlighted segment of textpublic HighlightedText addLineHighlight(HighlightStyle style, int line)
style
- the highlight style to useline
- the 0-based line to highlight
public void removeHighlight(HighlightedText highlightedText)
highlightedText
- the highlight to removepublic void removeAllHighlights()
public void changeHighlight(HighlightedText highlightedText, HighlightStyle newHighlightStyle)
highlightedText
- the highlight that was previously creatednewHighlightStyle
- the new highlight style to usepublic void changeHighlight(HighlightedText highlightedText, int newStartOffset, int newEndOffset)
highlightedText
- the highlight that was previously creatednewStartOffset
- the new starting location for the highlightnewEndOffset
- the new ending location for the highlightpublic void changeHighlight(HighlightedText highlightedText, HighlightStyle newHighlightStyle, int newStartOffset, int newEndOffset)
highlightedText
- the highlight that was previously creatednewHighlightStyle
- the new highlight style to usenewStartOffset
- the new starting location for the highlightnewEndOffset
- the new ending location for the highlightpublic void renderHighlights(HighlightedFragmentsList fragmentsList, int startOffset, int endOffset)
fragmentsList
- the list to add the highlight fragments tostartOffset
- the start of the painting areaendOffset
- the end of the painting area
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.