Top Description Fields Constructors Methods
org.fxmisc.flowless

pack-priv final Class Navigator<T, C extends Cell<T, ?>>

extends Region
implements TargetPositionVisitor
Class Inheritance
All Implemented Interfaces
org.fxmisc.flowless.TargetPositionVisitor
Imports
java.util.Optional, .OptionalInt, javafx.beans.binding.Bindings, javafx.beans.property.ObjectProperty, javafx.scene.Node, .Parent, javafx.scene.layout.Region, org.fxmisc.flowless.VirtualFlow.Gravity, org.reactfx.Subscription, org.reactfx.collection.LiveList, .MemoizationList, .QuasiListChange, .QuasiListModification

Responsible for laying out cells' nodes within the viewport based on a single anchor node. In a layout call, this anchor node is positioned in the viewport before any other node and then nodes are positioned above and below that anchor node sequentially. This sequential layout continues until the viewport's "top" and "bottom" edges are reached or there are no other cells' nodes to render. In this latter case (when there is not enough content to fill up the entire viewport), the displayed cells are repositioned towards the "ground," based on the VirtualFlow's Gravity value, and any remaining unused space counts as the "sky."

Field Summary

Modifier and TypeField and Description
private final CellListManager<T, C>
private final MemoizationList<C>
private TargetPosition
private int
private final ObjectProperty<VirtualFlow.Gravity>
private final Subscription
private int
private final OrientationHelper
private final CellPositioner<T, C>
private final SizeTracker
private TargetPosition
Inherited from javafx.scene.layout.Region:
USE_COMPUTED_SIZEUSE_PREF_SIZE

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
private void
cropToNeighborhoodOf(int itemIndex)

private void
cropToNeighborhoodOf(int itemIndex, double additionalOffset)

public void
private double
distanceFromGround(int itemIndex)

private double
distanceFromSky(int itemIndex)

private int
fillBackwardFrom(int itemIndex)

private int
fillBackwardFrom(int itemIndex, double upTo)

private int
fillBackwardFrom0(int itemIndex)

pack-priv int
fillBackwardFrom0(int itemIndex, double upTo)

private int
fillForwardFrom(int itemIndex)

private int
fillForwardFrom(int itemIndex, double upTo)

private int
fillForwardFrom0(int itemIndex)

pack-priv int
fillForwardFrom0(int itemIndex, double upTo)

private int
fillTowardsGroundFrom0(int itemIndex)

private int
fillTowardsGroundFrom0(int itemIndex, double upTo)

private int
fillTowardsSkyFrom0(int itemIndex)

private void
fillViewportFrom(int
the index of the anchor cell
itemIndex
)

Starting from the anchor cell's node, fills the viewport from the anchor to the "ground" and then from the anchor to the "sky".

private TargetPosition
public int

Returns:

The index of the first visible cell
getFirstVisibleIndex
()

Get the index of the first visible cell (at the time of the last layout).

public int

Returns:

The index of the last visible cell
getLastVisibleIndex
()

Get the index of the last visible cell (at the time of the last layout).

private void
protected void
layoutChildren()

Overrides javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent.

private void
placeEndOffEndMayCrop(int itemIndex, double endOffEnd)

private void
placeEndOffStartMayCrop(int itemIndex, double endOffStart)

private void
placeStartAtMayCrop(int itemIndex, double startOffStart)

private void
placeStartOffEndMayCrop(int itemIndex, double startOffEnd)

private void
placeToViewport(int itemIndex, Offset from, Offset to)

private void
placeToViewport(int itemIndex, double fromY, double toY)

public void
scrollCurrentPositionBy(double delta)

Sets the TargetPosition used to layout the anchor node to the current position scrolled by delta and re-lays out the viewport

public void
setTargetPosition(TargetPosition targetPosition)

Sets the TargetPosition used to layout the anchor node and re-lays out the viewport

private void
shiftCellsTowardsGround(int groundCellIndex, int lastCellIndex, double amount)

pack-priv void
showLengthRegion(int itemIndex, double fromY, double toY)

public void
public void
public void
Inherited from javafx.scene.layout.Region:
backgroundPropertyborderPropertycacheShapePropertycenterShapePropertycomputeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthgetBackgroundgetBordergetClassCssMetaDatagetCssMetaDatagetHeightgetInsetsgetMaxHeightgetMaxWidthgetMinHeightgetMinWidthgetOpaqueInsetsgetPaddinggetPrefHeightgetPrefWidthgetShapegetUserAgentStylesheetgetWidthheightPropertyinsetsPropertyisCacheShapeisCenterShapeisResizableisScaleShapeisSnapToPixellayoutInArealayoutInArealayoutInArealayoutInAreamaxHeightmaxHeightPropertymaxWidthmaxWidthPropertyminHeightminHeightPropertyminWidthminWidthPropertyopaqueInsetsPropertypaddingPropertypositionInAreapositionInAreaprefHeightprefHeightPropertyprefWidthprefWidthPropertyresizescaleShapePropertysetBackgroundsetBordersetCacheShapesetCenterShapesetHeightsetMaxHeightsetMaxSizesetMaxWidthsetMinHeightsetMinSizesetMinWidthsetOpaqueInsetssetPaddingsetPrefHeightsetPrefSizesetPrefWidthsetScaleShapesetShapesetSnapToPixelsetWidthshapePropertysnappedBottomInsetsnappedLeftInsetsnappedRightInsetsnappedTopInsetsnapPositionsnapPositionXsnapPositionYsnapSizesnapSizeXsnapSizeYsnapSpacesnapSpaceXsnapSpaceYsnapToPixelPropertywidthProperty

