Class SizeTracker

java.lang.Object
org.fxmisc.flowless.SizeTracker

final class SizeTracker extends 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.
  • Property Details

  • Field Details

    • 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<Double> breadths
    • maxKnownMinBreadth

      private final org.reactfx.value.Val<Double> maxKnownMinBreadth
    • breadthForCells

      private final org.reactfx.value.Val<Double> breadthForCells
      Stores either the greatest minimum cell's node's breadth or the viewport's breadth
    • lengths

      private final org.reactfx.collection.MemoizationList<Double> lengths
    • averageLengthEstimate

      private final org.reactfx.value.Val<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<Double> totalLengthEstimate
    • lengthOffsetEstimate

      private final org.reactfx.value.Val<Double> lengthOffsetEstimate
    • subscription

      private final org.reactfx.Subscription subscription
    • immediateUpdate

      private javafx.beans.property.SimpleBooleanProperty immediateUpdate
  • Constructor Details

    • 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 Details

    • 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<Double> maxCellBreadthProperty()
      Returns:
      the maxCellBreadth property
    • getViewportBreadth

      public double getViewportBreadth()
    • getViewportLength

      public double getViewportLength()
    • averageLengthEstimateProperty

      public org.reactfx.value.Val<Double> averageLengthEstimateProperty()
      Stores either null or the average length of the cells' nodes currently displayed in the viewport
      Returns:
      the averageLengthEstimate property
      See Also:
    • getAverageLengthEstimate

      public Optional<Double> getAverageLengthEstimate()
      Gets the value of the averageLengthEstimate property.
      Property description:
      Stores either null or the average length of the cells' nodes currently displayed in the viewport
      Returns:
      the value of the averageLengthEstimate property
      See Also:
    • totalLengthEstimateProperty

      public org.reactfx.value.Val<Double> totalLengthEstimateProperty()
      Returns:
      the totalLengthEstimate property
    • lengthOffsetEstimateProperty

      public org.reactfx.value.Val<Double> lengthOffsetEstimateProperty()
      Returns:
      the lengthOffsetEstimate property
    • breadthFor

      public double breadthFor(int itemIndex)
    • forgetSizeOf

      public void forgetSizeOf(int itemIndex)
    • lengthFor

      public double lengthFor(int itemIndex)
    • getCellLayoutBreadth

      public double getCellLayoutBreadth()