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

public Class CellArrangement

extends Object
Class Inheritance
Imports
java.util.ArrayList, javafx.collections.ObservableList, javafx.geometry.Point2D, javafx.scene.Node, javafx.scene.layout.Pane, .Region, javafx.scene.shape.PathElement, javafx.scene.text.HitInfo, .TextFlow, com.sun.jfx.incubator.scene.control.richtext.util.RichUtils, jfx.incubator.scene.control.richtext.TextPos

Manages TextCells in a sliding window, comprised of the visible area and some number of screenfuls before and after the visible area, for the purposes of layout. The purpose is to estimating the average paragraph height, and to support relative navigation.

Uses Vflow.content coordinates.

Field Summary

Modifier and TypeField and Description
private int
private double
private final ArrayList<TextCell>
private final double
private final double
private final double
private final double
private Node[]
private final int
private final Origin
private Node[]
private double
private double
private int

Constructor Summary

AccessConstructor and Description
public
CellArrangement(VFlow f, double contentPaddingTop, double contentPaddingBottom)

Method Summary

Modifier and TypeMethod and Description
public void
public void
addLeftNode(int index, Node n)

public void
addRightNode(int index, Node n)

public double
private int
binarySearch(double localY, int low, int high)

finds a model index of a cell that contains the given localY.

public int
bottomCount()

visible + bottom margin cells

public double
bottomHeight()

in pixels from the first visible cell to the last cell in the arrangement

public int
bottomIndex()

returns a model index of the last cell in the sliding window bottom margin + 1

public int
private int
compare(TextCell cell, double localY)

public double
public CaretInfo

Returns:

the new CaretInfo
getCaretInfo
(Region
the target region (vflow.content)
target
,
TextPos
the text position
p
)

Creates a CaretInfo.

public TextCell
getCell(int modelIndex)

returns the cell contained in this layout, or null

public TextCell
getCellAt(int ix)

returns a TextCell from the visible or bottom margin parts, or null

public Node
getLeftNodeAt(int index)

public Node
getRightNodeAt(int index)

public TextPos
getTextPos(double cellX, double cellY)

finds text position inside the sliding window, in cell coordinates

public double
getUnwrappedWidth()

returns snapped(ceil) size

public TextCell
getVisibleCell(int modelIndex)

returns a visible cell, or null

public int
public boolean
isValid(VFlow f, double padLeft, double padTop)

private TextCell
lastBottomCell()

last cell at the bottom of the arrangement

public Origin
moveOrigin(double delta)

returns the new origin after scrolling for delta pixels within the arrangement

public void
public void
public void
setBottomHeight(double h)

public void
setTopHeight(double h)

public void
public void
public int
public double
public int
topIndex()

returns a model index of the first cell in the sliding window top margin

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bottomCountback to summary
private int bottomCount
bottomHeightback to summary
private double bottomHeight
cellsback to summary
private final ArrayList<TextCell> cells
contentPaddingBottomback to summary
private final double contentPaddingBottom
contentPaddingTopback to summary
private final double contentPaddingTop
flowHeightback to summary
private final double flowHeight
flowWidthback to summary
private final double flowWidth
leftback to summary
private Node[] left
lineCountback to summary
private final int lineCount
originback to summary
private final Origin origin
topHeightback to summary
private double topHeight
unwrappedWidthback to summary
private double unwrappedWidth
visibleCountback to summary
private int visibleCount

Constructor Detail

CellArrangementback to summary
public CellArrangement(VFlow f, double contentPaddingTop, double contentPaddingBottom)

Method Detail

addCellback to summary
public void addCell(TextCell cell)
addLeftNodeback to summary
public void addLeftNode(int index, Node n)
addRightNodeback to summary
public void addRightNode(int index, Node n)
averageHeightback to summary
public double averageHeight()
binarySearchback to summary
private int binarySearch(double localY, int low, int high)

finds a model index of a cell that contains the given localY. (in vflow frame of reference). Should not be called with localY outside of this layout sliding window.

bottomCountback to summary
public int bottomCount()

visible + bottom margin cells

bottomHeightback to summary
public double bottomHeight()

in pixels from the first visible cell to the last cell in the arrangement

bottomIndexback to summary
public int bottomIndex()

returns a model index of the last cell in the sliding window bottom margin + 1

cellCountback to summary
public int cellCount()
compareback to summary
private int compare(TextCell cell, double localY)
estimatedMaxback to summary
public double estimatedMax()
getCaretInfoback to summary
public CaretInfo getCaretInfo(Region target, TextPos p)

Creates a CaretInfo.

Parameters
target:Region

the target region (vflow.content)

p:TextPos

the text position

Returns:CaretInfo

the new CaretInfo

getCellback to summary
public TextCell getCell(int modelIndex)

returns the cell contained in this layout, or null

getCellAtback to summary
public TextCell getCellAt(int ix)

returns a TextCell from the visible or bottom margin parts, or null

getLeftNodeAtback to summary
public Node getLeftNodeAt(int index)
getRightNodeAtback to summary
public Node getRightNodeAt(int index)
getTextPosback to summary
public TextPos getTextPos(double cellX, double cellY)

finds text position inside the sliding window, in cell coordinates

getUnwrappedWidthback to summary
public double getUnwrappedWidth()

returns snapped(ceil) size

getVisibleCellback to summary
public TextCell getVisibleCell(int modelIndex)

returns a visible cell, or null

getVisibleCellCountback to summary
public int getVisibleCellCount()
isValidback to summary
public boolean isValid(VFlow f, double padLeft, double padTop)
lastBottomCellback to summary
private TextCell lastBottomCell()

last cell at the bottom of the arrangement

moveOriginback to summary
public Origin moveOrigin(double delta)

returns the new origin after scrolling for delta pixels within the arrangement

removeNodesFromback to summary
public void removeNodesFrom(Pane p)
setBottomCountback to summary
public void setBottomCount(int ix)
setBottomHeightback to summary
public void setBottomHeight(double h)
setTopHeightback to summary
public void setTopHeight(double h)
setUnwrappedWidthback to summary
public void setUnwrappedWidth(double w)
setVisibleCellCountback to summary
public void setVisibleCellCount(int n)
topCountback to summary
public int topCount()
topHeightback to summary
public double topHeight()
topIndexback to summary
public int topIndex()

returns a model index of the first cell in the sliding window top margin

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override