|
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.language.LexerBlockRenderer
The LexerBlockRenderer
is the abstract starting point
for BlockRenderer
implementations based on languages
for which there is a Lexer
implementation available.
This takes care of implementing common functionality.
BlockRenderer
,
Lexer
Field Summary | |
protected Lexer |
lexer
The Lexer that is used for tokenizing. |
protected LexerToken |
lexerToken
The LexerToken structure for interfacing with the Lexer. |
protected TextBuffer |
textBuffer
The text buffer that we are rendering. |
Constructor Summary | |
LexerBlockRenderer(TextBuffer textBuffer)
Constructs a new block renderer for the specified document. |
Method Summary | |
protected abstract Lexer |
createLexer()
Creates a Lexer used for breaking apart tokens in the primary language of this BlockRenderer implementation. |
protected java.lang.String |
getDefaultStyleName()
Fetches the default style to use for rendering text that does not have an associated token. |
protected Lexer |
getLexer()
Get a cached language-specific Lexer (so that we don't have to constantly recreate it every time.) |
protected LexerToken |
getLexerToken()
Get a cached lexer-specific LexerToken (that we don't have to recreate every time) from the Lexer. |
TextBuffer |
getTextBuffer()
Fetches the text buffer that this block renderer is rendering. |
protected abstract java.lang.String |
mapTokenToStyleName(int token)
Fetches the style to use for the token fetched from the Lexer. |
void |
renderBlock(StyledFragmentsList fragmentsList,
int blockStartOffset,
int blockEndOffset,
int clipStartOffset,
int clipEndOffset)
Renders the region of text bounded by the given offsets. |
protected void |
renderToken(StyledFragmentsList fragmentsList,
int token,
int tokenStart,
int tokenEnd,
int clipStart,
int clipEnd)
Renders the token by mapping the given token to a specific style, and adds it to the styled fragments list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected TextBuffer textBuffer
protected Lexer lexer
protected LexerToken lexerToken
Constructor Detail |
public LexerBlockRenderer(TextBuffer textBuffer)
textBuffer
- the text buffer to renderMethod Detail |
public TextBuffer getTextBuffer()
protected abstract Lexer createLexer()
BlockRenderer
implementation.
protected final Lexer getLexer()
protected final LexerToken getLexerToken()
public void renderBlock(StyledFragmentsList fragmentsList, int blockStartOffset, int blockEndOffset, int clipStartOffset, int clipEndOffset)
blockStartOffset
to
blockEndOffset
) marks the start and end of the
block for the given language. This can be used for example to
set the starting position of a language-specific Lexer
.
The second set, clipStartOffset
to
clipEndOffset
marks the clip region within which the
block should be rendered. Implementations must not add fragments
to the fragments list outside the range of these clip offsets,
otherwise, an internal exception will occur (this is different
from the clip bounds for graphics areas.)
renderBlock
in interface BlockRenderer
fragmentsList
- the fragments list which rendered fragments
should be appended toblockStartOffset
- the starting offset of the language blockblockEndOffset
- the ending offset of the language blockclipStartOffset
- the starting offset of the region to renderclipEndOffset
- the ending offset of the region to renderprotected void renderToken(StyledFragmentsList fragmentsList, int token, int tokenStart, int tokenEnd, int clipStart, int clipEnd)
BlockRenderer
implementation. Do
not add fragments outside of the clip region, or else an internal
exception will occur.
fragmentsList
- the styled fragments listtoken
- the token to rendertokenStart
- the starting offset of the token (inclusive)tokenEnd
- the ending offset of the token (exclusive)clipStart
- the start of the clip offsetclipEnd
- the end of the clip offsetprotected abstract java.lang.String mapTokenToStyleName(int token)
token
- the token fetched
protected java.lang.String getDefaultStyleName()
|
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.