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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| 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. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| field | Node | 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. |
| option | Function<V,Node> | null | The function that creates the node of an option from its value. |
| direction signal | SelectorDirection | SelectorDirection.DOWN | The 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
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
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. |
Inherited from BaseSelectorNode (7)
getOptionRank · active · open · close · beforeOpen · beforeClose · isActive
Inherited from BaseChoiceNode (3)
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
Events
Section titled “Events”Inherited from BaseSelectorNode (2)
Inherited from BaseChoiceNode (1)
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”SelectorNode
Section titled “SelectorNode”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.
Property details
Section titled “Property details”this field(Node field)fluentNode 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.
option
Section titled “option”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.
direction
Section titled “direction”this direction(SelectorDirection direction)fluentthis direction(Supplier<SelectorDirection> direction)fluent signalSelectorDirection getDirection()
Default: SelectorDirection.DOWN
The side where the list opens: DOWN under the selected row, UP above it, near the bottom of the screen.
Method details
Section titled “Method details”isSelected
Section titled “isSelected”boolean isSelected(Node option)
If true, a node is the node of the selected option.
getSelected
Section titled “getSelected”Node getSelected()
Returns the node of the selected option, or null before the options exist.
getOptionList
Section titled “getOptionList”List<Node> getOptionList()
Returns the nodes of the options, in the order of the options, as a read-only list.
update
Section titled “update”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.
layout
Section titled “layout”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.
mousePressed
Section titled “mousePressed”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.
createOptions
Section titled “createOptions”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
