CellContext (JavaFX 28)
Description: declaration: module: jfx.incubator.richtext, package: jfx.incubator.scene.control.richtext.skin, interface: CellContext

# Interface CellContext

public interface CellContext
This interface provides a mechanism for the Skin to support custom `StyleAttribute`s. During the layout pass, the cell context is passed to the Skin so the latter can add inline style(s) to either the paragraph Node (typically `TextFlow`) or the text segment Node (`Text`).

Since:
  24
See Also:
  - `RichTextAreaSkin.applyStyles(CellContext, StyleAttributeMap, boolean)`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `CellContext.RunDecor`
  Specifies the decoration type to be applied to multiple text segments.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addStyle(String fxStyle)`
  Adds an inline style.
  `<T> void`
  `decorateRun(StyleAttribute<T> a, CellContext.RunDecor type, String styleName)`
  Decorates the current segment with the specified attribute by coalescing adjacent runs into a single decoration pass.
  `StyleAttributeMap`
  `getAttributes()`
  Returns the current attributes.
  `Node`
  `getNode()`
  Returns the node being styled.

- ## Method Details

  - ### addStyle

    void addStyle(String fxStyle)
    Adds an inline style.

    The inline style must be a valid CSS style string, for example `"-fx-font-size:15px;"`. This string might contain multiple CSS properties.

    Parameters:
      `fxStyle` - the inline style string

  - ### getNode

    Node getNode()
    Returns the node being styled.

    This might be a TextFlow (for the paragraph cell context) or Text (for the text segment cell context).

    Returns:
      the node being styled.

  - ### getAttributes

    StyleAttributeMap getAttributes()
    Returns the current attributes.
    Returns:
      the current attributes.

  - ### decorateRun

    <T> void decorateRun(StyleAttribute<T> a, CellContext.RunDecor type, String styleName)
    Decorates the current segment with the specified attribute by coalescing adjacent runs into a single decoration pass.

    This method is used when the visual representation requires uninterrupted segments instead of several adjacent ones, for example in the case of wavy underline, in order to avoid breaks in the wave. This method expects that for any attribute the corresponding type and styleName are the same.

    Type Parameters:
      `T` - the attribute type
    Parameters:
      `a` - the attribute
      `type` - the decoration type
      `styleName` - the style name
    Since:
      27