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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
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. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| autoDrag signal | boolean | true | If true, a press on a child starts dragging it; if false, only startDrag does, such as from a handle. |
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
Methods
Section titled “Methods”Children
Section titled “Children”| Returns | Signature | Summary |
|---|---|---|
Map<Node,Double> | getChildCurrent() | The offset shown for each child that slides during a drag. |
int | getChildIndex(Node child) | The place of the child in the list, in the order shown during a drag. |
Drag and drop
Section titled “Drag and drop”| Returns | Signature | Summary |
|---|---|---|
this | startDrag(Node child) fluent | Starts dragging this child from the mouse position, unless a drag runs or the child is pinned. |
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. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
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. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
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 | Adds a listener that runs before the dragged child takes another place; cancelling the event keeps it at its place. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
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. |
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
Events
Section titled “Events”| Event | Listener | Summary |
|---|---|---|
| onReorderStart | EventListener<NodeReorderEvent.Post<T>> | Adds a listener that runs when a drag starts. |
| onReorder | EventListener<NodeReorderEvent.Post<T>> | Adds a listener that runs each time the dragged child takes another place. |
| onReorderEnd | EventListener<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
Creation details
Section titled “Creation details”horizontal
Section titled “horizontal”ReorderableFlexNode horizontal(double x, double y, double height) factory
Creates a reorderable row at x, y, height high.
vertical
Section titled “vertical”ReorderableFlexNode vertical(double x, double y, double width) factory
Creates a reorderable column at x, y, width wide.
ReorderableFlexNode
Section titled “ReorderableFlexNode”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.
Property details
Section titled “Property details”autoDrag
Section titled “autoDrag”this autoDrag(boolean autoDrag)fluentthis autoDrag(Supplier<Boolean> autoDrag)fluent signalboolean isAutoDrag()
Default: true
If true, a press on a child starts dragging it; if false, only startDrag does, such as from a handle.
Method details
Section titled “Method details”getChildCurrent
Section titled “getChildCurrent”Map<Node,Double> getChildCurrent()
The offset shown for each child that slides during a drag.
getChildIndex
Section titled “getChildIndex”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.
startDrag
Section titled “startDrag”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.
endDrag
Section titled “endDrag”this endDrag() fluent
Drops the dragged child; when a beforeDragDrop listener refuses, the child goes back to its first place.
isDragging
Section titled “isDragging”boolean isDragging(Node child)
If true, this child is being dragged.
getPinnedNodes
Section titled “getPinnedNodes”Set<Node> getPinnedNodes()
The pinned children; a read-only view.
getLogicalOrder
Section titled “getLogicalOrder”List<Node> getLogicalOrder()
The order of the children during a drag; empty when no drag runs.
isPinned
Section titled “isPinned”boolean isPinned(Node child)
If true, the child is pinned.
getReorderedNode
Section titled “getReorderedNode”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.
beforeReorder
Section titled “beforeReorder”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.
layout
Section titled “layout”void layout() hook
Moves the dragged child with the mouse and slides the others, then places the children.
mousePressed
Section titled “mousePressed”void mousePressed(NodeMouseEvent<?> event) hook
Starts dragging the hovered child on a left press when autoDrag is on, and consumes the press.
mouseReleased
Section titled “mouseReleased”void mouseReleased(NodeMouseEvent<?> event) hook
Drops the dragged child when the left button is released.
detach
Section titled “detach”void detach() hook
Ends a drag in progress, keeping the order reached.
isDraggingChild
Section titled “isDraggingChild”boolean isDraggingChild(Node child) hook protected
If true, the child is dragged by the list and drawn above its siblings.
getLayoutOrder
Section titled “getLayoutOrder”List<Node> getLayoutOrder() hook protected
The children in the order shown during a drag.
layoutChild
Section titled “layoutChild”void layoutChild(Node child, double offset) hook protected
Places a child at the offset it slides through during a drag.
Event details
Section titled “Event details”onReorderStart
Section titled “onReorderStart”this onReorderStart(EventListener<NodeReorderEvent.Post<T>> listener) fluent
Adds a listener that runs when a drag starts.
onReorder
Section titled “onReorder”this onReorder(EventListener<NodeReorderEvent.Post<T>> listener) fluent
Adds a listener that runs each time the dragged child takes another place.
onReorderEnd
Section titled “onReorderEnd”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
