Class VFXPaginatedListManager<T,C extends VFXCell<T>>
VFXPaginatedList
, extends VFXListManager
.
This is necessary to respond to the following property changes introduced by the paginated variant:
- cells per page changes, onCellsPerPageChanged()
- max page changes, onMaxPageChanged()
VFXListManager
because the paginated variant should
respond differently in some cases, and also to optimize performance as much as possible.-
Field Summary
Fields inherited from class io.github.palexdev.virtualizedfx.list.VFXListManager
invalidatingPos
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetNode()
Overridden to cast toVFXPaginatedList
since this behavior only allows that type.protected void
Overridden to just callVFXList.requestViewportLayout()
.protected void
A paginated container's size strictly depends on how many cells/rows/items is set to display per page, and this is enforced by the default skinVFXPaginatedListSkin
, seeVFXPaginatedListSkin.getLength()
.protected void
This core method ensures that the paginated container is always at a valid page/position when theVFXPaginatedList.maxPageProperty()
changes.protected void
As also described in the super method (VFXListManager.onOrientationChanged()
), when the orientation changes the most reasonable behavior is to reset both the positions to 0.0.Methods inherited from class io.github.palexdev.virtualizedfx.list.VFXListManager
disposeCurrent, intersectionAlgorithm, listFactorySizeCheck, moveReuseCreateAlgorithm, onCellFactoryChanged, onFitToViewportChanged, onGeometryChanged, onItemsChanged, onPositionChanged, onSpacingChanged, rangeCheck, remainingAlgorithm
Methods inherited from class io.github.palexdev.mfxcore.behavior.BehaviorBase
dispose, getActions, init, keyPressed, keyPressed, keyReleased, keyReleased, keyTyped, keyTyped, mouseClicked, mouseClicked, mouseDragged, mouseDragged, mouseEntered, mouseEntered, mouseExited, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressed, mouseReleased, mouseReleased, register, scroll, scroll, touchMoved, touchMoved, touchPressed, touchPressed, touchReleased, touchReleased, touchStationary, touchStationary
-
Constructor Details
-
VFXPaginatedListManager
-
-
Method Details
-
onCellsPerPageChanged
protected void onCellsPerPageChanged()A paginated container's size strictly depends on how many cells/rows/items is set to display per page, and this is enforced by the default skinVFXPaginatedListSkin
, seeVFXPaginatedListSkin.getLength()
.This core method is called whenever the
VFXPaginatedList.cellsPerPageProperty()
changes and ensures that the layout bounds of the container become invalid (Parent.isNeedsLayout()
becomes 'true'), by callingParent.requestLayout()
.This way, computations that also rely on the container size become invalid too, thus leading to correct values.
-
onMaxPageChanged
protected void onMaxPageChanged()This core method ensures that the paginated container is always at a valid page/position when theVFXPaginatedList.maxPageProperty()
changes.The only one case this needs to correct the position is when the current page is greater than the new max page. (both in terms of indexes ofc).
Important note: the page change would trigger a position change (so
VFXListManager.onPositionChanged()
), but this method avoids it by setting theVFXListManager.invalidatingPos
flag to 'true' before and immediately re-setting it to false after. This may sound counterintuitive, but there is a reason.You see, the max page property can change on two occasions:
1) the number of items changes
2) the cells per page changes
BUT... in the first case, we have a change in the list which is handled by
VFXListManager.onItemsChanged()
; and the second case is handled byVFXListManager.onGeometryChanged()
. This last case is very peculiar, because it will work only if the container's skin is implemented to adapt to the number of items per page. It's the skin's implementation to trigger the geometry change, and this should be the intended default behavior.If you want to make a skin that doesn't follow this logic, then you probably want to change this method too.
-
onCellSizeChanged
protected void onCellSizeChanged()Overridden to just callVFXList.requestViewportLayout()
.For the paginated variant, the cells' size is irrelevant for its state. The default behavior, also dependent on the skin, is to adapt the container's size to the size of each cell as well as the number of cells per page.
- Overrides:
onCellSizeChanged
in classVFXListManager<T,
C extends VFXCell<T>>
-
onOrientationChanged
protected void onOrientationChanged()As also described in the super method (VFXListManager.onOrientationChanged()
), when the orientation changes the most reasonable behavior is to reset both the positions to 0.0. For the paginated variant this requires extra steps because, according to the previous orientation, the vPos or hPos properties are bound. Also, the reset also requires setting the page to 0.- Overrides:
onOrientationChanged
in classVFXListManager<T,
C extends VFXCell<T>>
-
getNode
Overridden to cast toVFXPaginatedList
since this behavior only allows that type.
-