Package org.fxmisc.flowless
Class SizeTracker
- java.lang.Object
-
- org.fxmisc.flowless.SizeTracker
-
final class SizeTracker extends java.lang.ObjectEstimates the size of the entire viewport (if it was actually completely rendered) based on the known sizes of theCells whose nodes are currently displayed in the viewport and an estimated average ofCells whose nodes are not displayed in the viewport. The meaning ofbreadthForCellsandtotalLengthEstimateare dependent upon which implementation ofOrientationHelperis used.
-
-
Field Summary
Fields Modifier and Type Field Description private org.reactfx.value.Val<java.lang.Double>averageLengthEstimateStores either null or the average length of the cells' nodes currently displayed in the viewportprivate org.reactfx.value.Val<java.lang.Double>breadthForCellsStores either the greatest minimum cell's node's breadth or the viewport's breadthprivate org.reactfx.collection.MemoizationList<java.lang.Double>breadthsprivate org.reactfx.collection.MemoizationList<? extends Cell<?,?>>cellsprivate org.reactfx.value.Val<java.lang.Double>lengthOffsetEstimateprivate org.reactfx.collection.MemoizationList<java.lang.Double>lengthsprivate org.reactfx.value.Val<java.lang.Double>maxKnownMinBreadthprivate OrientationHelperorientationprivate org.reactfx.Subscriptionsubscriptionprivate org.reactfx.value.Val<java.lang.Double>totalLengthEstimateprivate javafx.beans.value.ObservableObjectValue<javafx.geometry.Bounds>viewportBounds
-
Constructor Summary
Constructors Constructor Description SizeTracker(OrientationHelper orientation, javafx.beans.value.ObservableObjectValue<javafx.geometry.Bounds> viewportBounds, org.reactfx.collection.MemoizationList<? extends Cell<?,?>> lazyCells)Constructs a SizeTracker
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.reactfx.value.Val<java.lang.Double>averageLengthEstimateProperty()private static <T> org.reactfx.value.Val<T>avoidFalseInvalidations(org.reactfx.value.Val<T> src)doublebreadthFor(int itemIndex)voiddispose()voidforgetSizeOf(int itemIndex)java.util.Optional<java.lang.Double>getAverageLengthEstimate()doublegetCellLayoutBreadth()doublegetViewportBreadth()doublegetViewportLength()doublelengthFor(int itemIndex)org.reactfx.value.Val<java.lang.Double>lengthOffsetEstimateProperty()org.reactfx.value.Val<java.lang.Double>maxCellBreadthProperty()org.reactfx.value.Val<java.lang.Double>totalLengthEstimateProperty()
-
-
-
Field Detail
-
orientation
private final OrientationHelper orientation
-
viewportBounds
private final javafx.beans.value.ObservableObjectValue<javafx.geometry.Bounds> viewportBounds
-
cells
private final org.reactfx.collection.MemoizationList<? extends Cell<?,?>> cells
-
breadths
private final org.reactfx.collection.MemoizationList<java.lang.Double> breadths
-
maxKnownMinBreadth
private final org.reactfx.value.Val<java.lang.Double> maxKnownMinBreadth
-
breadthForCells
private final org.reactfx.value.Val<java.lang.Double> breadthForCells
Stores either the greatest minimum cell's node's breadth or the viewport's breadth
-
lengths
private final org.reactfx.collection.MemoizationList<java.lang.Double> lengths
-
averageLengthEstimate
private final org.reactfx.value.Val<java.lang.Double> averageLengthEstimate
Stores either null or the average length of the cells' nodes currently displayed in the viewport
-
totalLengthEstimate
private final org.reactfx.value.Val<java.lang.Double> totalLengthEstimate
-
lengthOffsetEstimate
private final org.reactfx.value.Val<java.lang.Double> lengthOffsetEstimate
-
subscription
private final org.reactfx.Subscription subscription
-
-
Constructor Detail
-
SizeTracker
public SizeTracker(OrientationHelper orientation, javafx.beans.value.ObservableObjectValue<javafx.geometry.Bounds> viewportBounds, org.reactfx.collection.MemoizationList<? extends Cell<?,?>> lazyCells)
Constructs a SizeTracker- Parameters:
orientation- if vertical, breadth = width and length = height; if horizontal, breadth = height and length = width
-
-
Method Detail
-
avoidFalseInvalidations
private static <T> org.reactfx.value.Val<T> avoidFalseInvalidations(org.reactfx.value.Val<T> src)
-
dispose
public void dispose()
-
maxCellBreadthProperty
public org.reactfx.value.Val<java.lang.Double> maxCellBreadthProperty()
-
getViewportBreadth
public double getViewportBreadth()
-
getViewportLength
public double getViewportLength()
-
averageLengthEstimateProperty
public org.reactfx.value.Val<java.lang.Double> averageLengthEstimateProperty()
-
getAverageLengthEstimate
public java.util.Optional<java.lang.Double> getAverageLengthEstimate()
-
totalLengthEstimateProperty
public org.reactfx.value.Val<java.lang.Double> totalLengthEstimateProperty()
-
lengthOffsetEstimateProperty
public org.reactfx.value.Val<java.lang.Double> lengthOffsetEstimateProperty()
-
breadthFor
public double breadthFor(int itemIndex)
-
forgetSizeOf
public void forgetSizeOf(int itemIndex)
-
lengthFor
public double lengthFor(int itemIndex)
-
getCellLayoutBreadth
public double getCellLayoutBreadth()
-
-