T
- the model content that the cell's node
rendersC
- the Cell
that can render the model with a Node
.public class VirtualFlow<T,C extends Cell<T,?>> extends Region implements Virtualized
Navigator
. Based on the viewport's VirtualFlow.Gravity
, it sequentially lays out the
Node
s of the Cell
s until the viewport is completely filled up or it has no additional
cell's nodes to render.
Since this viewport does not fully render all of its content, the scroll values are estimates based on the nodes
that are currently displayed in the viewport. If every node that could be rendered is the same width or same
height, then the corresponding scroll values (e.g., scrollX or totalX) are accurate.
Note: the VirtualFlow does not have scroll bars by default. These can be added by wrapping this object
in a VirtualizedScrollPane
.
Since the viewport can be used to lay out its content horizontally or vertically, it uses two
orientation-agnostic terms to refer to its width and height: "breadth" and "length," respectively. The viewport
always lays out its cell
's Node
s from "top-to-bottom" or from "bottom-to-top"
(these terms should be understood in reference to the viewport's orientation
and
VirtualFlow.Gravity
). Thus, its length ("height") is independent as the viewport's bounds are dependent upon
its parent's bounds whereas its breadth ("width") is dependent upon its length.
Type | Property and Description |
---|---|
org.reactfx.value.Var<Double> |
breadthOffset |
org.reactfx.value.Var<Double> |
estimatedScrollX |
org.reactfx.value.Var<Double> |
estimatedScrollY |
ObjectProperty<VirtualFlow.Gravity> |
gravity
The gravity of the virtual flow.
|
org.reactfx.value.Var<Double> |
lengthOffsetEstimate |
org.reactfx.value.Val<Double> |
totalBreadthEstimate |
org.reactfx.value.Val<Double> |
totalHeightEstimate |
org.reactfx.value.Val<Double> |
totalLengthEstimate |
org.reactfx.value.Val<Double> |
totalWidthEstimate |
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
impl_traversalEngine, needsLayout
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, impl_showMnemonics, impl_treeVisible, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, visible
Modifier and Type | Class and Description |
---|---|
static class |
VirtualFlow.Gravity
Determines how the cells in the viewport should be laid out and where any extra unused space should exist
if there are not enough cells to completely fill up the viewport
|
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
Modifier and Type | Method and Description |
---|---|
org.reactfx.value.Var<Double> |
breadthOffsetProperty() |
Bounds |
cellToViewport(C cell,
Bounds bounds) |
Point2D |
cellToViewport(C cell,
double x,
double y) |
Point2D |
cellToViewport(C cell,
Point2D point) |
protected double |
computePrefHeight(double width) |
protected double |
computePrefWidth(double height) |
static <T,C extends Cell<T,?>> |
createHorizontal(ObservableList<T> items,
Function<? super T,? extends C> cellFactory)
Creates a viewport that lays out content horizontally from left to right
|
static <T,C extends Cell<T,?>> |
createHorizontal(ObservableList<T> items,
Function<? super T,? extends C> cellFactory,
VirtualFlow.Gravity gravity)
Creates a viewport that lays out content horizontally
|
static <T,C extends Cell<T,?>> |
createVertical(ObservableList<T> items,
Function<? super T,? extends C> cellFactory)
Creates a viewport that lays out content vertically from top to bottom
|
static <T,C extends Cell<T,?>> |
createVertical(ObservableList<T> items,
Function<? super T,? extends C> cellFactory,
VirtualFlow.Gravity gravity)
Creates a viewport that lays out content vertically from top to bottom
|
void |
dispose() |
org.reactfx.value.Var<Double> |
estimatedScrollXProperty() |
org.reactfx.value.Var<Double> |
estimatedScrollYProperty() |
C |
getCell(int itemIndex)
If the item is out of view, instantiates a new cell for the item.
|
Optional<C> |
getCellIfVisible(int itemIndex)
This method calls
Parent.layout() as a side-effect to insure
that the VirtualFlow is up-to-date in light of any changes |
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
Orientation |
getContentBias() |
List<CssMetaData<? extends Styleable,?>> |
getCssMetaData() |
VirtualFlow.Gravity |
getGravity()
Gets the value of the property gravity.
|
ObjectProperty<VirtualFlow.Gravity> |
gravityProperty()
The gravity of the virtual flow.
|
VirtualFlowHit<C> |
hit(double x,
double y)
Hits this virtual flow at the given coordinates.
|
protected void |
layoutChildren() |
org.reactfx.value.Var<Double> |
lengthOffsetEstimateProperty() |
void |
scrollXBy(double deltaX)
Scroll the content horizontally by the given amount.
|
void |
scrollXToPixel(double pixel)
Scroll the content horizontally to the pixel
|
void |
scrollYBy(double deltaY)
Scroll the content vertically by the given amount.
|
void |
scrollYToPixel(double pixel)
Scroll the content vertically to the pixel
|
void |
setGravity(VirtualFlow.Gravity gravity)
Sets the value of the property gravity.
|
void |
show(double viewportOffset)
Forces the viewport to acts as though it scrolled from 0 to
viewportOffset ). |
void |
show(int itemIdx)
Forces the viewport to show the given item by "scrolling" to it
|
void |
show(int itemIndex,
Bounds region)
Forces the viewport to show the given item by "scrolling" to it and then further "scrolling," so that the
region is visible, in one layout call (e.g., this method does not "scroll" twice). |
void |
showAsFirst(int itemIdx)
Forces the viewport to show the given item as the first visible item as determined by its
VirtualFlow.Gravity . |
void |
showAsLast(int itemIdx)
Forces the viewport to show the given item as the last visible item as determined by its
VirtualFlow.Gravity . |
void |
showAtOffset(int itemIdx,
double offset)
Forces the viewport to show the given item by "scrolling" to it and then further "scrolling" by
offset
in one layout call (e.g., this method does not "scroll" twice) |
org.reactfx.value.Val<Double> |
totalBreadthEstimateProperty() |
org.reactfx.value.Val<Double> |
totalHeightEstimateProperty() |
org.reactfx.value.Val<Double> |
totalLengthEstimateProperty() |
org.reactfx.value.Val<Double> |
totalWidthEstimateProperty() |
ObservableList<C> |
visibleCells()
This method calls
Parent.layout() as a side-effect to insure
that the VirtualFlow is up-to-date in light of any changes |
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthProperty
getBaselineOffset, getChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEstimatedScrollX, getEstimatedScrollY, getTotalHeightEstimate, getTotalWidthEstimate, scrollBy, scrollBy, scrollToPixel, scrollToPixel
public org.reactfx.value.Var<Double> breadthOffsetProperty
public org.reactfx.value.Val<Double> totalBreadthEstimateProperty
public org.reactfx.value.Var<Double> lengthOffsetEstimateProperty
public org.reactfx.value.Val<Double> totalLengthEstimateProperty
public org.reactfx.value.Val<Double> totalWidthEstimateProperty
totalWidthEstimateProperty
in interface Virtualized
public org.reactfx.value.Val<Double> totalHeightEstimateProperty
totalHeightEstimateProperty
in interface Virtualized
public org.reactfx.value.Var<Double> estimatedScrollXProperty
estimatedScrollXProperty
in interface Virtualized
public org.reactfx.value.Var<Double> estimatedScrollYProperty
estimatedScrollYProperty
in interface Virtualized
public ObjectProperty<VirtualFlow.Gravity> gravityProperty
.virtual-flow { -flowless-gravity: rear; }
getGravity()
,
setGravity(Gravity)
public static <T,C extends Cell<T,?>> VirtualFlow<T,C> createHorizontal(ObservableList<T> items, Function<? super T,? extends C> cellFactory)
public static <T,C extends Cell<T,?>> VirtualFlow<T,C> createHorizontal(ObservableList<T> items, Function<? super T,? extends C> cellFactory, VirtualFlow.Gravity gravity)
public static <T,C extends Cell<T,?>> VirtualFlow<T,C> createVertical(ObservableList<T> items, Function<? super T,? extends C> cellFactory)
public static <T,C extends Cell<T,?>> VirtualFlow<T,C> createVertical(ObservableList<T> items, Function<? super T,? extends C> cellFactory, VirtualFlow.Gravity gravity)
public org.reactfx.value.Var<Double> breadthOffsetProperty()
public org.reactfx.value.Val<Double> totalBreadthEstimateProperty()
public org.reactfx.value.Var<Double> lengthOffsetEstimateProperty()
public void dispose()
public C getCell(int itemIndex)
public Optional<C> getCellIfVisible(int itemIndex)
Parent.layout()
as a side-effect to insure
that the VirtualFlow is up-to-date in light of any changespublic ObservableList<C> visibleCells()
Parent.layout()
as a side-effect to insure
that the VirtualFlow is up-to-date in light of any changespublic org.reactfx.value.Val<Double> totalLengthEstimateProperty()
protected void layoutChildren()
layoutChildren
in class Parent
protected final double computePrefWidth(double height)
computePrefWidth
in class Region
protected final double computePrefHeight(double width)
computePrefHeight
in class Region
public final Orientation getContentBias()
getContentBias
in class Node
public void scrollXBy(double deltaX)
scrollXBy
in interface Virtualized
deltaX
- positive value scrolls right, negative value scrolls leftpublic void scrollYBy(double deltaY)
scrollYBy
in interface Virtualized
deltaY
- positive value scrolls down, negative value scrolls uppublic void scrollXToPixel(double pixel)
scrollXToPixel
in interface Virtualized
pixel
- - the pixel position to which to scrollpublic void scrollYToPixel(double pixel)
scrollYToPixel
in interface Virtualized
pixel
- - the pixel position to which to scrollpublic org.reactfx.value.Val<Double> totalWidthEstimateProperty()
totalWidthEstimateProperty
in interface Virtualized
public org.reactfx.value.Val<Double> totalHeightEstimateProperty()
totalHeightEstimateProperty
in interface Virtualized
public org.reactfx.value.Var<Double> estimatedScrollXProperty()
estimatedScrollXProperty
in interface Virtualized
public org.reactfx.value.Var<Double> estimatedScrollYProperty()
estimatedScrollYProperty
in interface Virtualized
public VirtualFlowHit<C> hit(double x, double y)
x
- x offset from the left edge of the viewporty
- y offset from the top edge of the viewportpublic void show(double viewportOffset)
viewportOffset
). Note: the
viewport makes an educated guess as to which cell is actually at viewportOffset
if the viewport's
entire content was completely rendered.viewportOffset
- See OrientationHelper
and its implementations for explanation on what the offset
means based on which implementation is used.public void show(int itemIdx)
public void showAsFirst(int itemIdx)
VirtualFlow.Gravity
.public void showAsLast(int itemIdx)
VirtualFlow.Gravity
.public void showAtOffset(int itemIdx, double offset)
offset
in one layout call (e.g., this method does not "scroll" twice)offset
- the offset value as determined by the viewport's OrientationHelper
.public void show(int itemIndex, Bounds region)
region
is visible, in one layout call (e.g., this method does not "scroll" twice).public ObjectProperty<VirtualFlow.Gravity> gravityProperty()
.virtual-flow { -flowless-gravity: rear; }
getGravity()
,
setGravity(Gravity)
public VirtualFlow.Gravity getGravity()
.virtual-flow { -flowless-gravity: rear; }
public void setGravity(VirtualFlow.Gravity gravity)
.virtual-flow { -flowless-gravity: rear; }
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
getCssMetaData
in interface Styleable
getCssMetaData
in class Region