Package org.fxmisc.flowless
Class SizeTracker
- java.lang.Object
-
- org.fxmisc.flowless.SizeTracker
-
final class SizeTracker extends java.lang.Object
Estimates the size of the entire viewport (if it was actually completely rendered) based on the known sizes of theCell
s whose nodes are currently displayed in the viewport and an estimated average ofCell
s whose nodes are not displayed in the viewport. The meaning ofbreadthForCells
andtotalLengthEstimate
are dependent upon which implementation ofOrientationHelper
is used.
-
-
Field Summary
Fields Modifier and Type Field Description private org.reactfx.value.Val<java.lang.Double>
averageLengthEstimate
Stores either null or the average length of the cells' nodes currently displayed in the viewportprivate org.reactfx.value.Val<java.lang.Double>
breadthForCells
Stores either the greatest minimum cell's node's breadth or the viewport's breadthprivate org.reactfx.collection.MemoizationList<java.lang.Double>
breadths
private org.reactfx.collection.MemoizationList<? extends Cell<?,?>>
cells
private javafx.beans.property.SimpleBooleanProperty
immediateUpdate
private org.reactfx.value.Val<java.lang.Double>
lengthOffsetEstimate
private org.reactfx.collection.MemoizationList<java.lang.Double>
lengths
private org.reactfx.value.Val<java.lang.Double>
maxKnownMinBreadth
private OrientationHelper
orientation
private org.reactfx.Subscription
subscription
private org.reactfx.value.Val<java.lang.Double>
totalLengthEstimate
private 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)
double
breadthFor(int itemIndex)
void
dispose()
void
forgetSizeOf(int itemIndex)
java.util.Optional<java.lang.Double>
getAverageLengthEstimate()
double
getCellLayoutBreadth()
double
getViewportBreadth()
double
getViewportLength()
double
lengthFor(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()
(package private) void
updateNextLengthOffsetEstimateImmediately()
-
-
-
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
-
immediateUpdate
private javafx.beans.property.SimpleBooleanProperty immediateUpdate
-
-
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
-
updateNextLengthOffsetEstimateImmediately
void updateNextLengthOffsetEstimateImmediately()
-
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()
-
-