Top Description Fields Constructors Methods
com.sun.jfx.incubator.scene.control.richtext

public final Class TextCell

extends BorderPane
Class Inheritance
Imports
java.util.Objects, javafx.geometry.Pos, javafx.scene.Node, javafx.scene.control.Label, javafx.scene.layout.BorderPane, .Region, javafx.scene.paint.Color, javafx.scene.shape.LineTo, .MoveTo, .PathElement, javafx.scene.text.TextFlow, com.sun.jfx.incubator.scene.control.richtext.util.RichUtils

Provides a visual representation of a paragraph.

Typically, a TextCell contains a TextFlow with styled text (and possibly inline Nodes). It is also possible to create a TextCell containing a single Region (which can be a Node of any complexity, even including a different instance of RichTextArea). These Regions will be presented as is, and, for editable models, would not be editable via the RichTextArea mechanisms.

Each visible TextCell will be resized horizontally to fill the available width and then resized vertically according to its preferred size for that width.

Field Summary

Modifier and TypeField and Description
private final Region
private double
private final int
private double
private double
y

Constructor Summary

AccessConstructor and Description
public
TextCell(int
paragraph index
index
,
Region
non-null content
content
)

Creates a text cell with the specified Region as its content.

public
TextCell(int
paragraph index
index
)

Creates a text cell with TextFlow as its content.

Method Summary

Modifier and TypeMethod and Description
public void
add(Node
the node to add
node
)

Adds a node to the text flow.

public void
addBoxOutline(FxPathBuilder b, double x, double w, double h)

public void
addHighlight(int
start offset for the range
start
,
int
end offset for the range
end
,
Color
highlight color
color
)

Highlights the specified text range.

public void
addHighlight(int
start offset for the range
start
,
int
end offset for the range
end
,
String...
CSS style names
styles
)

Highlights the specified text range, using style names.

public void
addSquiggly(int
start offset for the range
start
,
int
end offset for the range
end
,
Color
highlight color
color
)

Underlines the specified text range using squiggly line (as typically used by a spell checker).

public void
addSquiggly(int
start offset for the range
start
,
int
end offset for the range
end
,
String...
CSS style names
styles
)

Underlines the specified text range using squiggly line (as typically used by a spell checker), using style names.

public double
findHitCandidate(double py, boolean down)

private TextFlow
flow()

public PathElement[]

Returns:

the array of path elements translated to the target coordinates
getCaretShape
(Region
the Region that provides the target frame of reference
target
,
int
the character index
charIndex
,
boolean
the character bias
leading
)

Returns the PathElement array for the caret at the given character index and bias, translated to the target frame of reference.

public double

Returns:

y the cell height
getCellHeight
()

Valid only when cell is obtained from the arrangement.

public double
public final Region

Returns:

the content Region
getContent
()

Returns the content of this cell.

public final int

Returns:

model index (>=0)
getIndex
()

Returns the model index for this text cell.

public double

Returns:

the line spacing
getLineSpacing
()

Returns line spacing if the content is a TextFlow, 0.0 otherwise.

public PathElement[]

Returns:

the array of path elements translated to the target coordinates
getRangeShape
(Region
the Region that provides the target frame of reference
target
,
int
the start offset
start
,
int
the end offset
end
)

Returns the PathElement array for the range shape, translated to the target frame of reference.

public int

Returns:

the text length
getTextLength
()

Returns the length of text in this cell.

private RangeInfo
public double

Returns:

y coordinate relative to origin
getY
()

Valid only when cell is obtained from the arrangement.

public boolean
isInsideText(double x, double y, boolean down)

public Integer
lineEdge(boolean start, int caretIndex, int caretOffset)

public Integer

Returns:

the line offset
lineEnd
(int
the line index
line
)

Returns the line end offset of the given line index.

public Integer

Returns:

the line index
lineForOffset
(int
the character offset
offset
)

Returns the line index of the given character offset.

public Integer

Returns:

the line start offset
lineStart
(int
the line index
line
)

Returns the line start offset of the given line index.

public void
setBullet(String bullet)

Sets the bullet decoration by adding a Label with the specified character.

public void
setCellWidth(double w)

pack-priv void
setPosition(double y, double height)

sets cell position along the y axis of this cell in VFlow coordinates

private static TextFlow
Inherited from javafx.scene.layout.BorderPane:
bottomPropertycenterPropertyclearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthgetAlignmentgetBottomgetCentergetContentBiasgetLeftgetMargingetRightgetToplayoutChildrenleftPropertyrightPropertysetAlignmentsetBottomsetCentersetLeftsetMarginsetRightsetToptopProperty

