Spec-Zone.ru › OpenJavaFX 24

Interface SyntaxDecorator

public interface SyntaxDecorator
Decorates plain text by producing a RichParagraph.
Since:
24

Method Summary

Modifier and Type Method Description
RichParagraph createRichParagraph(CodeTextModel model, int index)
Creates a RichParagraph with syntax decoration for the given paragraph index.
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.

Method Details

createRichParagraph

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 BasicTextModel.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 StyledTextModel.fireChangeEvent(TextPos, TextPos, int, int, int) method.

Parameters:
model - the model
index - the paragraph index
Returns:
the decorated RichParagraph instance

handleChange

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 - the model
start - start of the affected range
end - end of the affected range
charsTop - number of characters added before any added paragraphs
linesAdded - number of paragraphs inserted
charsBottom - number of characters added after any inserted paragraphs

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API