类 OrientationHelper.HorizontalHelper
- 所有已实现的接口:
OrientationHelper
- 封闭接口:
- OrientationHelper
OrientationHelper for Orientation.HORIZONTAL.
This helper is also responsible for listening to changes to the VirtualFlow's width,
because in such cases it's needed to recompute the number of cells needed (to add or remove),
and changes to the VirtualFlow.horizontalPositionProperty() to update the container's layoutX
property and call SimpleVirtualFlowContainer.update(double) with the new position.
- 另请参阅:
-
嵌套类概要
从接口继承的嵌套类/接口 io.github.palexdev.virtualizedfx.flow.base.OrientationHelper
OrientationHelper.HorizontalHelper, OrientationHelper.VerticalHelper -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明intdoublecomputeEstimatedHeight(double cellHeight) Computes the estimated height of the flow.doublecomputeEstimatedWidth(double cellWidth) Computes the estimated width of the flow.voiddispose()Removes and clears any listener.intComputes the first visible cell index in the viewport with this formula:doubleIf the Node's maxHeight is set toDouble.MAX_VALUEthen returns the VirtualFlow's height, otherwise callsOrientationHelper.boundSize(double, double, double).doublevoidDO NOT CALL THIS METHOD, it's automatically handled by the VirtualFlow.intComputes the first visible cell index in the viewport with this formula:voidComputes the Node's x position and then callsresizeRelocate(Node, double, double, double).voidresizeRelocate(Node node, double pos, double w, double h) Resizes and relocated the given node with the given parameters, the y offset is always 0.voidscrollBy(double pixels) Scrolls the flow by the given amount of pixels.voidscrollTo(int index) Scrolls the flow to the given cell index.voidCallsscrollTo(int)with 0 as argument.voidCallsscrollTo(int)with items size - 1 as argument.voidscrollToPixel(double pixel) Scrolls the flow to the given pixel value.
-
构造器详细资料
-
HorizontalHelper
-
-
方法详细资料
-
initialize
public void initialize()DO NOT CALL THIS METHOD, it's automatically handled by the VirtualFlow. -
firstVisible
public int firstVisible()Computes the first visible cell index in the viewport with this formula:(int) Math.floor(scrolled / cellWidth)The scrolled parameter is the amount of pixels scrolled from the left and cellWidth is the fixed cells' width.
The result is clamped between 0 and the number of items -1.
- 指定者:
firstVisible在接口中OrientationHelper- 返回:
- the index of the first visible cell in the viewport
-
lastVisible
public int lastVisible()Computes the first visible cell index in the viewport with this formula:(int) Math.ceil((scrolled + virtualFlowWidth) / cellWidth - 1)The scrolled parameter is the amount of pixels scrolled from the left, the virtualFlowWidth well... is self-explanatory, and cellWidth is the fixed cells' width.
The result is clamped between 0 and the number of items -1.
- 指定者:
lastVisible在接口中OrientationHelper- 返回:
- the index of the last visible cell in the viewport
-
computeCellsNumber
public int computeCellsNumber()- 指定者:
computeCellsNumber在接口中OrientationHelper- 返回:
- the number of cells to show based on the viewport's width and cells' width
-
computeEstimatedHeight
public double computeEstimatedHeight(double cellHeight) 从接口复制的说明:OrientationHelperComputes the estimated height of the flow.- 指定者:
computeEstimatedHeight在接口中OrientationHelper- 返回:
- the VirtualFlow's height
-
computeEstimatedWidth
public double computeEstimatedWidth(double cellWidth) 从接口复制的说明:OrientationHelperComputes the estimated width of the flow.- 指定者:
computeEstimatedWidth在接口中OrientationHelper- 返回:
- the given cellWidth multiplied by the number of items
-
getHeight
If the Node's maxHeight is set toDouble.MAX_VALUEthen returns the VirtualFlow's height, otherwise callsOrientationHelper.boundSize(double, double, double).- 指定者:
getHeight在接口中OrientationHelper- 返回:
- the height of the given node
-
getWidth
- 指定者:
getWidth在接口中OrientationHelper- 返回:
- the Node's pref width
-
resizeRelocate
Resizes and relocated the given node with the given parameters, the y offset is always 0.- 指定者:
resizeRelocate在接口中OrientationHelper- 参数:
node- the Node to resize and relocatepos- the x positionw- the widthh- the height
-
layout
Computes the Node's x position and then callsresizeRelocate(Node, double, double, double).- 指定者:
layout在接口中OrientationHelper
-
scrollBy
public void scrollBy(double pixels) Scrolls the flow by the given amount of pixels. Gets the current horizontal position and adds the given amount of pixels to it. The result is clamped between 0 and the hBar's max property.- 指定者:
scrollBy在接口中OrientationHelper
-
scrollTo
public void scrollTo(int index) Scrolls the flow to the given cell index. Computes the pixel value by multiplying the given index for the fixed cells' width, then callsscrollToPixel(double)with the result.- 指定者:
scrollTo在接口中OrientationHelper
-
scrollToFirst
public void scrollToFirst()CallsscrollTo(int)with 0 as argument.- 指定者:
scrollToFirst在接口中OrientationHelper
-
scrollToLast
public void scrollToLast()CallsscrollTo(int)with items size - 1 as argument.- 指定者:
scrollToLast在接口中OrientationHelper
-
scrollToPixel
public void scrollToPixel(double pixel) Scrolls the flow to the given pixel value. The given pixel value is clamped between 0 and the hBar's max property before.- 指定者:
scrollToPixel在接口中OrientationHelper
-
dispose
public void dispose()Removes and clears any listener.This must be called every time the OrientationHelper of the VirtualFlow is changed (typically occurs when the orientation changes).
- 指定者:
dispose在接口中OrientationHelper
-