Package org.fxmisc.flowless
Class CellPositioner<T,C extends Cell<T,?>>
- java.lang.Object
-
- org.fxmisc.flowless.CellPositioner<T,C>
-
-
Field Summary
Fields Modifier and Type Field Description private CellListManager<T,C>
cellManager
private OrientationHelper
orientation
private SizeTracker
sizeTracker
-
Constructor Summary
Constructors Constructor Description CellPositioner(CellListManager<T,C> cellManager, OrientationHelper orientation, SizeTracker sizeTracker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cropTo(int from, int to)
java.util.OptionalInt
firstVisibleAfter(int position)
java.util.Optional<C>
getCellIfVisible(int itemIndex)
java.util.OptionalInt
getFirstVisibleIndex()
java.util.OptionalInt
getLastVisibleIndex()
(package private) C
getSizedCell(int itemIndex)
Returns properly sized, but not properly positioned cell for the given index.C
getVisibleCell(int itemIndex)
java.util.OptionalInt
lastVisibleBefore(int position)
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 byendOffStart
, so that the node's bottom edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge.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 byendOffStart
, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "bottom" edge.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 bystartOffStart
, so that the node's top edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's "top" edge.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 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
relocate(C cell, double breadth0, double length0)
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 Detail
-
cellManager
private final CellListManager<T,C extends Cell<T,?>> cellManager
-
orientation
private final OrientationHelper orientation
-
sizeTracker
private final SizeTracker sizeTracker
-
-
Constructor Detail
-
CellPositioner
public CellPositioner(CellListManager<T,C> cellManager, OrientationHelper orientation, SizeTracker sizeTracker)
-
-
Method Detail
-
cropTo
public void cropTo(int from, int to)
-
getVisibleCell
public C getVisibleCell(int itemIndex)
-
getCellIfVisible
public java.util.Optional<C> getCellIfVisible(int itemIndex)
-
lastVisibleBefore
public java.util.OptionalInt lastVisibleBefore(int position)
-
firstVisibleAfter
public java.util.OptionalInt firstVisibleAfter(int position)
-
getLastVisibleIndex
public java.util.OptionalInt getLastVisibleIndex()
-
getFirstVisibleIndex
public java.util.OptionalInt getFirstVisibleIndex()
-
shortestDeltaToViewport
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.
-
shortestDeltaToViewport
public double shortestDeltaToViewport(C cell, double fromY, double toY)
-
shiftCellBy
public void shiftCellBy(C cell, double delta)
Moves the given cell's node's "layoutY" value bydelta
. SeeOrientationHelper
's javadoc for more explanation on what quoted terms mean.
-
placeStartAt
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 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
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 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
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 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
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 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
C getSizedCell(int itemIndex)
Returns properly sized, but not properly positioned cell for the given index.
-
relocate
private void relocate(C cell, double breadth0, double length0)
-
-