Module VirtualizedFX
Class VirtualFlowSkin<T,C extends Cell<T>>
java.lang.Object
javafx.scene.control.SkinBase<VirtualFlow<T,C>>
io.github.palexdev.virtualizedfx.flow.VirtualFlowSkin<T,C>
- All Implemented Interfaces:
Skin<VirtualFlow<T,
C>>
- Direct Known Subclasses:
PaginatedVirtualFlowSkin
Default skin implementation for
VirtualFlow
.
There is only one component which is the viewport. This is responsible for containing
the currently visible cells and scrolling "a little" (more info in OrientationHelper
).
There are two approaches for the layout:
1) It can be managed manually and request it only when you think it's needed, this is the most performant
2) It can be left to the viewport, this is the most accurate. The performance difference should be negligible though. This skin uses this approach.
The viewport is also clipped to avoid content leaking out of it.
The actual positioning and resizing of the cells is done by theOrientationHelper
though, this allows you to create
custom implementation of the interface and setting it through the VirtualFlow.orientationHelperFactoryProperty()
,
allowing to customize how cells are positioned and sized.
The position of the viewport is controlled through its translateX and translateY properties, two bindings
are created by the OrientationHelper
to update the positions when needed.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected double
computeMinHeight
(double width, double topInset, double rightInset, double bottomInset, double leftInset) protected double
computeMinWidth
(double height, double topInset, double rightInset, double bottomInset, double leftInset) void
dispose()
protected void
Tells theFlowManager
toFlowManager.reset()
the viewport, also resets the last range property of theFlowManager
.protected void
onItemsChanged
(ListChangeListener.Change<? extends T> c) Tells the flow's components what to do when the items in the list change.protected void
onLayoutRequest
(Boolean newValue) The default implementation is responsible for callingParent.requestLayout()
on the viewport when theVirtualFlow.needsViewportLayoutProperty()
has been set to true.protected void
onListChanged
(ObservableList<? extends T> oldList, ObservableList<? extends T> newList) Tells the flow's components what to do when the items list changes.protected void
onOrientationChanged
(OrientationHelper oldValue, OrientationHelper newValue) The default implementation is responsible for re-binding the viewport's translateX and translateY properties to the bindings created by the newOrientationHelper
.protected void
The default implementation is responsible for updating the viewport's children when the state changes.Methods inherited from class javafx.scene.control.SkinBase
computeBaselineOffset, computeMaxHeight, computeMaxWidth, computePrefHeight, computePrefWidth, consumeMouseEvents, executeAccessibleAction, getChildren, getClassCssMetaData, getCssMetaData, getNode, getSkinnable, layoutChildren, layoutInArea, layoutInArea, layoutInArea, positionInArea, positionInArea, pseudoClassStateChanged, queryAccessibleAttribute, registerChangeListener, registerInvalidationListener, registerListChangeListener, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, unregisterChangeListeners, unregisterInvalidationListeners, unregisterListChangeListeners
-
Constructor Details
-
VirtualFlowSkin
-
-
Method Details
-
onListChanged
protected void onListChanged(ObservableList<? extends T> oldList, ObservableList<? extends T> newList) Tells the flow's components what to do when the items list changes. By default, this causes the removal of the itemsChanged listener from the old list, which is then added to the new list. The estimated length is also recomputed and the viewport reset. -
onItemsChanged
Tells the flow's components what to do when the items in the list change. By default, this causes the re-computation of the estimated length followed by the computation of the new flow' state -
onFactoryChanged
protected void onFactoryChanged()Tells theFlowManager
toFlowManager.reset()
the viewport, also resets the last range property of theFlowManager
. -
onStateChanged
The default implementation is responsible for updating the viewport's children when the state changes. The new state though must have theFlowState.haveCellsChanged()
flag set to true for this to happen. The nodes are collected throughFlowState.getNodes()
. -
onOrientationChanged
The default implementation is responsible for re-binding the viewport's translateX and translateY properties to the bindings created by the newOrientationHelper
.- Throws:
IllegalStateException
- if the new helper is null
-
onLayoutRequest
The default implementation is responsible for callingParent.requestLayout()
on the viewport when theVirtualFlow.needsViewportLayoutProperty()
has been set to true. -
computeMinWidth
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computeMinWidth
in classSkinBase<VirtualFlow<T,
C extends Cell<T>>>
-
computeMinHeight
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) - Overrides:
computeMinHeight
in classSkinBase<VirtualFlow<T,
C extends Cell<T>>>
-
dispose
public void dispose()
-