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
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classVFXListHelper.AbstractHelper<T, C extends VFXCell<T>>Extension ofVFXContainerHelper.VFXContainerHelperBasewhich also implementsVFXListHelper.static classVFXListHelper.HorizontalHelper<T, C extends VFXCell<T>>Concrete implementation ofVFXListHelper.AbstractHelperforOrientation.HORIZONTAL.static classVFXListHelper.VerticalHelper<T, C extends VFXCell<T>>Concrete implementation ofVFXListHelper.AbstractHelperforOrientation.VERTICAL.Nested classes/interfaces inherited from interface io.github.palexdev.virtualizedfx.base.VFXContainerHelper
VFXContainerHelper.VFXContainerHelperBase<T, C extends Region & VFXContainer<T>> -
Property Summary
PropertiesTypePropertyDescriptionReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> Specifies the range of items present in the list.Properties inherited from interface io.github.palexdev.virtualizedfx.base.VFXContainerHelper
maxHScroll, maxVScroll, viewportPosition, virtualMaxX, virtualMaxY -
Method Summary
Modifier and TypeMethodDescriptiondoublecomputeSize(Node node) Computes the width or height of the cell depending on the container's orientation.intdefault doubleImplementing theVFXList.spacingProperty()has been incredibly easy.default CindexToCell(int index) Converts the given index to a cell.default CitemToCell(T item) Converts the given item to a cell.intvoidLays out the given cell.default io.github.palexdev.mfxcore.base.beans.range.IntegerRangerange()ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> Specifies the range of items present in the list.voidscrollBy(double pixels) Scrolls in the viewport by the given number of pixels.voidscrollToIndex(int index) Scrolls in the viewport to the given item's index.voidscrollToPixel(double pixel) Scrolls in the viewport to the given pixel value.inttotalNum()intMethods inherited from interface io.github.palexdev.virtualizedfx.base.VFXContainerHelper
dispose, getContainer, getMaxHScroll, getMaxVScroll, getViewportPosition, getVirtualMaxX, getVirtualMaxY, indexToItem, invalidatePos, invalidateVirtualSizes, maxHScrollProperty, maxVScrollProperty, viewportPositionProperty, virtualMaxXProperty, virtualMaxYProperty
-
Property Details
-
range
ReadOnlyObjectProperty<io.github.palexdev.mfxcore.base.beans.range.NumberRange<Integer>> rangePropertySpecifies the range of items present in the list. This also takes into account buffer items, seevisibleNum()andtotalNum()- See Also:
-
-
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, seevisibleNum()andtotalNum()- Returns:
- the
rangeproperty
-
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()andtotalNum()
-
computeSize
Computes the width or height of the cell depending on the container's orientation.- VERTICAL -> width
- HORIZONTAL -> height
-
layout
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, seeVFXListSkin.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
Converts the given index to a cell. UsesitemToCell(Object). -
itemToCell
Converts the given item to a cell. The result is either on of the cells cached inVFXCellsCachethat is updated with the given item, or a totally new one created by theVFXList.getCellFactory(). -
getTotalCellSize
default double getTotalCellSize()Implementing theVFXList.spacingProperty()has been incredibly easy. It is enough to think at the spacing as an extension of theVFXList.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 forgetContainer().getCellSize() + getContainer().getSpacing().
-