IntegerFieldNode
class IntegerFieldNode
Extends: LineFieldNode<Integer>
Package: dev.joid.lib.ui.node.impl.control.field · Module: core · Source: IntegerFieldNode.java
A one-line field that holds an Integer between a minimum and a maximum, stepped by Up, Down and the wheel.
Description
Section titled “Description”The user types digits, and a minus sign when min is below 0.
A typed value out of the range shows as its bound when the field loses the focus.
An empty field that the user leaves takes back its last value, 0 before any; with allowEmpty(true), it holds null.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
IntegerFieldNode | create(double x, double y, double width) factory | Creates the field at x, y with a width in design pixels; its height is the height of its font plus its top and bottom margins. |
IntegerFieldNode | create(double x, double y, double width, double height) factory | Creates the field at x, y with a width and a height in design pixels. |
| IntegerFieldNode(double x, double y, double width, double height) protected | Creates the field, from the constructor of a subclass. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| min signal | int | no lower bound (Integer.MIN_VALUE) | The smallest value; a typed value below it shows as min when the field loses the focus. |
| max signal | int | 2147483647 | The largest value; a typed value above it shows as max when the field loses the focus. |
| step signal | int | 1 | The amount that Up, Down and the wheel add or remove. |
Inherited from LineFieldNode (3)
Inherited from FieldNode (21)
background · cursorColor · selectionColor · placeholderColor · cursorMargin · cursorPosition · text · placeholder · info · accept · normalize · allowEmpty · maxTextLength · markup · margin · marginTop · marginBottom · marginLeft · marginRight · marginHorizontal · marginVertical
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 |
|---|---|---|
Integer | parse(String text) protected | Reads an optional minus sign and digits; a number beyond the range of int gives Integer.MAX_VALUE or Integer.MIN_VALUE, any other text null. |
String | format(Integer value) protected | Writes the value in decimal digits. |
Integer | correct(Integer value) protected | Brings the value between min and max. |
Integer | increment(Integer value, int count) protected | Returns the value count steps away, kept between min and max. |
this | value(int value) fluent | Gives the field its start value, brought into the range. |
this | value(Signal | Binds the value to a signal both ways: the field shows the signal, and writes the value of each valid edit into it. |
this | change(int value) fluent | Sets the value as if the user typed it: beforeChange can refuse it, then onChange fires. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
boolean | accepts(String text) hook protected | Accepts digits only, with a leading minus sign when min is below 0. |
Inherited from LineFieldNode (1)
Inherited from FieldNode (16)
cursorPosition · moveCursor · beforeCursorMove · focused · focus · beforeFocus · isFocused · getValue · isValid · getSelection · selection · beforeChange · blur · beforeBlur · select · beforeSelect
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 LineFieldNode (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”create
Section titled “create”IntegerFieldNode create(double x, double y, double width) factory
Creates the field at x, y with a width in design pixels; its height is the height of its font plus its top and bottom margins.
IntegerFieldNode create(double x, double y, double width, double height) factory
Creates the field at x, y with a width and a height in design pixels.
IntegerFieldNode
Section titled “IntegerFieldNode”IntegerFieldNode(double x, double y, double width, double height) protected
Creates the field, from the constructor of a subclass.
Property details
Section titled “Property details”this min(int min)fluentthis min(Supplier<Integer> min)fluent signalint getMin()
Default: no lower bound (Integer.MIN_VALUE)
The smallest value; a typed value below it shows as min when the field loses the focus.
this max(int max)fluentthis max(Supplier<Integer> max)fluent signalint getMax()
Default: 2147483647
The largest value; a typed value above it shows as max when the field loses the focus.
this step(int step)fluentthis step(Supplier<Integer> step)fluent signalint getStep()
Default: 1
Throws:
IllegalArgumentException: The step … of the IntegerFieldNode must be positive, pass a step of 1 or more
The amount that Up, Down and the wheel add or remove.
A step of 0 or less throws an IllegalArgumentException.
Method details
Section titled “Method details”Integer parse(String text) protected
Reads an optional minus sign and digits; a number beyond the range of int gives Integer.MAX_VALUE or Integer.MIN_VALUE, any other text null.
format
Section titled “format”String format(Integer value) protected
Writes the value in decimal digits.
correct
Section titled “correct”Integer correct(Integer value) protected
Brings the value between min and max.
increment
Section titled “increment”Integer increment(Integer value, int count) protected
Returns the value count steps away, kept between min and max.
this value(int value) fluent
Gives the field its start value, brought into the range.
this value(Signal<Integer> value) fluent
Binds the value to a signal both ways: the field shows the signal, and writes the value of each valid edit into it.
Throws an IllegalArgumentException for a signal that cannot be written.
change
Section titled “change”this change(int value) fluent
Sets the value as if the user typed it: beforeChange can refuse it, then onChange fires.
accepts
Section titled “accepts”boolean accepts(String text) hook protected
Accepts digits only, with a leading minus sign when min is below 0.
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
