public abstract class AbstractDocumentRenderer extends java.lang.Object implements DocumentRenderer2
AbstractDocumentRenderer is the base class for all
DocumentRenderers provided with this editor component.
It takes care of implementing common functionality. DocumentRenderer| Constructor and Description |
|---|
AbstractDocumentRenderer(LanguageSupport support)
Constructs a new style provider for the specified document.
|
| Modifier and Type | Method and Description |
|---|---|
protected StyledFragmentsList |
allocateFragmentsList()
Routine available to DocumentRenderer implementations to allocate
a fragments list (for reuse) which is not in use.
|
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.
|
BasicDocument |
getDocument()
Convenience method for fetching the document associated with this
provider.
|
LineMap |
getLineMap()
Convenience method for fetching the linemap of the document.
|
TextBuffer |
getTextBuffer()
Convenience method for fetching the text buffer associated with
this provider.
|
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)
Recycle 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.
|
StyledFragmentsList |
renderOffets(int startOffset,
int endOffset)
Renders a region of text based on the offset information provided.
|
abstract void |
renderRegion(StyledFragmentsList fragmentsList,
int startOffset,
int endOffset)
Renders the region of text bounded by the given offsets.
|
public AbstractDocumentRenderer(LanguageSupport support)
support - the language supportpublic final BasicDocument getDocument()
public final TextBuffer getTextBuffer()
public final LineMap getLineMap()
public StyledFragmentsList renderLines(int startLine, int endLine)
renderLines in interface DocumentRendererstartLine - the line to start rendering from (inclusive)endLine - the last line to render (inclusive)public StyledFragmentsList renderOffets(int startOffset, int endOffset)
DocumentRenderer2renderOffets in interface DocumentRenderer2startOffset - the offset to start rendering from (inclusive)endOffset - the last offset to render (inclusive)public abstract void renderRegion(StyledFragmentsList fragmentsList, int startOffset, int endOffset)
fragmentsList - the styled fragments list to added our styles tostartOffset - the starting offset to render from (inclusive)endOffset - the ending offset to render to (exclusive)public void calculateDamage(javax.swing.event.DocumentEvent changes,
NumberRange damageRange)
calculateDamage in interface DocumentRendererchanges - the document event indicating what changeddamageRange - the number range to return the damage range inpublic void notifyUpdate(javax.swing.event.DocumentEvent changes)
notifyUpdate in interface DocumentRendererchanges - the document event indicating what changedpublic final void recycleFragmentsList(StyledFragmentsList fragmentsList)
recycleFragmentsList in interface DocumentRendererfragments - the fragments to recycleprotected final StyledFragmentsList allocateFragmentsList()