CodeTextModel (JavaFX 28)
Description: declaration: module: jfx.incubator.richtext, package: jfx.incubator.scene.control.richtext.model, class: CodeTextModel

# Class CodeTextModel

java.lang.Object
jfx.incubator.scene.control.richtext.model.StyledTextModel
jfx.incubator.scene.control.richtext.model.BasicTextModel
jfx.incubator.scene.control.richtext.model.CodeTextModel

public class CodeTextModel extends BasicTextModel
Editable plain text model with optional syntax highlighting for use with the `CodeArea` control.

This model supports custom content storage mechanism via `BasicTextModel.Content`. By default, the model provides an in-memory storage via its `BasicTextModel.InMemoryContent` implementation.

Since:
  24

- ## Nested Class Summary

  ### Nested classes/interfaces declared in class BasicTextModel

  `BasicTextModel.Content, BasicTextModel.InMemoryContent`

  ### Nested classes/interfaces declared in class StyledTextModel

  `StyledTextModel.Listener`

- ## Property Summary

  Properties
  Type
  Property
  Description
  `final ObjectProperty<SyntaxDecorator>`
  `decorator`
  Syntax decorator applies styling to the plain text stored in the model.

  ### Properties declared in class StyledTextModel

  `redoable, undoable`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodeTextModel()`
  Constructs the CodeTextModel with an in-memory content.
  `CodeTextModel(BasicTextModel.Content c)`
  Constructs the CodeTextModel with the specified content.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final ObjectProperty<SyntaxDecorator>`
  `decoratorProperty()`
  Syntax decorator applies styling to the plain text stored in the model.
  `final SyntaxDecorator`
  `getDecorator()`
  Gets the value of the `decorator` property.
  `final RichParagraph`
  `getParagraph(int index)`
  Returns a `RichParagraph` at the given model index.
  `final void`
  `setDecorator(SyntaxDecorator d)`
  Sets the value of the `decorator` property.

  ### Methods declared in class BasicTextModel

  `applyParagraphStyle, applyStyle, getPlainText, getStyleAttributeMap, insertLineBreak, insertParagraph, insertText, insertTextSegment, isWritable, removeRange, setParagraphStyle, size`

  ### Methods declared in class StyledTextModel

  `addListener, applyStyle, clamp, clearUndoRedo, documentProperties, export, exportParagraph, fireChangeEvent, fireStyleChangeEvent, getDataFormatHandler, getDocumentEnd, getEndOfParagraphTextPos, getLineEnding, getMarker, getParagraphLength, getSupportedAttributes, getSupportedDataFormats, handleDocumentProperties, isRedoable, isUndoable, isUndoRedoEnabled, read, redo, redoableProperty, registerDataFormatHandler, removeDataFormatHandler, removeListener, replace, replace, setLineEnding, setUndoRedoEnabled, undo, undoableProperty, versionString, write`

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Property Details

  - ### decorator

    public final ObjectProperty<SyntaxDecorator> decoratorProperty
    Syntax decorator applies styling to the plain text stored in the model.
    See Also:
      - `getDecorator()`
      - `setDecorator(SyntaxDecorator)`
      - `decoratorProperty()`

- ## Constructor Details

  - ### CodeTextModel

    public CodeTextModel()
    Constructs the CodeTextModel with an in-memory content.

  - ### CodeTextModel

    public CodeTextModel(BasicTextModel.Content c)
    Constructs the CodeTextModel with the specified content.
    Parameters:
      `c` - the content

- ## Method Details

  - ### getParagraph

    public final RichParagraph getParagraph(int index)
    Description copied from class: `StyledTextModel`
    Returns a `RichParagraph` at the given model index. The callers must ensure that the value of `index` is within the valid document range, since doing otherwise might result in an exception or undetermined behavior.

    This method makes no guarantees that the same paragraph instance will be returned for the same model index.

    Specified by:
      `getParagraph` in class `StyledTextModel`
    Parameters:
      `index` - the paragraph index in the range (0...`StyledTextModel.size()`)
    Returns:
      the instance of `RichParagraph`

  - ### decoratorProperty

    public final ObjectProperty<SyntaxDecorator> decoratorProperty()
    Syntax decorator applies styling to the plain text stored in the model.
    Returns:
      the syntax decorator value (may be null)
    See Also:
      - `getDecorator()`
      - `setDecorator(SyntaxDecorator)`

  - ### getDecorator

    public final SyntaxDecorator getDecorator()
    Gets the value of the `decorator` property.
    Property description:
      Syntax decorator applies styling to the plain text stored in the model.
    Returns:
      the value of the `decorator` property
    See Also:
      - `setDecorator(SyntaxDecorator)`
      - `decoratorProperty()`

  - ### setDecorator

    public final void setDecorator(SyntaxDecorator d)
    Sets the value of the `decorator` property.
    Property description:
      Syntax decorator applies styling to the plain text stored in the model.
    Parameters:
      `d` - the value for the `decorator` property
    See Also:
      - `getDecorator()`
      - `decoratorProperty()`