BaseCheckboxNode
abstract class BaseCheckboxNode
Extends: Node
Known subtypes: CheckboxNode
Package: dev.joid.lib.ui.node.impl.control.checkbox · Module: core · Source: BaseCheckboxNode.java
The behavior of a checkbox without its look: a boolean that a left press on the node toggles.
Description
Section titled “Description”Extend CheckboxNode for a look made of a box and a mark; extend BaseCheckboxNode only to build the look entirely yourself.
The value follows the pattern of every control: a start value, a signal bound both ways, change(...), beforeChange and onChange.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| BaseCheckboxNode(double x, double y, double width, double height) protected | Creates the checkbox at x, y with a width and a height in design pixels, from the constructor of a skin. |
Properties
Section titled “Properties”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 |
|---|---|---|
T | checked(boolean checked) | Gives the checkbox its start value; the box shows it, and a box attached already fires onChange when it differs. |
T | checked(Signal | Binds the value to a signal both ways: the box shows the signal, and a press writes the new value into it. |
this | change(boolean checked) fluent | Sets the value as if the user pressed the box: beforeChange can refuse it, then onChange fires. |
T | beforeChange(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener) | Adds a listener that runs before a change that a press or change(...) asks for, with the value now and the value asked for; cancel() refuses it. |
boolean | isChecked() | If true, the box is checked. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | mousePressed(NodeMouseEvent<?> event) hook | Toggles the value on a left press over the box that no one consumed, and consumes the press. |
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 |
|---|---|---|
| onChange | EventListener<NodeChangeEvent.Post<T,Boolean>> | Adds a listener that runs after each real change of the value, whatever its source. |
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”BaseCheckboxNode
Section titled “BaseCheckboxNode”BaseCheckboxNode(double x, double y, double width, double height) protected
Creates the checkbox at x, y with a width and a height in design pixels, from the constructor of a skin.
Method details
Section titled “Method details”checked
Section titled “checked”<T extends BaseCheckboxNode> T checked(boolean checked)
Gives the checkbox its start value; the box shows it, and a box attached already fires onChange when it differs.
A setter is never refused.
<T extends BaseCheckboxNode> T checked(Signal<Boolean> checked)
Binds the value to a signal both ways: the box shows the signal, and a press writes the new value into it.
Throws an IllegalArgumentException for a signal that cannot be written, such as a derived value.
change
Section titled “change”this change(boolean checked) fluent
Sets the value as if the user pressed the box: beforeChange can refuse it, then onChange fires.
beforeChange
Section titled “beforeChange”<T extends BaseCheckboxNode> T beforeChange(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)
Adds a listener that runs before a change that a press or change(...) asks for, with the value now and the value asked for; cancel() refuses it.
isChecked
Section titled “isChecked”boolean isChecked()
If true, the box is checked.
mousePressed
Section titled “mousePressed”void mousePressed(NodeMouseEvent<?> event) hook
Toggles the value on a left press over the box that no one consumed, and consumes the press.
Event details
Section titled “Event details”onChange
Section titled “onChange”<T extends BaseCheckboxNode> T onChange(EventListener<NodeChangeEvent.Post<T,Boolean>> listener)
Adds a listener that runs after each real change of the value, whatever its source. It does not run for a value equal to the current one.
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
