Interface VFXListHelper<T, C extends VFXCell<T>>

All Superinterfaces:
VFXContainerHelper<T, VFXList<T,C>>
All Known Subinterfaces:
VFXPaginatedListHelper<T,C>
All Known Implementing Classes:
VFXListHelper.AbstractHelper, VFXListHelper.HorizontalHelper, VFXListHelper.VerticalHelper, VFXPaginatedListHelper.HorizontalHelper, VFXPaginatedListHelper.VerticalHelper

public interface VFXListHelper<T, C extends VFXCell<T>> extends VFXContainerHelper<T, VFXList<T,C>>
This interface is a utility API for VFXList which helps to avoid if checks that depend on the container's orientation, VFXList.orientationProperty(). There are two concrete implementations: VFXListHelper.VerticalHelper and VFXListHelper.HorizontalHelper

A little note on the virtual max X/Y properties.

The axis property which is the opposite of the current container's orientation (VFXList.orientationProperty()), specifies the biggest cell size (width/height) so that if VFXList.fitToViewportProperty() is set to false we know how much we can scroll the list in that direction.

This value, however, is dynamic, since the size of each node is computed only once it is laid out. This means that the absolute maximum value is only found when all items have been displayed at least once.

  • Property Details

  • Method Details

    • firstVisible

      int firstVisible()
      Returns:
      the index of the first visible item
    • lastVisible

      int lastVisible()
      Returns:
      the index of the last visible item
    • visibleNum

      int visibleNum()
      Returns:
      the number of cells visible in the viewport. Not necessarily the same as totalNum()
    • totalNum

      int totalNum()
      Returns:
      the total number of cells in the viewport which doesn't include only the number of visible cells but also the number of buffer cells
    • rangeProperty

      ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> rangeProperty()
      Specifies the range of items present in the list. This also takes into account buffer items, see visibleNum() and totalNum()
      Returns:
      the range property
    • range

      default io.github.palexdev.mfxcore.base.beans.range.IntegerRange range()
      Returns:
      the range of items present in the list. This also takes into account buffer items, see visibleNum() and totalNum()
    • computeSize

      double computeSize(Node node)
      Computes the width or height of the cell depending on the container's orientation.

      - VERTICAL -> width

      - HORIZONTAL -> height

    • layout

      void layout(int layoutIndex, VFXCell<T> cell)
      Lays out the given cell. The index parameter is necessary to identify the position of a cell compared to the others (comes before or after).
      Parameters:
      layoutIndex - the absolute index of the given node/cell, see VFXListSkin.layout()
    • scrollBy

      void scrollBy(double pixels)
      Scrolls in the viewport by the given number of pixels.
    • scrollToPixel

      void scrollToPixel(double pixel)
      Scrolls in the viewport to the given pixel value.
    • scrollToIndex

      void scrollToIndex(int index)
      Scrolls in the viewport to the given item's index.
    • indexToCell

      default C indexToCell(int index)
      Converts the given index to a cell. Uses itemToCell(Object).
    • itemToCell

      default C itemToCell(T item)
      Converts the given item to a cell. The result is either on of the cells cached in VFXCellsCache that is updated with the given item, or a totally new one created by the VFXList.getCellFactory().
    • getTotalCellSize

      default double getTotalCellSize()
      Implementing the VFXList.spacingProperty() has been incredibly easy. It is enough to think at the spacing as an extension of the VFXList.cellSizeProperty(). In other words, for the helper to still produce valid ranges, it is enough to sum the spacing to the cell size when the latter is needed. This is a shortcut for getContainer().getCellSize() + getContainer().getSpacing().