Top Description Fields Constructors Methods
org.fxmisc.flowless

pack-priv final Class CellPositioner<T, C extends Cell<T, ?>>

extends Object
Class Inheritance
Imports
java.util.NoSuchElementException, .Optional, .OptionalInt, org.reactfx.collection.MemoizationList

Helper class for properly resizing and relocating a Cell's javafx.scene.Node as well as handling calls related to whether a cell's node is visible (displayed in the viewport) or not.

Field Summary

Modifier and TypeField and Description
private final CellListManager<T, C>
private final OrientationHelper
private final SizeTracker

Constructor Summary

AccessConstructor and Description
public
CellPositioner(CellListManager<T, C> cellManager, OrientationHelper orientation, SizeTracker sizeTracker)

Method Summary

Modifier and TypeMethod and Description
public void
cropTo(int from, int to)

public OptionalInt
firstVisibleAfter(int position)

public Optional<C>
getCellIfVisible(int itemIndex)

public OptionalInt
public OptionalInt
pack-priv C
getSizedCell(int itemIndex)

Returns properly sized, but not properly positioned cell for the given index.

public C
getVisibleCell(int itemIndex)

public OptionalInt
lastVisibleBefore(int position)

public C
placeEndFromEnd(int
the index of the item in the list of all (not currently visible) cells
itemIndex
,
double
the amount by which to offset the "layoutY" value of the cell's node
endOffEnd
)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by endOffStart, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge.

public C
placeEndFromStart(int
the index of the item in the list of all (not currently visible) cells
itemIndex
,
double
the amount by which to offset the "layoutY" value of the cell's node
endOffStart
)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by endOffStart, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge.

public C
placeStartAt(int
the index of the item in the list of all (not currently visible) cells
itemIndex
,
double
the amount by which to offset the "layoutY" value of the cell's node
startOffStart
)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the first visible node in the viewport, and further offsets this value by startOffStart, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge.

public C
placeStartFromEnd(int
the index of the item in the list of all (not currently visible) cells
itemIndex
,
double
the amount by which to offset the "layoutY" value of the cell's node
startOffEnd
)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by endOffStart, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge.

private void
relocate(C cell, double breadth0, double length0)

public void
shiftCellBy(C cell, double delta)

Moves the given cell's node's "layoutY" value by delta.

public double
shortestDeltaToViewport(C cell)

Gets the shortest delta amount by which to scroll the viewport's length in order to fully display a partially-displayed cell's node.

public double
shortestDeltaToViewport(C cell, double fromY, double toY)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cellManagerback to summary
private final CellListManager<T, C> cellManager
orientationback to summary
private final OrientationHelper orientation
sizeTrackerback to summary
private final SizeTracker sizeTracker

Constructor Detail

CellPositionerback to summary
public CellPositioner(CellListManager<T, C> cellManager, OrientationHelper orientation, SizeTracker sizeTracker)

Method Detail

cropToback to summary
public void cropTo(int from, int to)
firstVisibleAfterback to summary
public OptionalInt firstVisibleAfter(int position)
getCellIfVisibleback to summary
public Optional<C> getCellIfVisible(int itemIndex)
getFirstVisibleIndexback to summary
public OptionalInt getFirstVisibleIndex()
getLastVisibleIndexback to summary
public OptionalInt getLastVisibleIndex()
getSizedCellback to summary
pack-priv C getSizedCell(int itemIndex)

Returns properly sized, but not properly positioned cell for the given index.

getVisibleCellback to summary
public C getVisibleCell(int itemIndex)
lastVisibleBeforeback to summary
public OptionalInt lastVisibleBefore(int position)
placeEndFromEndback to summary
public C placeEndFromEnd(int itemIndex, double endOffEnd)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by endOffStart, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge. See OrientationHelper's javadoc for more explanation on what quoted terms mean.


    |--------- bottom of cell's node if endOffEnd is negative
    |
    |_________ "bottom edge" of viewport / bottom of cell's node if endOffEnd = 0


     --------- bottom of cell's node if endOffEnd is positive
Parameters
itemIndex:int

the index of the item in the list of all (not currently visible) cells

endOffEnd:double

the amount by which to offset the "layoutY" value of the cell's node

placeEndFromStartback to summary
public C placeEndFromStart(int itemIndex, double endOffStart)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by endOffStart, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge. See OrientationHelper's javadoc for more explanation on what quoted terms mean.


    |--------- top of cell's node if endOffStart is negative
    |
    |
    |_________ "bottom edge" of viewport / top of cell's node if endOffStart = 0


     --------- top of cell's node if endOffStart is positive
Parameters
itemIndex:int

the index of the item in the list of all (not currently visible) cells

endOffStart:double

the amount by which to offset the "layoutY" value of the cell's node

placeStartAtback to summary
public C placeStartAt(int itemIndex, double startOffStart)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the first visible node in the viewport, and further offsets this value by startOffStart, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. See OrientationHelper's javadoc for more explanation on what quoted terms mean.


     --------- top of cell's node if startOffStart is negative

    __________ "top edge" of viewport / top of cell's node if startOffStart = 0
    |
    |
    |--------- top of cell's node if startOffStart is positive
    |
Parameters
itemIndex:int

the index of the item in the list of all (not currently visible) cells

startOffStart:double

the amount by which to offset the "layoutY" value of the cell's node

placeStartFromEndback to summary
public C placeStartFromEnd(int itemIndex, double startOffEnd)

Properly resizes the cell's node, and sets its "layoutY" value, so that is the last visible node in the viewport, and further offsets this value by endOffStart, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. See OrientationHelper's javadoc for more explanation on what quoted terms mean.


     --------- bottom of cell's node if startOffStart is negative

    __________ "top edge" of viewport / bottom of cell's node if startOffStart = 0
    |
    |
    |--------- bottom of cell's node if startOffStart is positive
    |
Parameters
itemIndex:int

the index of the item in the list of all (not currently visible) cells

startOffEnd:double

the amount by which to offset the "layoutY" value of the cell's node

relocateback to summary
private void relocate(C cell, double breadth0, double length0)
shiftCellByback to summary
public void shiftCellBy(C cell, double delta)

Moves the given cell's node's "layoutY" value by delta. See OrientationHelper's javadoc for more explanation on what quoted terms mean.

shortestDeltaToViewportback to summary
public double shortestDeltaToViewport(C cell)

Gets the shortest delta amount by which to scroll the viewport's length in order to fully display a partially-displayed cell's node.

shortestDeltaToViewportback to summary
public double shortestDeltaToViewport(C cell, double fromY, double toY)