TextFlow that can paint real background rectangles behind character ranges —
used for <mark>/background-color runs (JabRef's search-hit highlighting) and
for the text selection driven by TextSelection.
The backgrounds live in unmanaged, mouse-transparent Groups that are the first children,
so they render behind the text and are ignored by the flow's text layout. Shapes are
recomputed from TextFlow#rangeShape after every layout pass.
Character indices are relative to the flow's text layout: each Text child contributes
its text length, every other managed child (e.g. an embedded image) counts as one character.
| Modifier and Type | Class and Description |
|---|---|
| private static record |
| Modifier and Type | Field and Description |
|---|---|
| private final Group | |
| private final List | |
| private static final Paint | SELECTION_FILL
Fallback selection color; the stylesheet overrides it via |
| private int | |
| private final Group | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | |
| public void | |
| protected void | layoutChildren()
Overrides javafx. Invoked during the layout pass to layout the children in this
|
| private void | |
| public void | setSelectionRange(int start, int end)
Marks |
| public String | textInRange(int start, int end)
Extracts the text of |
| highlightLayer | back to summary |
|---|---|
| private final Group highlightLayer | |
| ranges | back to summary |
|---|---|
| private final List<HighlightTextFlow. | |
| SELECTION_FILL | back to summary |
|---|---|
| private static final Paint SELECTION_FILL Fallback selection color; the stylesheet overrides it via | |
| selectionEnd | back to summary |
|---|---|
| private int selectionEnd | |
| selectionLayer | back to summary |
|---|---|
| private final Group selectionLayer | |
| selectionStart | back to summary |
|---|---|
| private int selectionStart | |
| HighlightTextFlow | back to summary |
|---|---|
| public HighlightTextFlow() | |
| addHighlight | back to summary |
|---|---|
| public void addHighlight(int start, int end, Paint fill) | |
| charLength | back to summary |
|---|---|
public int charLength()
| |
| clearSelectionRange | back to summary |
|---|---|
| public void clearSelectionRange() | |
| layoutChildren | back to summary |
|---|---|
| protected void layoutChildren() Overrides javafx. Doc from javafx. Invoked during the layout pass to layout the children in this
Subclasses should override this function to layout content as needed.
| |
| layoutRangeLayer | back to summary |
|---|---|
| private void layoutRangeLayer(Group layer, List<HighlightTextFlow. | |
| setSelectionRange | back to summary |
|---|---|
| public void setSelectionRange(int start, int end) Marks | |
| textInRange | back to summary |
|---|---|
| public String textInRange(int start, int end) Extracts the text of | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final Paint | |
| private final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public Paint | |
| public final int | |
| public int | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| end | back to summary |
|---|---|
| private final int end Record Component accessed by end(). | |
| fill | back to summary |
|---|---|
| private final Paint fill Record Component accessed by fill(). | |
| start | back to summary |
|---|---|
| private final int start Record Component accessed by start(). | |
| HighlightRange | back to summary |
|---|---|
| private HighlightRange(int start, int end, Paint fill) | |
| end | back to summary |
|---|---|
| public int end() Record Component getter of end. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| fill | back to summary |
|---|---|
| public Paint fill() Record Component getter of fill. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| start | back to summary |
|---|---|
| public int start() Record Component getter of start. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |