Extension SDK 10.1.2

oracle.javatools.editor.language
Interface DocumentRenderer

All Known Implementing Classes:
AbstractDocumentRenderer

public interface DocumentRenderer

The DocumentRenderer interface describes the routines needed for rendering an entire document. The rendering process generates a set of styled fragments which can be used for painting or printing a document.

The DocumentRenderer is the point of contact responsible for rendering the whole document. In many cases, it may delegate the rendering of various regions of the document to individual BlockRenderers. For example, a JavaDocumentRenderer may delegate rendering of a Java document to a JavaBlockRenderer and a SQLJBlockRenderer. 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:
BlockRenderer

Method Summary
 void calculateDamage(javax.swing.event.DocumentEvent changes, NumberRange damageRange)
          Calculates what range of the document is "damaged" or needs to be repainted based on a given insert or removal of text.
 void notifyUpdate(javax.swing.event.DocumentEvent changes)
          Notifies the DocumentRenderer that the given document has been updated - this allows DocumentRenderers which cache offset information to update or invalidate their cache.
 void recycleFragmentsList(StyledFragmentsList fragmentsList)
          Recyle the previously gotten StyledFragment's to reduce memory allocations.
 StyledFragmentsList renderLines(int startLine, int endLine)
          Renders a region of text based on the line information provided.
 

Method Detail

renderLines

public StyledFragmentsList renderLines(int startLine,
                                       int endLine)
Renders a region of text based on the line information provided. The startLine and endLine are both inclusive, for example, with startLine of 1 and endLine of 5, renderLines will render 5 lines.

Parameters:
startLine - the line to start rendering from (inclusive)
endLine - the last line to render (inclusive)
Returns:
StyledFragmentsList for rendering the given region

calculateDamage

public void calculateDamage(javax.swing.event.DocumentEvent changes,
                            NumberRange damageRange)
Calculates what range of the document is "damaged" or needs to be repainted based on a given insert or removal of text. As with renderLines(), starting and ending offsets returned via damageRange are both inclusive. (This is different from endingOffsets, which are generally exclusive.) This is called only when the insert or removal does not change the line count (which would change the size of the text component and force a full repaint.)

Parameters:
changes - the document event indicating what changed
damageRange - the number range to return the damage range in

notifyUpdate

public void notifyUpdate(javax.swing.event.DocumentEvent changes)
Notifies the DocumentRenderer that the given document has been updated - this allows DocumentRenderers which cache offset information to update or invalidate their cache.

Parameters:
changes - the document event indicating what changed

recycleFragmentsList

public void recycleFragmentsList(StyledFragmentsList fragmentsList)
Recyle the previously gotten StyledFragment's to reduce memory allocations.


Extension SDK

 

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