LineFieldNode
abstract class LineFieldNode<V>
Extends: FieldNode<V>
Known subtypes: IntegerFieldNode, TextFieldNode
Package: dev.joid.lib.ui.node.impl.control.field · Module: core · Source: LineFieldNode.java
A one-line field: Enter submits it, and its text scrolls sideways to follow the cursor.
Description
Section titled “Description”Extend it for a field of your own value type: write parse and format, and correct, accepts or increment when the type needs them.
A field of height 0 takes the height of its font plus its top and bottom margins.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
| LineFieldNode(double x, double y, double width, double height) protected | Creates the field at x, y with a width and a height in design pixels, from the constructor of a subclass. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| align signal | Align | Sets alignX and alignY at once. | |
| alignX signal | Align | Align.START | Where the text sits across the field when it fits: at the start, the center or the end. |
| alignY signal | Align | Align.CENTER | Where the text sits in the height of the field: at the top with marginTop, the center, or the bottom with marginBottom. |
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
Redefined defaults:
| Property | Default here | Inherited default |
|---|---|---|
| marginHorizontal | 2D | not read in FieldNode |
| marginVertical | 10D | not read in FieldNode |
| cursorMargin | 15D | 0D in FieldNode |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
BoundingBox | getCursorArea() | Returns the area of the cursor on the line, with the sideways scroll of the text. |
boolean | isMultiline() protected | Returns false: the text holds one line. |
boolean | handleKey(Key key) protected | Handles Enter and the Enter of the keypad: asks the field to blur, then fires onSubmit if the field lost the focus. |
int | getPositionAt(double mouseX, double mouseY) protected | Returns the index in the text nearest to the pointer, along the line. |
void | followCursorForward() protected | Scrolls the text to the left when the cursor passes the right margin. |
void | followCursorBackward() protected | Scrolls the text to the right when the cursor passes the left margin. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | update() hook | Gives a field of height 0 the height of its font plus its top and bottom margins. |
void | drawField() hook protected | Draws the text or the placeholder between the margins, with the cursor while the field has the focus and the selection. |
Inherited from FieldNode (17)
cursorPosition · moveCursor · beforeCursorMove · focused · focus · beforeFocus · isFocused · getValue · isValid · getSelection · selection · change · 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”| Event | Listener | Summary |
|---|---|---|
| onSubmit | EventListener<NodeEvent<T>> | Adds a listener that runs when the user presses Enter or the Enter of the keypad and the field blurs: it does not run when a beforeBlur listener keeps the focus. |
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”LineFieldNode
Section titled “LineFieldNode”LineFieldNode(double x, double y, double width, double height) protected
Creates the field at x, y with a width and a height in design pixels, from the constructor of a subclass.
Property details
Section titled “Property details”this align(Align align)fluentthis align(Supplier<Align> align)fluent signal
Sets alignX and alignY at once.
alignX
Section titled “alignX”this alignX(Align alignX)fluentthis alignX(Supplier<Align> alignX)fluent signalAlign getAlignX()
Default: Align.START
Where the text sits across the field when it fits: at the start, the center or the end. A text at the start, or one wider than the field, scrolls to follow the cursor.
alignY
Section titled “alignY”this alignY(Align alignY)fluentthis alignY(Supplier<Align> alignY)fluent signalAlign getAlignY()
Default: Align.CENTER
Where the text sits in the height of the field: at the top with marginTop, the center, or the bottom with marginBottom.
Method details
Section titled “Method details”getCursorArea
Section titled “getCursorArea”BoundingBox getCursorArea()
Returns the area of the cursor on the line, with the sideways scroll of the text.
isMultiline
Section titled “isMultiline”boolean isMultiline() protected
Returns false: the text holds one line.
handleKey
Section titled “handleKey”boolean handleKey(Key key) protected
Handles Enter and the Enter of the keypad: asks the field to blur, then fires onSubmit if the field lost the focus.
getPositionAt
Section titled “getPositionAt”int getPositionAt(double mouseX, double mouseY) protected
Returns the index in the text nearest to the pointer, along the line.
followCursorForward
Section titled “followCursorForward”void followCursorForward() protected
Scrolls the text to the left when the cursor passes the right margin.
followCursorBackward
Section titled “followCursorBackward”void followCursorBackward() protected
Scrolls the text to the right when the cursor passes the left margin.
update
Section titled “update”void update() hook
Gives a field of height 0 the height of its font plus its top and bottom margins.
drawField
Section titled “drawField”void drawField() hook protected
Draws the text or the placeholder between the margins, with the cursor while the field has the focus and the selection.
Event details
Section titled “Event details”onSubmit
Section titled “onSubmit”this onSubmit(EventListener<NodeEvent<T>> listener) fluent
Adds a listener that runs when the user presses Enter or the Enter of the keypad and the field blurs: it does not run when a beforeBlur listener keeps the focus.
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
