# 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.Listener`s 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 `Marker`s 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.Listener`s 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