Skip to content

FlexNode

class FlexNode
Extends: Node
Known subtypes: ReorderableFlexNode
Package: dev.joid.lib.ui.node.impl.layout · Module: core · Source: FlexNode.java

Places its visible children one after the other in a column or a row, and takes the size of its content.

Four blue rectangles in a row, evenly spaced

On the main axis, a size of 0 takes the size of the content; a declared size is a minimum without overflow, and a fixed size with an overflow. The children keep their own position as an offset that moves the child alone, without pushing the next ones; an ABSOLUTE or hidden child is left out.

ReturnsSignatureSummary
FlexNodehorizontal(double x, double y, double height) factoryCreates a row at x, y, height high, whose width follows its children.
FlexNodevertical(double x, double y, double width) factoryCreates a column at x, y, width wide, whose height follows its children.
FlexNode(double x, double y, double width, double height) protectedCalled by a subclass to create a column.
FlexNode(double x, double y, double width, double height, Axis direction) protectedCalled by a subclass with the direction.

PropertyTypeDefaultSummary
direction signalAxisset at creationVERTICAL for a column, HORIZONTAL for a row.
align signalAlignnone, the children keep their own cross positionWhere the children sit across the line: START, CENTER or END; null keeps their own cross position.
margin signaldouble0DSpace between two children, in design pixels.
Inherited from Node (24)

x · y · width · height · position · anchor · anchorX · anchorY · aspectRatio · zindex · zlevel · skeleton · visible · enabled · interactive · cursor · hoverDuration · hoverEquation · hover · overflow · scrollSpeed · scrollbar · label · draggable

ReturnsSignatureSummary
booleanisLaidOut(Node child) protectedIf true, the child takes part in the layout: it is visible and not ABSOLUTE.
ReturnsSignatureSummary
voidinit(UI ui) hookPlaces the children when the node loads.
voidupdate() hookPlaces the children on every frame, after they have measured their size.
voidlayout() hookPlaces the children again right before they are drawn.
voiddrawSkeleton(double mouseX, double mouseY) hookDraws nothing while the flex node waits.
List<Node>getLayoutOrder() hook protectedThe children in the order they are placed; a subclass overrides it to change the order.
voidlayoutChild(Node child, double offset) hook protectedPlaces a child at this offset along the main axis, and across it by align; a subclass overrides it to move a child.
Inherited from Node (128)

load · render · renderHover · updateScroll · updateScrollX · updateScrollY · append · attach · body · clearChildren · getChild · getChildren · getNodeListAt · getParent · isAttached · getAbsoluteX · getAbsoluteY · getAbsoluteDefaultX · getAbsoluteDefaultY · toDrawX · toDrawY · w · h · dw · dh · mw · mh · aw · ah · ax · ay · getDefaultWidth · getDefaultHeight · removeHover · clearHover · refreshHover · getResolvedCursor · hoverValue · getHoverAnimator · isHovered · handleMousePressed · handleMouseReleased · handleMouseDragged · handleMouseScroll · handleCharTyped · handleKeyPressed · handleKeyReleased · getLastClickTime · getLastClickButton · getLastKey · getLastKeyTime · scrollX · scrollY · scrollTo · beforeScroll · hasOverflowX · hasOverflowY · getOverflowArea · getScrollX · getScrollY · getTargetScrollX · getTargetScrollY · getMaxScrollX · getMaxScrollY · isScrollEndX · isScrollEndY · startDragging · stopDragging · beforeDragStart · beforeDragDrop · isDragging · getDragX · getDragY · isDragged · getDragSource · getDraggedNode · getStartDragX · getStartDragY · getTargetDragX · getTargetDragY · effect · removeEffect · clearEffects · hasEffect · getEffect · layer · clearLayers · animate · removeAnimator · wait · watch · hasListener · isVisibleProperty · isMounted · getIndex · getUi · getHierarchy · getMappedIndex · getTaskList · getShortcutList · toJson · toString · getEventBus · getBodyConsumer · getDefaultX · getDefaultY · getLayoutX · getLayoutY · getShiftX · getShiftY · isStepping · getLastCodepoint · getLoadCount · getRenderTime · remove · self · copy · useStore · addTask · removeTask · addShortcut · removeShortcut · layoutPosition · layoutSize · fit · move · beforeMove · hoverColor

Inherited from Node (21)

onUpdate · onDetach · onInit · onRender · onDraw · onMount · onHoverStart · onHover · onHoverEnd · onScroll · onScrollToEnd · onScrollEndReached · onDragStart · onDrag · onDragDrop · onDragSnap · onMove · onChildAppend · onClick · onAnimate · onWatch

FlexNode horizontal(double x, double y, double height) factory

Creates a row at x, y, height high, whose width follows its children.

FlexNode vertical(double x, double y, double width) factory

Creates a column at x, y, width wide, whose height follows its children.

FlexNode(double x, double y, double width, double height) protected

Called by a subclass to create a column.

FlexNode(double x, double y, double width, double height, Axis direction) protected

Called by a subclass with the direction.

  • this direction(Axis direction) fluent
  • this direction(Supplier<Axis> direction) fluent signal
  • Axis getDirection()

Default: set at creation

VERTICAL for a column, HORIZONTAL for a row.

  • this align(Align align) fluent
  • this align(Supplier<Align> align) fluent signal
  • Align getAlign()

Default: none, the children keep their own cross position

Where the children sit across the line: START, CENTER or END; null keeps their own cross position.

  • this margin(double margin) fluent
  • this margin(Supplier<Double> margin) fluent signal
  • double getMargin()

Default: 0D

Space between two children, in design pixels.

boolean isLaidOut(Node child) protected

If true, the child takes part in the layout: it is visible and not ABSOLUTE.

void init(UI ui) hook

Places the children when the node loads.

void update() hook

Places the children on every frame, after they have measured their size.

void layout() hook

Places the children again right before they are drawn.

void drawSkeleton(double mouseX, double mouseY) hook

Draws nothing while the flex node waits.

List<Node> getLayoutOrder() hook protected

The children in the order they are placed; a subclass overrides it to change the order.

void layoutChild(Node child, double offset) hook protected

Places a child at this offset along the main axis, and across it by align; a subclass overrides it to move a child.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page