Class ScrollContainer.Builder
java.lang.Object
com.trevlar.menukit.api.element.AbstractPanelElement.Builder<ScrollContainer, ScrollContainer.Builder>
com.trevlar.menukit.api.element.ScrollContainer.Builder
- Enclosing class:
ScrollContainer
public static class ScrollContainer.Builder
extends AbstractPanelElement.Builder<ScrollContainer, ScrollContainer.Builder>
-
Field Summary
Fields inherited from class AbstractPanelElement.Builder
declId, disabledWhen, height, opaque, tooltip, visibleWhen, width, x, y -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the element.content(List<? extends PanelElement> content) Required: the children, positioned from the viewport's top-left.contentHeight(int pixels) The scrollable height, when not the children's extent (room past the end, say).As tall as its content up to the declared height, scrolling past it.fitRoom(int step) As tall as its content while there is room, shorter by wholesteps when there is not, never below the declared height (7.4.0): content shorter than that leaves the rest of the declared height empty, so the frame keeps its size as the content shrinks.fitWidth()As wide as its content instead of a declared width: the widest child, the band's inset in the Default look and the scrollbar lane.height(int height) The viewport's height alone, for a container that fits its width to its content (fitWidth).The scrollbar lane beside the declared width rather than inside it (7.4.0): the content has the whole width, and the container is a lane wider only while the content overflows, so what holds it makes room for the scrollbar just then.protected ScrollContainer.Builderself()Returnsthisas the concrete builder.size(int width, int height) Required: the outer size, scrollbar lane included.state(DoubleSupplier get, DoubleConsumer set) The consumer owns the scroll, in pixels from the top:getis read every frame,setreceives each change.Methods inherited from class AbstractPanelElement.Builder
at, declId, disabledWhen, opaque, require, tooltip, tooltip, tooltip, visibleWhen
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
self
Description copied from class:AbstractPanelElement.BuilderReturnsthisas the concrete builder.- Specified by:
selfin classAbstractPanelElement.Builder<ScrollContainer, ScrollContainer.Builder>
-
size
Required: the outer size, scrollbar lane included.- Overrides:
sizein classAbstractPanelElement.Builder<ScrollContainer, ScrollContainer.Builder>
-
height
The viewport's height alone, for a container that fits its width to its content (fitWidth). -
fitWidth
As wide as its content instead of a declared width: the widest child, the band's inset in the Default look and the scrollbar lane. Given more room by its panel, it takes it and lays its children out to it. Give it itsheight(int). -
fitHeight
As tall as its content up to the declared height, scrolling past it. It pushes what is below it as it grows (7.3.0): place what follows as if it took no room. -
laneOutside
The scrollbar lane beside the declared width rather than inside it (7.4.0): the content has the whole width, and the container is a lane wider only while the content overflows, so what holds it makes room for the scrollbar just then. Withsize(int, int), notfitWidth(). -
fitRoom
As tall as its content while there is room, shorter by wholesteps when there is not, never below the declared height (7.4.0): content shorter than that leaves the rest of the declared height empty, so the frame keeps its size as the content shrinks. In a container region section it shows every row without a scrollbar while the window has the height and scrolls once it is too short; elsewhere it is as tall as its content. It pushes what is below it, asfitHeight()does. Pair withlaneOutside()for a lane only while it scrolls:.size(ContainerRegion.CONTENT_WIDTH, 3 * 18).laneOutside().fitRoom(18).- Parameters:
step- the row height it shrinks by,> 0
-
fillHeight
Takes the height its container gives it (7.3.0): the room a panel's viewport leaves below it, what a verticalFlowhas left after its other children, aTabspage's height. So a header stays put above it and only it scrolls: a list under a title and a "New" row. Where there is no height to give, it is its declared height, or without one as tall as its content. Pair withsize(int, int)orfitWidth(). -
content
Required: the children, positioned from the viewport's top-left. -
contentHeight
The scrollable height, when not the children's extent (room past the end, say). -
state
The consumer owns the scroll, in pixels from the top:getis read every frame,setreceives each change. Without it the scroll is the container's own view state. -
build
Description copied from class:AbstractPanelElement.BuilderBuilds the element. ThrowsIllegalStateExceptionwhen a required setting is missing.- Specified by:
buildin classAbstractPanelElement.Builder<ScrollContainer, ScrollContainer.Builder>
-