Skip to content

SelectorNode

abstract class SelectorNode<V>
Extends: BaseSelectorNode<V>
Package: dev.joid.lib.ui.node.impl.control.selector · Module: core · Source: SelectorNode.java

A drop-down list made of a field and one node per option, with the selected option on top and the others in rows under it or above it.

A skin extends it and gives field(...) and option(value -> node). Each row has the height of the selector; while the list is open, the selector grows to show every option, and the field covers the whole list. A left press on an option selects it through change(...) and closes the list. Attaching a selector without a field or without an option function throws an IllegalStateException.

ReturnsSignatureSummary
SelectorNode(double x, double y, double width, double height) protectedCreates the selector at x, y with a width and a height in design pixels, from the constructor of a skin; the height is the height of one row.

PropertyTypeDefaultSummary
fieldNodenullThe node drawn behind the options, over the selected row while the list is closed and over every row while it is open, with a zindex of -1; required.
optionFunction<V,Node>nullThe function that creates the node of an option from its value.
direction signalSelectorDirectionSelectorDirection.DOWNThe side where the list opens: DOWN under the selected row, UP above it, near the bottom of the screen.
Inherited from BaseChoiceNode (3)

values · value · valueIndex

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
booleanisSelected(Node option)If true, a node is the node of the selected option.
NodegetSelected()Returns the node of the selected option, or null before the options exist.
List<Node>getOptionList()Returns the nodes of the options, in the order of the options, as a read-only list.
ReturnsSignatureSummary
voidupdate() hookWhen the list opens downward, gives the selector the height of every row while it is open, and of one row while it is closed; a list that opens upward keeps the height of one row.
voidlayout() hookPlaces the field and one row per option: the selected one first, the others in the order of getOptionRank, shown only while the list is open.
voidmousePressed(NodeMouseEvent<?> event) hookWhile the list is open, selects the option under a left press that no one consumed, then opens or closes the list as its base class does.
voidcreateOptions() hook protectedRemoves the nodes of the previous options and creates one node per option with the option function.
Inherited from BaseSelectorNode (7)

getOptionRank · active · open · close · beforeOpen · beforeClose · isActive

Inherited from BaseChoiceNode (3)

getValueList · change · beforeChange

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 BaseSelectorNode (2)

onOpen · onClose

Inherited from BaseChoiceNode (1)

onChange

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

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

Creates the selector at x, y with a width and a height in design pixels, from the constructor of a skin; the height is the height of one row.

  • this field(Node field) fluent
  • Node getField()

Default: null

The node drawn behind the options, over the selected row while the list is closed and over every row while it is open, with a zindex of -1; required.

  • this option(Function<V,Node> option) fluent

Default: null

The function that creates the node of an option from its value. The selector calls it again for every option each time the options change.

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

Default: SelectorDirection.DOWN

The side where the list opens: DOWN under the selected row, UP above it, near the bottom of the screen.

boolean isSelected(Node option)

If true, a node is the node of the selected option.

Node getSelected()

Returns the node of the selected option, or null before the options exist.

List<Node> getOptionList()

Returns the nodes of the options, in the order of the options, as a read-only list.

void update() hook

When the list opens downward, gives the selector the height of every row while it is open, and of one row while it is closed; a list that opens upward keeps the height of one row.

void layout() hook

Places the field and one row per option: the selected one first, the others in the order of getOptionRank, shown only while the list is open.

void mousePressed(NodeMouseEvent<?> event) hook

While the list is open, selects the option under a left press that no one consumed, then opens or closes the list as its base class does.

void createOptions() hook protected

Removes the nodes of the previous options and creates one node per option with the option function.


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