Class 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 the Cells whose nodes are currently displayed in the viewport and an estimated average of Cells whose nodes are not displayed in the viewport. The meaning of breadthForCells and totalLengthEstimate are dependent upon which implementation of OrientationHelper is used.
    • Field Detail

      • 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()