APIdia Launch Partner
Top Description Methods
jfx.incubator.scene.control.richtext

public Interface SyntaxDecorator

Imports
jfx.incubator.scene.control.richtext.model.CodeTextModel, .RichParagraph

Decorates plain text by producing a RichParagraph.
Since
24

Method Summary

Modifier and TypeMethod and Description
public RichParagraph

Returns:

the decorated RichParagraph instance
createRichParagraph
(CodeTextModel
the model
model
,
int
the paragraph index
index
)

Creates a RichParagraph with syntax decoration for the given paragraph index.

public void
handleChange(CodeTextModel
the model
m
,
TextPos
start of the affected range
start
,
TextPos
end of the affected range
end
,
int
number of characters added before any added paragraphs
charsTop
,
int
number of paragraphs inserted
linesAdded
,
int
number of characters added after any inserted paragraphs
charsBottom
)

Receives the updates from the model, before any of the model's StyledTextModel.Listeners are notified.

Method Detail

createRichParagraphback to summary
public RichParagraph createRichParagraph(CodeTextModel model, int index)

Creates a RichParagraph with syntax decoration for the given paragraph index.

For simple cases, when decorations can be generated using the paragraph text, it can be obtained by calling CodeTextModel#getPlainText(int). This string is guaranteed to contain no control symbols except for TAB.

Alternatively, the syntax decorator may cache the syntax information, or create Markers at critical points in the model, or even perform processing in the background (provided the model supports concurrent access), culminating in sending a refresh even in the FX application thread by calling CodeTextModel#fireChangeEvent(TextPos, TextPos, int, int, int) method.

Parameters
model:CodeTextModel

the model

index:int

the paragraph index

Returns:RichParagraph

the decorated RichParagraph instance

handleChangeback to summary
public void handleChange(CodeTextModel m, TextPos start, TextPos end, int charsTop, int linesAdded, int charsBottom)

Receives the updates from the model, before any of the model's StyledTextModel.Listeners are notified.

The implementation might do nothing if the syntax can be determined based on the text of a single paragraph. Other implementations, which handle more complex syntax might want to re-build the syntax model any time the plain text document changes, should use this method to trigger the refresh.

Parameters
m:CodeTextModel

the model

start:TextPos

start of the affected range

end:TextPos

end of the affected range

charsTop:int

number of characters added before any added paragraphs

linesAdded:int

number of paragraphs inserted

charsBottom:int

number of characters added after any inserted paragraphs