Skip to content

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.

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.

ReturnsSignatureSummary
LineFieldNode(double x, double y, double width, double height) protectedCreates the field at x, y with a width and a height in design pixels, from the constructor of a subclass.

PropertyTypeDefaultSummary
align signalAlignSets alignX and alignY at once.
alignX signalAlignAlign.STARTWhere the text sits across the field when it fits: at the start, the center or the end.
alignY signalAlignAlign.CENTERWhere 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:

PropertyDefault hereInherited default
marginHorizontal2Dnot read in FieldNode
marginVertical10Dnot read in FieldNode
cursorMargin15D0D in FieldNode

ReturnsSignatureSummary
BoundingBoxgetCursorArea()Returns the area of the cursor on the line, with the sideways scroll of the text.
booleanisMultiline() protectedReturns false: the text holds one line.
booleanhandleKey(Key key) protectedHandles Enter and the Enter of the keypad: asks the field to blur, then fires onSubmit if the field lost the focus.
intgetPositionAt(double mouseX, double mouseY) protectedReturns the index in the text nearest to the pointer, along the line.
voidfollowCursorForward() protectedScrolls the text to the left when the cursor passes the right margin.
voidfollowCursorBackward() protectedScrolls the text to the right when the cursor passes the left margin.
ReturnsSignatureSummary
voidupdate() hookGives a field of height 0 the height of its font plus its top and bottom margins.
voiddrawField() hook protectedDraws 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

EventListenerSummary
onSubmitEventListener<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 FieldNode (5)

onChange · onFocus · onBlur · onCursorMove · onSelect

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

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.

  • this align(Align align) fluent
  • this align(Supplier<Align> align) fluent signal

Sets alignX and alignY at once.

  • this alignX(Align alignX) fluent
  • this alignX(Supplier<Align> alignX) fluent signal
  • Align 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.

  • this alignY(Align alignY) fluent
  • this alignY(Supplier<Align> alignY) fluent signal
  • Align 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.

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.

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.

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

Report a problem with this page