Skip to content

ReorderableFlexNode

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

A flex column or row whose children the user reorders by dragging them.

A left press on a child starts the drag; the other children slide away, and a scrolling parent scrolls when the child nears its edge. When the button is released, the child slides into its new place and the children take the new order. Pinned children keep their place.

ReturnsSignatureSummary
ReorderableFlexNodehorizontal(double x, double y, double height) factoryCreates a reorderable row at x, y, height high.
ReorderableFlexNodevertical(double x, double y, double width) factoryCreates a reorderable column at x, y, width wide.
ReorderableFlexNode(double x, double y, double width, double height) protectedCalled by a subclass to create a column.
ReorderableFlexNode(double x, double y, double width, double height, Axis direction) protectedCalled by a subclass with the direction.

PropertyTypeDefaultSummary
autoDrag signalbooleantrueIf true, a press on a child starts dragging it; if false, only startDrag does, such as from a handle.
Inherited from FlexNode (3)

direction · align · margin

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
Map<Node,Double>getChildCurrent()The offset shown for each child that slides during a drag.
intgetChildIndex(Node child)The place of the child in the list, in the order shown during a drag.
ReturnsSignatureSummary
thisstartDrag(Node child) fluentStarts dragging this child from the mouse position, unless a drag runs or the child is pinned.
thisendDrag() fluentDrops the dragged child; when a beforeDragDrop listener refuses, the child goes back to its first place.
booleanisDragging(Node child)If true, this child is being dragged.
ReturnsSignatureSummary
Set<Node>getPinnedNodes()The pinned children; a read-only view.
List<Node>getLogicalOrder()The order of the children during a drag; empty when no drag runs.
booleanisPinned(Node child)If true, the child is pinned.
NodegetReorderedNode()The child being dragged, or null.
ReturnsSignatureSummary
thispin(Node… children) fluentKeeps these children at their place: they cannot be dragged and the others move around them.
thisunpin(Node… children) fluentLets these children move again.
thisbeforeReorder(EventListener<NodeReorderEvent.Pre> listener) fluentAdds a listener that runs before the dragged child takes another place; cancelling the event keeps it at its place.
ReturnsSignatureSummary
voidlayout() hookMoves the dragged child with the mouse and slides the others, then places the children.
voidmousePressed(NodeMouseEvent<?> event) hookStarts dragging the hovered child on a left press when autoDrag is on, and consumes the press.
voidmouseReleased(NodeMouseEvent<?> event) hookDrops the dragged child when the left button is released.
voiddetach() hookEnds a drag in progress, keeping the order reached.
booleanisDraggingChild(Node child) hook protectedIf true, the child is dragged by the list and drawn above its siblings.
List<Node>getLayoutOrder() hook protectedThe children in the order shown during a drag.
voidlayoutChild(Node child, double offset) hook protectedPlaces a child at the offset it slides through during a drag.
Inherited from Node (127)

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 · 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

EventListenerSummary
onReorderStartEventListener<NodeReorderEvent.Post<T>>Adds a listener that runs when a drag starts.
onReorderEventListener<NodeReorderEvent.Post<T>>Adds a listener that runs each time the dragged child takes another place.
onReorderEndEventListener<NodeReorderEvent.Post<T>>Adds a listener that runs when the dragged child has settled, with its first and its last place.
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

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

Creates a reorderable row at x, y, height high.

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

Creates a reorderable column at x, y, width wide.

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

Called by a subclass to create a column.

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

Called by a subclass with the direction.

  • this autoDrag(boolean autoDrag) fluent
  • this autoDrag(Supplier<Boolean> autoDrag) fluent signal
  • boolean isAutoDrag()

Default: true

If true, a press on a child starts dragging it; if false, only startDrag does, such as from a handle.

Map<Node,Double> getChildCurrent()

The offset shown for each child that slides during a drag.

int getChildIndex(Node child)

Throws:

  • IllegalArgumentException: The node … is not a child of this …, attach it to the flex first

The place of the child in the list, in the order shown during a drag. Throws an IllegalArgumentException when the node is not a child of the list.

this startDrag(Node child) fluent

Starts dragging this child from the mouse position, unless a drag runs or the child is pinned. Throws an IllegalArgumentException when the node is not a child of the list.

this endDrag() fluent

Drops the dragged child; when a beforeDragDrop listener refuses, the child goes back to its first place.

boolean isDragging(Node child)

If true, this child is being dragged.

Set<Node> getPinnedNodes()

The pinned children; a read-only view.

List<Node> getLogicalOrder()

The order of the children during a drag; empty when no drag runs.

boolean isPinned(Node child)

If true, the child is pinned.

Node getReorderedNode()

The child being dragged, or null.

this pin(Node... children) fluent

Keeps these children at their place: they cannot be dragged and the others move around them.

this unpin(Node... children) fluent

Lets these children move again.

this beforeReorder(EventListener<NodeReorderEvent.Pre<T>> listener) fluent

Adds a listener that runs before the dragged child takes another place; cancelling the event keeps it at its place.

void layout() hook

Moves the dragged child with the mouse and slides the others, then places the children.

void mousePressed(NodeMouseEvent<?> event) hook

Starts dragging the hovered child on a left press when autoDrag is on, and consumes the press.

void mouseReleased(NodeMouseEvent<?> event) hook

Drops the dragged child when the left button is released.

void detach() hook

Ends a drag in progress, keeping the order reached.

boolean isDraggingChild(Node child) hook protected

If true, the child is dragged by the list and drawn above its siblings.

List<Node> getLayoutOrder() hook protected

The children in the order shown during a drag.

void layoutChild(Node child, double offset) hook protected

Places a child at the offset it slides through during a drag.

this onReorderStart(EventListener<NodeReorderEvent.Post<T>> listener) fluent

Adds a listener that runs when a drag starts.

this onReorder(EventListener<NodeReorderEvent.Post<T>> listener) fluent

Adds a listener that runs each time the dragged child takes another place.

this onReorderEnd(EventListener<NodeReorderEvent.Post<T>> listener) fluent

Adds a listener that runs when the dragged child has settled, with its first and its last place.


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