Field Detail

contentback to summary
private final Region content
heightback to summary
private double height

Hides javafx.scene.layout.Region.height.

indexback to summary
private final int index
widthback to summary
private double width

Hides javafx.scene.layout.Region.width.

yback to summary
private double y

Constructor Detail

TextCellback to summary
public TextCell(int index, Region content)

Creates a text cell with the specified Region as its content.

Parameters
index:int

paragraph index

content:Region

non-null content

TextCellback to summary
public TextCell(int index)

Creates a text cell with TextFlow as its content.

Parameters
index:int

paragraph index

Method Detail

addback to summary
public void add(Node node)

Adds a node to the text flow.

Parameters
node:Node

the node to add

addBoxOutlineback to summary
public void addBoxOutline(FxPathBuilder b, double x, double w, double h)
addHighlightback to summary
public void addHighlight(int start, int end, Color color)

Highlights the specified text range.

Parameters
start:int

start offset for the range

end:int

end offset for the range

color:Color

highlight color

addHighlightback to summary
public void addHighlight(int start, int end, String... styles)

Highlights the specified text range, using style names.

Parameters
start:int

start offset for the range

end:int

end offset for the range

styles:String[]

CSS style names

addSquigglyback to summary
public void addSquiggly(int start, int end, Color color)

Underlines the specified text range using squiggly line (as typically used by a spell checker).

Parameters
start:int

start offset for the range

end:int

end offset for the range

color:Color

highlight color

addSquigglyback to summary
public void addSquiggly(int start, int end, String... styles)

Underlines the specified text range using squiggly line (as typically used by a spell checker), using style names.

Parameters
start:int

start offset for the range

end:int

end offset for the range

styles:String[]

CSS style names

findHitCandidateback to summary
public double findHitCandidate(double py, boolean down)
flowback to summary
private TextFlow flow()
getCaretShapeback to summary
public PathElement[] getCaretShape(Region target, int charIndex, boolean leading)

Returns the PathElement array for the caret at the given character index and bias, translated to the target frame of reference.

Parameters
target:Region

the Region that provides the target frame of reference

charIndex:int

the character index

leading:boolean

the character bias

Returns:PathElement[]

the array of path elements translated to the target coordinates

getCellHeightback to summary
public double getCellHeight()

Valid only when cell is obtained from the arrangement.

Returns:double

y the cell height

getCellWidthback to summary
public double getCellWidth()
getContentback to summary
public final Region getContent()

Returns the content of this cell.

Returns:Region

the content Region

getIndexback to summary
public final int getIndex()

Returns the model index for this text cell.

Returns:int

model index (>=0)

getLineSpacingback to summary
public double getLineSpacing()

Returns line spacing if the content is a TextFlow, 0.0 otherwise.

Returns:double

the line spacing

getRangeShapeback to summary
public PathElement[] getRangeShape(Region target, int start, int end)

Returns the PathElement array for the range shape, translated to the target frame of reference.

Parameters
target:Region

the Region that provides the target frame of reference

start:int

the start offset

end:int

the end offset

Returns:PathElement[]

the array of path elements translated to the target coordinates

getTextLengthback to summary
public int getTextLength()

Returns the length of text in this cell. A cell containing a non-text content will return 0.

Returns:int

the text length

getTextRangeback to summary
private RangeInfo getTextRange()
getYback to summary
public double getY()

Valid only when cell is obtained from the arrangement.

Returns:double

y coordinate relative to origin

isInsideTextback to summary
public boolean isInsideText(double x, double y, boolean down)
lineEdgeback to summary
public Integer lineEdge(boolean start, int caretIndex, int caretOffset)
lineEndback to summary
public Integer lineEnd(int line)

Returns the line end offset of the given line index.

Parameters
line:int

the line index

Returns:Integer

the line offset

lineForOffsetback to summary
public Integer lineForOffset(int offset)

Returns the line index of the given character offset.

Parameters
offset:int

the character offset

Returns:Integer

the line index

lineStartback to summary
public Integer lineStart(int line)

Returns the line start offset of the given line index.

Parameters
line:int

the line index

Returns:Integer

the line start offset

setBulletback to summary
public void setBullet(String bullet)

Sets the bullet decoration by adding a Label with the specified character.

setCellWidthback to summary
public void setCellWidth(double w)
setPositionback to summary
pack-priv void setPosition(double y, double height)

sets cell position along the y axis of this cell in VFlow coordinates

textFlowback to summary
private static TextFlow textFlow()