|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.editor.highlight.HighlightLayer
public final class 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.
In end of line cases, background attributes and underlines are handled
and painted differently. Note that text-based applies to highlighted
regions through addHighlight()
, while line-based applies to
highlighted regions through addLineHighlight
:
Field Summary | |
---|---|
static int |
FETCH_ALL_HIGHLIGHTS
Constant for all highlight types, whether offset-range, or line-based. |
static int |
FETCH_LINE_HIGHLIGHTS
Constant for line-based highlights only (excludes offset range-based). |
static int |
FETCH_RANGE_HIGHLIGHTS
Constant for offset-range based highlights only (excludes line-based). |
Constructor Summary | |
---|---|
HighlightLayer(BasicEditorPane editor)
Constructs a new highlight layer associated with the given editor. |
Method Summary | |
---|---|
HighlightedText |
addHighlight(HighlightStyle style,
int startOffset,
boolean startOffsetBias,
int endOffset,
boolean endOffsetBias)
Adds a highlight to the editor pane using the specified style and offsets. |
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 |
beginBlockUpdate()
Begins a block update. |
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 |
changeLineHighlight(HighlightedText highlightedLine,
HighlightStyle newHighlightStyle,
int newLine)
Moves the highlighted line to the new line in the editor, and sets a new highlight to use. |
void |
endBlockUpdate()
Ends a block update. |
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(HighlightFragmentsList 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. |
void |
renderHighlights(HighlightFragmentsList fragmentsList,
int fetchPolicy,
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 |
Field Detail |
---|
public static final int FETCH_ALL_HIGHLIGHTS
public static final int FETCH_RANGE_HIGHLIGHTS
public static final int FETCH_LINE_HIGHLIGHTS
Constructor Detail |
---|
public HighlightLayer(BasicEditorPane editor)
Method Detail |
---|
public void beginBlockUpdate()
endBlockUpdate()
.
public void endBlockUpdate()
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 addHighlight(HighlightStyle style, int startOffset, boolean startOffsetBias, int endOffset, boolean endOffsetBias)
style
- the highlight style to usestartOffset
- the start of the highlighted segment of textstartOffsetBias
- the OffsetMark.BIAS_* for the start offsetendOffset
- the end of the highlighted segment of textendOffsetBias
- the OffsetMark.BIAS_* for the end offsetpublic 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 changeLineHighlight(HighlightedText highlightedLine, HighlightStyle newHighlightStyle, int newLine)
highlightedLine
- the highlighted line that was previously creatednewHighlightStyle
- new highlight stylenewLine
- the new line to move the highlight topublic 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(HighlightFragmentsList fragmentsList, int startOffset, int endOffset)
fragmentsList
- the list to add the text highlight fragments tostartOffset
- the start of the rendering areaendOffset
- the end of the rendering areapublic void renderHighlights(HighlightFragmentsList fragmentsList, int fetchPolicy, int startOffset, int endOffset)
fragmentsList
- the list to add the text highlight fragments tofetchPolicy
- the highlight fetch policy, such as whether to include
only line highlights with FETCH_LINE_HIGHLIGHTSstartOffset
- the start of the rendering areaendOffset
- the end of the rendering area
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-03 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |