Package org.fxmisc.flowless
Class CellPositioner<T,C extends Cell<T,?>>
java.lang.Object
org.fxmisc.flowless.CellPositioner<T,C>
Helper class for properly
resizing
and
relocating
a Cell
's Node
as well
as handling calls related to whether a cell's node is visible (displayed in the viewport) or not.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CellListManager
<T, C> private final OrientationHelper
private final SizeTracker
-
Constructor Summary
ConstructorsConstructorDescriptionCellPositioner
(CellListManager<T, C> cellManager, OrientationHelper orientation, SizeTracker sizeTracker) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cropTo
(int from, int to) firstVisibleAfter
(int position) getCellIfVisible
(int itemIndex) (package private) C
getSizedCell
(int itemIndex) Returns properly sized, but not properly positioned cell for the given index.getVisibleCell
(int itemIndex) lastVisibleBefore
(int position) 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 byendOffStart
, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge.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 byendOffStart
, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge.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 bystartOffStart
, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge.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 byendOffStart
, 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
void
shiftCellBy
(C cell, double delta) Moves the given cell's node's "layoutY" value bydelta
.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.double
shortestDeltaToViewport
(C cell, double fromY, double toY)
-
Field Details
-
cellManager
-
orientation
-
sizeTracker
-
-
Constructor Details
-
CellPositioner
public CellPositioner(CellListManager<T, C> cellManager, OrientationHelper orientation, SizeTracker sizeTracker)
-
-
Method Details
-
cropTo
public void cropTo(int from, int to) -
getVisibleCell
-
getCellIfVisible
-
lastVisibleBefore
-
firstVisibleAfter
-
getLastVisibleIndex
-
getFirstVisibleIndex
-
shortestDeltaToViewport
Gets the shortest delta amount by which to scroll the viewport's length in order to fully display a partially-displayed cell's node. -
shortestDeltaToViewport
-
shiftCellBy
Moves the given cell's node's "layoutY" value bydelta
. SeeOrientationHelper
's javadoc for more explanation on what quoted terms mean. -
placeStartAt
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 bystartOffStart
, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. SeeOrientationHelper
'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
- the index of the item in the list of all (not currently visible) cellsstartOffStart
- the amount by which to offset the "layoutY" value of the cell's node
-
placeEndFromStart
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 byendOffStart
, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge. SeeOrientationHelper
'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
- the index of the item in the list of all (not currently visible) cellsendOffStart
- the amount by which to offset the "layoutY" value of the cell's node
-
placeEndFromEnd
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 byendOffStart
, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge. SeeOrientationHelper
'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
- the index of the item in the list of all (not currently visible) cellsendOffEnd
- the amount by which to offset the "layoutY" value of the cell's node
-
placeStartFromEnd
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 byendOffStart
, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge. SeeOrientationHelper
'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
- the index of the item in the list of all (not currently visible) cellsstartOffEnd
- the amount by which to offset the "layoutY" value of the cell's node
-
getSizedCell
Returns properly sized, but not properly positioned cell for the given index. -
relocate
-