APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.jfx.incubator.scene.control.richtext

public final Class TextCell

extends BorderPane
Class Inheritance
Imports
java.util.ArrayList, .Collections, .Comparator, .HashMap, .List, .Objects, java.util.concurrent.CopyOnWriteArrayList, 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.TabStopPolicy, .Text, .TextFlow, com.sun.jfx.incubator.scene.control.richtext.util.RichUtils, jfx.incubator.scene.control.richtext.model.StyleAttribute, .StyleAttributeMap, .TabStops, jfx.incubator.scene.control.richtext.skin.CellContext

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
TextCell.DecorationRun

Decoration run spans multiple segments.

private static class
TextCell.Decorator

keeps track of coalesced decorated runs

Field Summary

Modifier and TypeField and Description
private List<RequiresComplexLayout>
private final Region
private TextCell.Decorator
private boolean
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
,
boolean
whether the content is a paragraph
embedsNode
)

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 non-text 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
addTextSegment(Text
the text segment
t
)

Adds a text segment to the text flow.

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

Underlines the specified text range with wavy underline (as typically used by a spell checker).

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

Underlines the specified text range with wavy underline (as typically used by a spell checker), using style names.

public void
applyDecorations()

Applies decorations in a consistent order (sorted by style name).

private void
public void
decorateRun(int length, StyleAttribute<?> a, CellContext.RunDecor type, String styleName)

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 PathElement[]

Returns:

the array of path elements translated to the target coordinates
getUnderlineShape
(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 underline shape, translated to the target frame of reference.

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
requestLayout()

Overrides javafx.scene.Parent.requestLayout.

Requests a layout pass to be performed before the next scene is rendered.

public void
setBullet(String bullet)

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

public void
setCellWidth(double w)

public void
setParagraphAttributes(StyleAttributeMap a, double defaultInterval)

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

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

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

Field Detail

clientsback to summary
private List<RequiresComplexLayout> clients
contentback to summary
private final Region content
decoratorback to summary
private TextCell.Decorator decorator
embedsNodeback to summary
private boolean embedsNode
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, boolean embedsNode)

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

Parameters
index:int

paragraph index

content:Region

non-null content

embedsNode:boolean

whether the content is a paragraph

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 non-text 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

addTextSegmentback to summary
public void addTextSegment(Text t)

Adds a text segment to the text flow.

Parameters
t:Text

the text segment

addWavyUnderlineback to summary
public void addWavyUnderline(int start, int end, Color color)

Underlines the specified text range with wavy underline (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

addWavyUnderlineback to summary
public void addWavyUnderline(int start, int end, String... styles)

Underlines the specified text range with wavy underline (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

applyDecorationsback to summary
public void applyDecorations()

Applies decorations in a consistent order (sorted by style name).

checkClientback to summary
private void checkClient(Node n)
decorateRunback to summary
public void decorateRun(int length, StyleAttribute<?> a, CellContext.RunDecor type, String styleName)
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()
getUnderlineShapeback to summary
public PathElement[] getUnderlineShape(Region target, int start, int end)

Returns the PathElement array for the underline 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

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

requestLayoutback to summary
public void requestLayout()

Overrides javafx.scene.Parent.requestLayout.

Doc from javafx.scene.Parent.requestLayout.

Requests a layout pass to be performed before the next scene is rendered. This is batched up asynchronously to happen once per "pulse", or frame of animation.

If this parent is either a scene root or unmanaged, then it will be added directly to the scene's dirty layout list, otherwise requestParentLayout will be invoked.

Annotations
@Override
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)
setParagraphAttributesback to summary
public void setParagraphAttributes(StyleAttributeMap a, double defaultInterval)
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()
updateVFlowContextback to summary
public void updateVFlowContext(VFlow f)
com.sun.jfx.incubator.scene.control.richtext back to summary

private Class TextCell.DecorationRun

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.jfx.incubator.scene.control.richtext.TextCell.DecorationRun

Decoration run spans multiple segments.

Field Summary

Modifier and TypeField and Description
public int
public final int
public final String
public final CellContext.RunDecor

Constructor Summary

AccessConstructor and Description
public
DecorationRun(CellContext.RunDecor type, String styleName, int start, int length)

Method Summary

Modifier and TypeMethod and Description
public void
extend(int length)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endback to summary
public int end
startback to summary
public final int start
styleNameback to summary
public final String styleName
typeback to summary
public final CellContext.RunDecor type

Constructor Detail

DecorationRunback to summary
public DecorationRun(CellContext.RunDecor type, String styleName, int start, int length)

Method Detail

extendback to summary
public void extend(int length)
com.sun.jfx.incubator.scene.control.richtext back to summary

private Class TextCell.Decorator

extends Object
Class Inheritance
  • java.lang.Object
  • com.sun.jfx.incubator.scene.control.richtext.TextCell.Decorator

keeps track of coalesced decorated runs

Field Summary

Modifier and TypeField and Description
private HashMap<StyleAttribute<?>, TextCell.DecorationRun>
private final TextFlow
private int
private int
private final ArrayList<TextCell.DecorationRun>
private static Comparator<TextCell.DecorationRun>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addRun(int length, StyleAttribute<?> a, CellContext.RunDecor type, String styleName)

public ArrayList<TextCell.DecorationRun>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byTypeback to summary
private HashMap<StyleAttribute<?>, TextCell.DecorationRun> byType
flowback to summary
private final TextFlow flow
lastCountback to summary
private int lastCount
offsetback to summary
private int offset
runsback to summary
private final ArrayList<TextCell.DecorationRun> runs
sorterback to summary
private static Comparator<TextCell.DecorationRun> sorter

Constructor Detail

Decoratorback to summary
public Decorator(TextFlow flow)

Method Detail

addRunback to summary
public void addRun(int length, StyleAttribute<?> a, CellContext.RunDecor type, String styleName)
getSortedRunsback to summary
public ArrayList<TextCell.DecorationRun> getSortedRuns()