Package org.fxmisc.flowless
Class CellListManager<T,C extends Cell<T,? extends javafx.scene.Node>>
- java.lang.Object
-
- org.fxmisc.flowless.CellListManager<T,C>
-
final class CellListManager<T,C extends Cell<T,? extends javafx.scene.Node>> extends java.lang.Object
Tracks all of the cells that the viewport can display (cells
) and which cells the viewport is currently displaying (presentCells
).
-
-
Field Summary
Fields Modifier and Type Field Description private org.reactfx.collection.LiveList<javafx.scene.Node>
cellNodes
private CellPool<T,C>
cellPool
private org.reactfx.collection.MemoizationList<C>
cells
private javafx.scene.Node
owner
private org.reactfx.collection.LiveList<C>
presentCells
private org.reactfx.Subscription
presentCellsSubscription
-
Constructor Summary
Constructors Constructor Description CellListManager(javafx.scene.Node owner, javafx.collections.ObservableList<T> items, java.util.function.Function<? super T,? extends C> cellFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private C
cellForItem(T item)
void
cropTo(int fromItem, int toItem)
Updates the list of cells to displayvoid
dispose()
C
getCell(int itemIndex)
java.util.Optional<C>
getCellIfPresent(int itemIndex)
org.reactfx.collection.MemoizationList<C>
getLazyCellList()
javafx.collections.ObservableList<javafx.scene.Node>
getNodes()
Gets the list of nodes that the viewport is displayingC
getPresentCell(int itemIndex)
boolean
isCellPresent(int itemIndex)
private void
presentCellsChanged(org.reactfx.collection.QuasiListModification<? extends C> mod)
private void
pushScrollEvent(javafx.scene.input.ScrollEvent se)
Push scroll events received by cell nodes directly to the 'owner' Node.
-
-
-
Field Detail
-
owner
private final javafx.scene.Node owner
-
cells
private final org.reactfx.collection.MemoizationList<C extends Cell<T,? extends javafx.scene.Node>> cells
-
presentCells
private final org.reactfx.collection.LiveList<C extends Cell<T,? extends javafx.scene.Node>> presentCells
-
cellNodes
private final org.reactfx.collection.LiveList<javafx.scene.Node> cellNodes
-
presentCellsSubscription
private final org.reactfx.Subscription presentCellsSubscription
-
-
Method Detail
-
dispose
public void dispose()
-
getNodes
public javafx.collections.ObservableList<javafx.scene.Node> getNodes()
Gets the list of nodes that the viewport is displaying
-
getLazyCellList
public org.reactfx.collection.MemoizationList<C> getLazyCellList()
-
isCellPresent
public boolean isCellPresent(int itemIndex)
-
getPresentCell
public C getPresentCell(int itemIndex)
-
getCellIfPresent
public java.util.Optional<C> getCellIfPresent(int itemIndex)
-
getCell
public C getCell(int itemIndex)
-
cropTo
public void cropTo(int fromItem, int toItem)
Updates the list of cells to display- Parameters:
fromItem
- the index of the first item to displaytoItem
- the index of the last item to display
-
pushScrollEvent
private void pushScrollEvent(javafx.scene.input.ScrollEvent se)
Push scroll events received by cell nodes directly to the 'owner' Node. (Generally likely to be a VirtualFlow but not required.) Normal bubbling of scroll events gets interrupted during a scroll gesture when the Cell's Node receiving the event has moved out of the viewport and is thus removed from the Navigator's children list. This breaks expected trackpad scrolling behaviour, at least on macOS. So here we take over event-bubbling duties for ScrollEvent and push them ourselves directly to the given owner.
-
presentCellsChanged
private void presentCellsChanged(org.reactfx.collection.QuasiListModification<? extends C> mod)
-
-