Field Detail

cellListManagerback to summary
private final CellListManager<T, C> cellListManager
cellsback to summary
private final MemoizationList<C> cells
currentPositionback to summary
private TargetPosition currentPosition
firstVisibleIndexback to summary
private int firstVisibleIndex
gravityback to summary
private final ObjectProperty<VirtualFlow.Gravity> gravity
itemsSubscriptionback to summary
private final Subscription itemsSubscription
lastVisibleIndexback to summary
private int lastVisibleIndex
orientationback to summary
private final OrientationHelper orientation
positionerback to summary
private final CellPositioner<T, C> positioner
sizeTrackerback to summary
private final SizeTracker sizeTracker
targetPositionback to summary
private TargetPosition targetPosition

Constructor Detail

Method Detail

cropToNeighborhoodOfback to summary
private void cropToNeighborhoodOf(int itemIndex)
cropToNeighborhoodOfback to summary
private void cropToNeighborhoodOf(int itemIndex, double additionalOffset)
disposeback to summary
public void dispose()
distanceFromGroundback to summary
private double distanceFromGround(int itemIndex)
distanceFromSkyback to summary
private double distanceFromSky(int itemIndex)
fillBackwardFromback to summary
private int fillBackwardFrom(int itemIndex)
fillBackwardFromback to summary
private int fillBackwardFrom(int itemIndex, double upTo)
fillBackwardFrom0back to summary
private int fillBackwardFrom0(int itemIndex)
fillBackwardFrom0back to summary
pack-priv int fillBackwardFrom0(int itemIndex, double upTo)
fillForwardFromback to summary
private int fillForwardFrom(int itemIndex)
fillForwardFromback to summary
private int fillForwardFrom(int itemIndex, double upTo)
fillForwardFrom0back to summary
private int fillForwardFrom0(int itemIndex)
fillForwardFrom0back to summary
pack-priv int fillForwardFrom0(int itemIndex, double upTo)
fillTowardsGroundFrom0back to summary
private int fillTowardsGroundFrom0(int itemIndex)
fillTowardsGroundFrom0back to summary
private int fillTowardsGroundFrom0(int itemIndex, double upTo)
fillTowardsSkyFrom0back to summary
private int fillTowardsSkyFrom0(int itemIndex)
fillViewportFromback to summary
private void fillViewportFrom(int itemIndex)

Starting from the anchor cell's node, fills the viewport from the anchor to the "ground" and then from the anchor to the "sky".

Parameters
itemIndex:int

the index of the anchor cell

getCurrentPositionback to summary
private TargetPosition getCurrentPosition()
getFirstVisibleIndexback to summary
public int getFirstVisibleIndex()

Get the index of the first visible cell (at the time of the last layout).

Returns:int

The index of the first visible cell

getLastVisibleIndexback to summary
public int getLastVisibleIndex()

Get the index of the last visible cell (at the time of the last layout).

Returns:int

The index of the last visible cell

itemsChangedback to summary
private void itemsChanged(QuasiListChange<?> ch)
layoutChildrenback to summary
protected void layoutChildren()

Overrides javafx.scene.Parent.layoutChildren.

Doc from javafx.scene.Parent.layoutChildren.

Invoked during the layout pass to layout the children in this Parent. By default it will only set the size of managed, resizable content to their preferred sizes and does not do any node positioning.

Subclasses should override this function to layout content as needed.

Annotations
@Override
placeEndOffEndMayCropback to summary
private void placeEndOffEndMayCrop(int itemIndex, double endOffEnd)
placeEndOffStartMayCropback to summary
private void placeEndOffStartMayCrop(int itemIndex, double endOffStart)
placeStartAtMayCropback to summary
private void placeStartAtMayCrop(int itemIndex, double startOffStart)
placeStartOffEndMayCropback to summary
private void placeStartOffEndMayCrop(int itemIndex, double startOffEnd)
placeToViewportback to summary
private void placeToViewport(int itemIndex, Offset from, Offset to)
placeToViewportback to summary
private void placeToViewport(int itemIndex, double fromY, double toY)
scrollCurrentPositionByback to summary
public void scrollCurrentPositionBy(double delta)

Sets the TargetPosition used to layout the anchor node to the current position scrolled by delta and re-lays out the viewport

setTargetPositionback to summary
public void setTargetPosition(TargetPosition targetPosition)

Sets the TargetPosition used to layout the anchor node and re-lays out the viewport

shiftCellsTowardsGroundback to summary
private void shiftCellsTowardsGround(int groundCellIndex, int lastCellIndex, double amount)
showLengthRegionback to summary
pack-priv void showLengthRegion(int itemIndex, double fromY, double toY)
visitback to summary
public void visit(StartOffStart targetPosition)

Implements org.fxmisc.flowless.TargetPositionVisitor.visit.

Annotations
@Override
visitback to summary
public void visit(EndOffEnd targetPosition)

Implements org.fxmisc.flowless.TargetPositionVisitor.visit.

Annotations
@Override
visitback to summary
public void visit(MinDistanceTo targetPosition)

Implements org.fxmisc.flowless.TargetPositionVisitor.visit.

Annotations
@Override