BaseSelectorNode
abstract class BaseSelectorNode<V>
Extends: BaseChoiceNode<V>
Known subtypes: SelectorNode
Package: dev.joid.lib.ui.node.impl.control.selector · Module: core · Source: BaseSelectorNode.java
The behavior of a drop-down list without its look: a choice whose list opens on a left press and closes on the next one.
Description
Section titled “Description”Extend SelectorNode for a look made of a field and one node per option; extend BaseSelectorNode only to build the look entirely yourself.
While the list is open, a left press anywhere closes it; the list closes too when the selector is detached.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| BaseSelectorNode(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. |
Properties
Section titled “Properties”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 |
|---|---|---|
int | getOptionRank(V value) | Returns the row of an option in the open list: 0 for the selected option, then the other options in their order, from 1. |
T | active(boolean active) | Gives the list its start state: true is open. |
T | active(Signal | Binds the open state to a signal both ways: the list follows the signal, and a press writes the new state into it. |
this | open() fluent | Opens the list as if the user pressed the selector: beforeOpen can refuse it, then onOpen fires. |
this | close() fluent | Closes the list as if the user pressed it: beforeClose can refuse it, then onClose fires. |
T | beforeOpen(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener) | Adds a listener that runs before the list opens on a press or open(); cancel() keeps it closed. |
T | beforeClose(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener) | Adds a listener that runs before the list closes on a press or close(); cancel() keeps it open. |
boolean | isActive() | If true, the list is open. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | mousePressed(NodeMouseEvent<?> event) hook | On a left press, opens the closed list when the press is over the selector, or closes the open list wherever the press is; a press over the selector is consumed. |
void | detach() hook | Closes the list when the selector leaves the tree. |
boolean | holdsInput() hook protected | If true, the selector is open: a click beside it still closes it while it is scrolled out of the area of its container. |
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”| Event | Listener | Summary |
|---|---|---|
| onOpen | EventListener<NodeChangeEvent.Post<T,Boolean>> | Adds a listener that runs each time the list opens, whatever its source. |
| onClose | EventListener<NodeChangeEvent.Post<T,Boolean>> | Adds a listener that runs each time the list closes, whatever its source. |
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”BaseSelectorNode
Section titled “BaseSelectorNode”BaseSelectorNode(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.
Method details
Section titled “Method details”getOptionRank
Section titled “getOptionRank”int getOptionRank(V value)
Returns the row of an option in the open list: 0 for the selected option, then the other options in their order, from 1.
active
Section titled “active”<T extends BaseSelectorNode<V>> T active(boolean active)
Gives the list its start state: true is open.
<T extends BaseSelectorNode<V>> T active(Signal<Boolean> active)
Binds the open state to a signal both ways: the list follows the signal, and a press writes the new state into it.
Throws an IllegalArgumentException for a signal that cannot be written.
this open() fluent
Opens the list as if the user pressed the selector: beforeOpen can refuse it, then onOpen fires.
this close() fluent
Closes the list as if the user pressed it: beforeClose can refuse it, then onClose fires.
beforeOpen
Section titled “beforeOpen”<T extends BaseSelectorNode<V>> T beforeOpen(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)
Adds a listener that runs before the list opens on a press or open(); cancel() keeps it closed.
beforeClose
Section titled “beforeClose”<T extends BaseSelectorNode<V>> T beforeClose(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)
Adds a listener that runs before the list closes on a press or close(); cancel() keeps it open.
isActive
Section titled “isActive”boolean isActive()
If true, the list is open.
mousePressed
Section titled “mousePressed”void mousePressed(NodeMouseEvent<?> event) hook
On a left press, opens the closed list when the press is over the selector, or closes the open list wherever the press is; a press over the selector is consumed.
detach
Section titled “detach”void detach() hook
Closes the list when the selector leaves the tree.
holdsInput
Section titled “holdsInput”boolean holdsInput() hook protected
If true, the selector is open: a click beside it still closes it while it is scrolled out of the area of its container.
Event details
Section titled “Event details”onOpen
Section titled “onOpen”<T extends BaseSelectorNode<V>> T onOpen(EventListener<NodeChangeEvent.Post<T,Boolean>> listener)
Adds a listener that runs each time the list opens, whatever its source.
onClose
Section titled “onClose”<T extends BaseSelectorNode<V>> T onClose(EventListener<NodeChangeEvent.Post<T,Boolean>> listener)
Adds a listener that runs each time the list closes, whatever its source.
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
