SwitchNode
abstract class SwitchNode<V>
Extends: BaseChoiceNode<V>
Package: dev.joid.lib.ui.node.impl.control.choice · Module: core · Source: SwitchNode.java
A choice that shows every option side by side, one node per option, and selects the option under a left press.
Description
Section titled “Description”A skin extends it and gives option((value, index) -> node), which creates the node of each option.
The switch splits its width equally between the options, in their order.
Attaching a switch without an option function throws an IllegalStateException.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| SwitchNode(double x, double y, double width, double height) protected | Creates the switch at x, y with a width and a height in design pixels, from the constructor of a skin. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| option | BiFunction<V,Integer,Node> | null | The function that creates the node of an option from its value and its index. |
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 |
|---|---|---|
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 | layout() hook | Places the nodes of the options side by side, each one as wide as the switch divided by the number of options. |
void | mousePressed(NodeMouseEvent<?> event) hook | Selects the option under a left press that no one consumed, through change(...), and consumes the press. |
void | createOptions() hook protected | Removes the nodes of the previous options and creates one node per option with the option function. |
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 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”SwitchNode
Section titled “SwitchNode”SwitchNode(double x, double y, double width, double height) protected
Creates the switch at x, y with a width and a height in design pixels, from the constructor of a skin.
Property details
Section titled “Property details”option
Section titled “option”this option(BiFunction<V,Integer,Node> option)fluent
Default: null
The function that creates the node of an option from its value and its index. The switch calls it again for every option each time the options change.
Method details
Section titled “Method details”getOptionList
Section titled “getOptionList”List<Node> getOptionList()
Returns the nodes of the options, in the order of the options, as a read-only list.
layout
Section titled “layout”void layout() hook
Places the nodes of the options side by side, each one as wide as the switch divided by the number of options.
mousePressed
Section titled “mousePressed”void mousePressed(NodeMouseEvent<?> event) hook
Selects the option under a left press that no one consumed, through change(...), and consumes the press.
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
