SideDecorator (JavaFX 25)
Description: declaration: module: jfx.incubator.richtext, package: jfx.incubator.scene.control.richtext, interface: SideDecorator

# Interface SideDecorator

All Known Implementing Classes:
  `LineNumberDecorator`

public interface SideDecorator
Provides a way to add side decorations to each paragraph in a `RichTextArea`.

The side decorations Nodes are added to either left or right side of each paragraph. Each side node will be resized to the height of the corresponding paragraph. The width of all the side nodes, in order to avoid complicated layout process, would be determined by the following process:

- if `getPrefWidth(double)` method returns a value greater than 0, that will be the width of all the side nodes.
- otherwise, the `getMeasurementNode(int)` method is called. The preferred width of the `Node` returned will be used to size all other nodes for that side.

Since:
  24

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Node`
  `getMeasurementNode(int index)`
  Returns the special measurement node to use for sizing the pane that holds the side decorations.
  `Node`
  `getNode(int index)`
  Creates a Node to be added to the layout to the right or to the left of the given paragraph.
  `double`
  `getPrefWidth(double viewWidth)`
  Returns the width to size the pane which hosts the side decoration `Node`s.

- ## Method Details

  - ### getPrefWidth

    double getPrefWidth(double viewWidth)
    Returns the width to size the pane which hosts the side decoration `Node`s.

    When return value is 0 or negative, an alternative method to size the side pane hosting the decoration will be used: a special measurement `Node` will be obtained via `getMeasurementNode(int)`, whose preferred width will be used instead.

    Parameters:
      `viewWidth` - width of the view
    Returns:
      the preferred width

  - ### getMeasurementNode

    Node getMeasurementNode(int index)
    Returns the special measurement node to use for sizing the pane that holds the side decorations. This method will only be called if `getPrefWidth(double)` returns 0 or negative value. The measurement node will not be displayed and will be discarded.
    Parameters:
      `index` - the paragraph index at the top of the viewable area
    Returns:
      the measurement `Node`

  - ### getNode

    Node getNode(int index)
    Creates a Node to be added to the layout to the right or to the left of the given paragraph. This method may return `null`.
    Parameters:
      `index` - the paragraph index
    Returns:
      new instance `Node`