Interface VFXScrollPaneSkin.LayoutHandler
- All Known Implementing Classes:
VFXScrollPaneSkin.BottomLeftHandler,VFXScrollPaneSkin.BottomRightHandler,VFXScrollPaneSkin.TopLeftHandler,VFXScrollPaneSkin.TopRightHandler
- Enclosing class:
VFXScrollPaneSkin
VFXScrollPane.vBarPosProperty() and the VFXScrollPane.hBarPosProperty(); and so this has four
concrete implementations for the following positions: TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT,
BOTTOM_LEFT.
It also defines common computations that depend on other properties and simpler conditions.
In general the scroll pane's layout is quite complex. For the sake of simplicity, and in some cases as design choices some properties may be ignored under specific conditions. See the methods docs.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<VFXScrollPaneSkin.PosPair, VFXScrollPaneSkin.LayoutHandler> -
Method Summary
Modifier and TypeMethodDescriptiondefault VFXScrollPaneSkin.LayoutInfocomputeViewportLayout(VFXScrollPane pane, VFXScrollBar vBar, VFXScrollBar hBar, double startXOffset, double endXOffset, double startYOffset, double endYOffset) Determines the viewport's size and position.default doublegetBarsGap(VFXScrollPane pane, VFXScrollBar vBar, VFXScrollBar hBar) default javafx.geometry.InsetsgetBarsPadding(VFXScrollPane pane) If theVFXScrollPane.layoutModeProperty()is set toScrollPaneEnums.LayoutMode.COMPACTbasically returnsRegion.insetsProperty(), otherwise returnsInsets.EMPTY.getHandler(VFXScrollPane pane) voidlayout(VFXScrollPane pane, javafx.scene.layout.Pane viewport, VFXScrollBar vBar, VFXScrollBar hBar)
-
Field Details
-
HANDLERS
-
-
Method Details
-
getHandler
- Returns:
- the appropriate
LayoutHandlerimplementation for the given scroll pane considering itsVFXScrollPane.vBarPosProperty()andVFXScrollPane.hBarPosProperty()
-
layout
void layout(VFXScrollPane pane, javafx.scene.layout.Pane viewport, VFXScrollBar vBar, VFXScrollBar hBar) -
getBarsGap
- Returns:
- the values specified by the
VFXScrollPane.scrollBarsGapProperty()or0.0if either thevBarorhBarare hidden. - See Also:
-
getBarsPadding
If theVFXScrollPane.layoutModeProperty()is set toScrollPaneEnums.LayoutMode.COMPACTbasically returnsRegion.insetsProperty(), otherwise returnsInsets.EMPTY. In other words: in compact mode the padding is used to space the scroll bars from the edges; in standard mode the bars cannot go on top of the viewport but instead the padding is used as the distance between the two.Which values of the
Insetsobject are used depend on the handler's implementation!! -
computeViewportLayout
default VFXScrollPaneSkin.LayoutInfo computeViewportLayout(VFXScrollPane pane, VFXScrollBar vBar, VFXScrollBar hBar, double startXOffset, double endXOffset, double startYOffset, double endYOffset) Determines the viewport's size and position.When the
In standard mode things are much more complicated. In simple terms, the offset parameters determine the distance from the origin ([0, 0]) and the end (which would be the scroll pane's [maxX, maxY]).VFXScrollPane.layoutModeProperty()is set toScrollPaneEnums.LayoutMode.COMPACTthe viewport always takes all the available space and is positioned at [0, 0].The reason for that is quite simple. This basically ensures that the viewport never covers the scroll bars and that there is the right distance between the three.
The offsets highly depend on the scroll bars positions as specified by the
Last but not least, note that the x and y offsets are ignored if either the vertical or horizontal scroll bar are hidden!!VFXScrollPane.vBarPosProperty()andVFXScrollPane.hBarPosProperty().For example, if the vertical bar is not visible, then we don't want to take it into account when laying out the viewport. We want the latter to take all the horizontal space. When the bar is on the right side, then we simply stretch the viewport's width to the end of the scroll pane. When the bar is on the left side, things are a bit more complex, because we want the width to be the same as the scroll pane, but we also need to position the viewport at
x = 0
-