Skip to content

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.

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.

ReturnsSignatureSummary
BaseSelectorNode(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.

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
intgetOptionRank(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.
Tactive(boolean active)Gives the list its start state: true is open.
Tactive(Signal active)Binds the open state to a signal both ways: the list follows the signal, and a press writes the new state into it.
thisopen() fluentOpens the list as if the user pressed the selector: beforeOpen can refuse it, then onOpen fires.
thisclose() fluentCloses the list as if the user pressed it: beforeClose can refuse it, then onClose fires.
TbeforeOpen(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)Adds a listener that runs before the list opens on a press or open(); cancel() keeps it closed.
TbeforeClose(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)Adds a listener that runs before the list closes on a press or close(); cancel() keeps it open.
booleanisActive()If true, the list is open.
ReturnsSignatureSummary
voidmousePressed(NodeMouseEvent<?> event) hookOn 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.
voiddetach() hookCloses the list when the selector leaves the tree.
booleanholdsInput() hook protectedIf 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)

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

EventListenerSummary
onOpenEventListener<NodeChangeEvent.Post<T,Boolean>>Adds a listener that runs each time the list opens, whatever its source.
onCloseEventListener<NodeChangeEvent.Post<T,Boolean>>Adds a listener that runs each time the list closes, whatever its source.
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

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.

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

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

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

boolean isActive()

If true, the list is open.

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.

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

<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

Report a problem with this page