Extension SDK 10.1.2

oracle.javatools.editor.language
Interface BlockRenderer

All Known Implementing Classes:
LexerBlockRenderer

public interface BlockRenderer

The BlockRenderer interface describes the routines needed for rendering a block or region of text from a document. The rendering process generates a set of styled fragments which can be used for painting or printing a document.

The given block or region should be in a language (such as Java) which the given BlockRenderer implementation can render. For example, a JavaBlockRenderer implementation should be able to render a chunk of Java code.

Note that a given BlockRenderer implementation may delegate further sub-blocks of text to other BlockRenderer implementations. For example, a JavaBlockRenderer implementation may delegate the rendering of a chunk of SQLJ code to a SQLJBlockRenderer implementation. This allows us the flexibility to combine multiple BlockRenderers to support multiplex languages, such as JSP documents.

It is expected that implementations of this interface will be called only for the purposes of painting or printing. As such, it is up to the caller (such as BasicView) to handle proper document locking. There is no requirement for BlockRenderer implementations to handle document locking.

When syntax highlighting styles change, any DocumentRenderers in use will be notified to reload their styles through reloadStyles(). It is the responsibility of the DocumentRenderers to notify their block renderers in turn to reload their styles (if necessary.)

Lastly, since BlockRenderer implementations are used primarily for rendering, they are not allowed to make modifications to the underlying document.

See Also:
DocumentRenderer

Method Summary
 void renderBlock(StyledFragmentsList fragmentsList, int blockStartOffset, int blockEndOffset, int clipStartOffset, int clipEndOffset)
          Renders the region of text bounded by the given offsets.
 

Method Detail

renderBlock

public void renderBlock(StyledFragmentsList fragmentsList,
                        int blockStartOffset,
                        int blockEndOffset,
                        int clipStartOffset,
                        int clipEndOffset)
Renders the region of text bounded by the given offsets. The styles generated should be added (appended) to the provided fragments list. There are two sets of offsets provided. The first set, 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.)

Parameters:
fragmentsList - the fragments list which rendered fragments should be appended to
blockStartOffset - the starting offset of the language block
blockEndOffset - the ending offset of the language block
clipStartOffset - the starting offset of the region to render
clipEndOffset - the ending offset of the region to render

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.