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 theNode
returned will be used to size all other nodes for that side.
- Since:
- 24
-
Method Summary
Modifier and TypeMethodDescriptiongetMeasurementNode
(int index) Returns the special measurement node to use for sizing the pane that holds the side decorations.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 decorationNode
s.
-
Method Details
-
getPrefWidth
double getPrefWidth(double viewWidth) Returns the width to size the pane which hosts the side decorationNode
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 viagetMeasurementNode(int)
, whose preferred width will be used instead.- Parameters:
viewWidth
- width of the view- Returns:
- the preferred width
-
getMeasurementNode
Returns the special measurement node to use for sizing the pane that holds the side decorations. This method will only be called ifgetPrefWidth(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
Creates a Node to be added to the layout to the right or to the left of the given paragraph. This method may returnnull
.- Parameters:
index
- the paragraph index- Returns:
- new instance
Node
-