Skip to content

FieldNode

abstract class FieldNode<V>
Extends: Node
Known subtypes: LineFieldNode, MultilineTextFieldNode
Package: dev.joid.lib.ui.node.impl.control.field · Module: core · Source: FieldNode.java

The base of every text field: it edits a text, reads a value of type V from it, and handles the focus, the cursor, the selection and the clipboard.

A field turns its text into a value with parse and a value into its text with format; TextFieldNode, IntegerFieldNode and MultilineTextFieldNode are ready to use, and a field of your own type extends LineFieldNode. The field draws its text itself; its only part is an optional background. A held Backspace, Delete or arrow key repeats after 500 ms, then every 100 ms. Attaching a field without a TextInfo throws an IllegalStateException.

ReturnsSignatureSummary
FieldNode(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
backgroundNodenull: no backgroundThe node drawn behind the text, over the whole field, with a zindex of -1; optional.
cursorColor signalColornull: the color of infoThe color of the blinking cursor; null uses the color of info.
selectionColor signalColornew Color(50, 152, 253, 100)The color of the rectangle drawn over the selected text.
placeholderColor signalColornull: the color of info at half its opacityThe color of the placeholder; null uses the color of info at half its opacity.
PropertyTypeDefaultSummary
cursorMargin signaldouble0DThe distance, in design pixels, that the field keeps between the cursor and the edge of the visible text when it scrolls to follow the cursor.
cursorPositionint0The index of the cursor in the text, kept within the text; a plain index is the start value.
PropertyTypeDefaultSummary
textString""The text in the field.
placeholder signalString""The text shown while the field is empty and has no focus.
info signalTextInfonone, info(...) is required before the attachThe font, the size and the color of the text, as a TextInfo; required.
acceptPredicate<String>text -> trueA test that every edit of the user must pass: an edit typed, pasted, cut or deleted whose text fails it is refused, and the text stays as it was.
normalizeUnaryOperator<String>UnaryOperator.identity()A function applied to the text before the field reads a value from it, such as String::trim.
allowEmpty signalbooleanfalseIf true, an empty field is valid and its value is null.
maxTextLength signalintno limitThe largest number of characters of the text; -1 means no limit.
markup signalbooleanfalseIf true, the text is read with the markups of info, so that the tags in the text style it; if false, the field shows the tags as typed.
margin signaldoubleSets the four margins at once.
marginTop signaldouble0DThe space, in design pixels, between the top edge and the text; a one-line field uses it with alignY(START) and to size a field of height 0.
marginBottom signaldouble0DThe space, in design pixels, between the bottom edge and the text; a one-line field uses it with alignY(END) and to size a field of height 0.
marginLeft signaldouble0DThe space, in design pixels, between the left edge and the text; the text is clipped there.
marginRight signaldouble0DThe space, in design pixels, between the right edge and the text; the text is clipped there.
marginHorizontal signaldoubleSets the left and the right margins at once.
marginVertical signaldoubleSets the top and the bottom margins at once.
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
cursorCursor.TEXTnull in Node

ReturnsSignatureSummary
TcursorPosition(Signal cursorPosition)Binds the index of the cursor to a signal both ways.
thismoveCursor(int position) fluentMoves the cursor as if the user did: beforeCursorMove can refuse it, then onCursorMove fires.
TbeforeCursorMove(EventListener<NodeChangeEvent.Pre<T,Integer>> listener)Adds a listener that runs before the cursor moves on a key, a press or moveCursor(...); cancel() keeps it in place.
ReturnsSignatureSummary
Tfocused(boolean focused)Gives the field its start focus: true gives it the keyboard.
Tfocused(Signal focused)Binds the focus to a signal both ways: the field gains or loses the focus with the signal, and writes into it when the user focuses or blurs the field.
thisfocus() fluentGives the field the focus: beforeFocus can refuse it, then onFocus fires; unlike a press, it does not blur the other fields.
TbeforeFocus(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)Adds a listener that runs before the field gains the focus on a press or focus(); cancel() refuses the focus.
booleanisFocused()If true, the field has the focus.
ReturnsSignatureSummary
VgetValue()Returns the value read from the text, normalized and brought into its bounds.
booleanisValid()If true, the text passes accept, reads as a value and that value is already within its bounds; an empty text with allowEmpty(true) is valid.
FieldSelectiongetSelection()Returns the selected range of the text; an empty range when nothing is selected.
ReturnsSignatureSummary
Tselection(int start, int end)Gives the field its start selection, from start to end in any order, kept within the text.
Tselection(Signal selection)Binds the selection to a signal of FieldSelection both ways.
thischange(String text) fluentReplaces the text as if the user typed it: beforeChange can refuse it, then onChange fires.
TbeforeChange(EventListener<NodeFieldChangeEvent.Pre<T,V>> listener)Adds a listener that runs before an edit of the user or change(...), with the text now, the text asked for and the value read from it; cancel() refuses the edit.
thisblur() fluentBlurs the field as a press elsewhere would: beforeBlur can refuse it, then onBlur fires.
TbeforeBlur(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)Adds a listener that runs before the field loses the focus on a press elsewhere, Escape, Enter or blur(); cancel() keeps the focus.
thisselect(int start, int end) fluentSelects a range as if the user did: beforeSelect can refuse it, then onSelect fires.
TbeforeSelect(EventListener<NodeChangeEvent.Pre<T,FieldSelection>> listener)Adds a listener that runs before the selection changes on a key, a press or select(...); cancel() keeps the selection.
ReturnsSignatureSummary
voidlayout() hookPlaces the background over the whole field.
voiddraw(double mouseX, double mouseY) hookDraws the field with drawField(), then repeats a held editing key.
voidmousePressed(NodeMouseEvent<?> event) hookOn a press over the field that no one consumed, blurs the other fields, focuses this one, places the cursor and starts a selection, and consumes the press; a double press selects a word, a triple press a line.
voidmouseReleased(NodeMouseEvent<?> event) hookEnds the selection that a press started.
voidmouseDragged(NodeMouseEvent<?> event) hookExtends the selection to the character under the pointer.
voidmouseScroll(NodeMouseScrollEvent<?> event) hookOver the focused field, steps the value up or down with increment when its type has steps, and consumes the wheel.
voidcharTyped(NodeCharEvent<?> event) hookWhile the field has the focus, inserts the character at the cursor, in place of the selection, and consumes it.
voidkeyPressed(NodeKeyEvent<?> event) hookWhile the field has the focus, handles the editing, the cursor and the clipboard keys and consumes every key; Escape blurs the field.
voiddetach() hookBlurs the field when it leaves the tree.
booleanholdsInput() hook protectedIf true, the field has the focus or a selection by drag goes on: it keeps its keys and its drags while it is scrolled out of the area of its container.
BoundingBoxgetCursorArea() hook abstractReturns the area of the text cursor, in design pixels of the UI, where drawField draws it while the field has the focus.
voiddrawField() hook abstract protectedHook that draws the text, the cursor and the selection, on every frame.
booleanisMultiline() hook abstract protectedHook that returns true when the text may hold line breaks; a one-line field drops them from a paste.
booleanhandleKey(Key key) hook abstract protectedHook that JOID calls first with each key pressed while the field has the focus.
intgetPositionAt(double mouseX, double mouseY) hook abstract protectedHook that returns the index in the text under a point of the UI, in design pixels.
voidfollowCursorForward() hook abstract protectedHook that scrolls the visible text after the cursor moved forward, so that the cursor stays in view with cursorMargin.
voidfollowCursorBackward() hook abstract protectedHook that scrolls the visible text after the cursor moved backward, so that the cursor stays in view with cursorMargin.
Vparse(String text) hook abstract protectedHook that turns a text into a value; return null when the text is not a value.
Stringformat(V value) hook abstract protectedHook that turns a value into the text that the field shows.
Vcorrect(V value) hook protectedHook that brings a value into its bounds, such as a minimum and a maximum; the default returns the value.
booleanaccepts(String text) hook protectedHook that refuses an edit whose text can never become a value, such as a letter in a number field; the default accepts every text.
Vincrement(V value, int count) hook protectedHook that returns the value count steps away, for Up, Down and the wheel; count is negative to go down.
voidfallback(V fallback) protectedGives the value that the field holds while no text was valid yet, such as 0 for a number.
thisstartValue(V value) fluent protectedGives the field a start value of its type, shown through format: the body of a public value(...) setter.
thisbindValue(Signal value) fluent protectedBinds the value to a signal of its type both ways: the field shows the signal through format, and writes the value of each valid edit into it.
voidwrite(V value, boolean refusable) protectedShows a value, brought into its bounds and formatted.
voidrevalidate() protectedShows again the value asked for last, after a bound of the field changed, such as its min or its max.
booleanblurNow() protectedBlurs the field at once.
booleaninsert(String text) protectedInserts a text at the cursor, in place of the selection, as typing would: cleaned of control characters, cut to maxTextLength, and tested by accept and accepts.
voidplaceCursor(int position, boolean forward) protectedMoves the cursor to an index and scrolls to keep it in view; with Shift held, extends the selection.
voidincreaseCursor(int value) protectedMoves the cursor forward by a number of characters and scrolls to keep it in view.
voiddecreaseCursor(int value) protectedMoves the cursor backward by a number of characters and scrolls to keep it in view.
TextInfogetShownInfo() protectedReturns the TextInfo that draws the text: info with its markups, or without them when markup is false.
TextInfogetPlaceholderInfo() protectedReturns the TextInfo that draws the placeholder, in the color of placeholderColor.
ColorgetShownCursorColor() protectedReturns the color of the cursor on this frame, with the opacity of its blink.
doublegetLineX(String text, int[] tags, int start, int end, String prefix, int position) protectedReturns the horizontal offset, in design pixels, of a position within a line of the text from start to end, with the markup tags given by tags and a prefix of opened tags.
intgetLinePosition(String text, int[] tags, int start, int end, String prefix, double x) protectedReturns the index of the line from start to end that is nearest to a horizontal offset, the inverse of getLineX.
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
onChangeEventListener<NodeFieldChangeEvent.Post<T,V>>Adds a listener that runs after each real change of the text, whatever its source.
onFocusEventListener<NodeChangeEvent.Post<T,Boolean>>Adds a listener that runs each time the field gains the focus, whatever its source.
onBlurEventListener<NodeChangeEvent.Post<T,Boolean>>Adds a listener that runs each time the field loses the focus, after it rewrote its text from its value.
onCursorMoveEventListener<NodeChangeEvent.Post<T,Integer>>Adds a listener that runs after each move of the cursor, whatever its source.
onSelectEventListener<NodeChangeEvent.Post<T,FieldSelection>>Adds a listener that runs after each change of the selection, 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

FieldNode(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 background(Node background) fluent
  • Node getBackground()

Default: null: no background

The node drawn behind the text, over the whole field, with a zindex of -1; optional.

  • this cursorColor(Color cursorColor) fluent
  • this cursorColor(Supplier<Color> cursorColor) fluent signal
  • Color getCursorColor()

Default: null: the color of info

The color of the blinking cursor; null uses the color of info.

  • this selectionColor(Color selectionColor) fluent
  • this selectionColor(Supplier<Color> selectionColor) fluent signal
  • Color getSelectionColor()

Default: new Color(50, 152, 253, 100)

The color of the rectangle drawn over the selected text.

  • this placeholderColor(Color placeholderColor) fluent
  • this placeholderColor(Supplier<Color> placeholderColor) fluent signal
  • Color getPlaceholderColor()

Default: null: the color of info at half its opacity

The color of the placeholder; null uses the color of info at half its opacity.

  • this cursorMargin(double cursorMargin) fluent
  • this cursorMargin(Supplier<Double> cursorMargin) fluent signal
  • double getCursorMargin()

Default: 0D

The distance, in design pixels, that the field keeps between the cursor and the edge of the visible text when it scrolls to follow the cursor.

  • this cursorPosition(int cursorPosition) fluent
  • int getCursorPosition()

Default: 0

The index of the cursor in the text, kept within the text; a plain index is the start value. getCursorPosition() reads it.

  • this text(String text) fluent
  • this text(Signal<String> text) fluent
  • String getText()

Default: ""

The text in the field. A plain text is the start value, and a signal binds the text both ways: the field shows the signal and writes each edit into it. A text from code is cleaned of control characters and cut to maxTextLength; it is never refused.

  • this placeholder(String placeholder) fluent
  • this placeholder(Supplier<String> placeholder) fluent signal
  • String getPlaceholder()

Default: ""

The text shown while the field is empty and has no focus.

  • this info(TextInfo info) fluent
  • this info(Supplier<TextInfo> info) fluent signal
  • TextInfo getInfo()

Default: none, info(...) is required before the attach

The font, the size and the color of the text, as a TextInfo; required.

  • this accept(Predicate<String> accept) fluent
  • Predicate<String> getAccept()

Default: text -> true

A test that every edit of the user must pass: an edit typed, pasted, cut or deleted whose text fails it is refused, and the text stays as it was. A text that fails it is not a valid value.

  • this normalize(UnaryOperator<String> normalize) fluent
  • UnaryOperator<String> getNormalize()

Default: UnaryOperator.identity()

A function applied to the text before the field reads a value from it, such as String::trim. The field shows the normalized text when it loses the focus, and at once for a text given by a setter or a signal.

  • this allowEmpty(boolean allowEmpty) fluent
  • this allowEmpty(Supplier<Boolean> allowEmpty) fluent signal
  • boolean isAllowEmpty()

Default: false

If true, an empty field is valid and its value is null. If false, the empty text goes through parse: a TextFieldNode then holds "", and a field whose parse returns null for it, such as IntegerFieldNode, takes back its last valid value when it loses the focus.

  • this maxTextLength(int maxTextLength) fluent
  • this maxTextLength(Supplier<Integer> maxTextLength) fluent signal
  • int getMaxTextLength()

Default: no limit

The largest number of characters of the text; -1 means no limit. Typing and pasting stop at the limit, and a longer text from code is cut.

  • this markup(boolean markup) fluent
  • this markup(Supplier<Boolean> markup) fluent signal
  • boolean isMarkup()

Default: false

If true, the text is read with the markups of info, so that the tags in the text style it; if false, the field shows the tags as typed.

  • this margin(double margin) fluent
  • this margin(Supplier<Double> margin) fluent signal

Sets the four margins at once.

  • this marginTop(double marginTop) fluent
  • this marginTop(Supplier<Double> marginTop) fluent signal
  • double getMarginTop()

Default: 0D

The space, in design pixels, between the top edge and the text; a one-line field uses it with alignY(START) and to size a field of height 0.

  • this marginBottom(double marginBottom) fluent
  • this marginBottom(Supplier<Double> marginBottom) fluent signal
  • double getMarginBottom()

Default: 0D

The space, in design pixels, between the bottom edge and the text; a one-line field uses it with alignY(END) and to size a field of height 0.

  • this marginLeft(double marginLeft) fluent
  • this marginLeft(Supplier<Double> marginLeft) fluent signal
  • double getMarginLeft()

Default: 0D

The space, in design pixels, between the left edge and the text; the text is clipped there.

  • this marginRight(double marginRight) fluent
  • this marginRight(Supplier<Double> marginRight) fluent signal
  • double getMarginRight()

Default: 0D

The space, in design pixels, between the right edge and the text; the text is clipped there.

  • this marginHorizontal(double marginHorizontal) fluent
  • this marginHorizontal(Supplier<Double> marginHorizontal) fluent signal

Sets the left and the right margins at once.

  • this marginVertical(double marginVertical) fluent
  • this marginVertical(Supplier<Double> marginVertical) fluent signal

Sets the top and the bottom margins at once.

<T extends FieldNode<V>> T cursorPosition(Signal<Integer> cursorPosition)

Binds the index of the cursor to a signal both ways. Throws an IllegalArgumentException for a signal that cannot be written.

this moveCursor(int position) fluent

Moves the cursor as if the user did: beforeCursorMove can refuse it, then onCursorMove fires.

<T extends FieldNode<V>> T beforeCursorMove(EventListener<NodeChangeEvent.Pre<T,Integer>> listener)

Adds a listener that runs before the cursor moves on a key, a press or moveCursor(...); cancel() keeps it in place.

<T extends FieldNode<V>> T focused(boolean focused)

Gives the field its start focus: true gives it the keyboard.

<T extends FieldNode<V>> T focused(Signal<Boolean> focused)

Binds the focus to a signal both ways: the field gains or loses the focus with the signal, and writes into it when the user focuses or blurs the field. Throws an IllegalArgumentException for a signal that cannot be written.

this focus() fluent

Gives the field the focus: beforeFocus can refuse it, then onFocus fires; unlike a press, it does not blur the other fields.

<T extends FieldNode<V>> T beforeFocus(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)

Adds a listener that runs before the field gains the focus on a press or focus(); cancel() refuses the focus.

boolean isFocused()

If true, the field has the focus.

V getValue()

Returns the value read from the text, normalized and brought into its bounds. A text that is not a value gives the last valid value; an empty text with allowEmpty(true) gives null.

boolean isValid()

If true, the text passes accept, reads as a value and that value is already within its bounds; an empty text with allowEmpty(true) is valid.

FieldSelection getSelection()

Returns the selected range of the text; an empty range when nothing is selected.

<T extends FieldNode<V>> T selection(int start, int end)

Gives the field its start selection, from start to end in any order, kept within the text. A loss of the focus clears it, even while the text is too short to hold it.

<T extends FieldNode<V>> T selection(Signal<FieldSelection> selection)

Binds the selection to a signal of FieldSelection both ways. Throws an IllegalArgumentException for a signal that cannot be written.

this change(String text) fluent

Replaces the text as if the user typed it: beforeChange can refuse it, then onChange fires.

<T extends FieldNode<V>> T beforeChange(EventListener<NodeFieldChangeEvent.Pre<T,V>> listener)

Adds a listener that runs before an edit of the user or change(...), with the text now, the text asked for and the value read from it; cancel() refuses the edit.

this blur() fluent

Blurs the field as a press elsewhere would: beforeBlur can refuse it, then onBlur fires.

<T extends FieldNode<V>> T beforeBlur(EventListener<NodeChangeEvent.Pre<T,Boolean>> listener)

Adds a listener that runs before the field loses the focus on a press elsewhere, Escape, Enter or blur(); cancel() keeps the focus.

this select(int start, int end) fluent

Selects a range as if the user did: beforeSelect can refuse it, then onSelect fires.

<T extends FieldNode<V>> T beforeSelect(EventListener<NodeChangeEvent.Pre<T,FieldSelection>> listener)

Adds a listener that runs before the selection changes on a key, a press or select(...); cancel() keeps the selection.

void layout() hook

Places the background over the whole field.

void draw(double mouseX, double mouseY) hook

Draws the field with drawField(), then repeats a held editing key. An override calls super.draw(...).

void mousePressed(NodeMouseEvent<?> event) hook

On a press over the field that no one consumed, blurs the other fields, focuses this one, places the cursor and starts a selection, and consumes the press; a double press selects a word, a triple press a line. Any other press blurs the field.

void mouseReleased(NodeMouseEvent<?> event) hook

Ends the selection that a press started.

void mouseDragged(NodeMouseEvent<?> event) hook

Extends the selection to the character under the pointer.

void mouseScroll(NodeMouseScrollEvent<?> event) hook

Over the focused field, steps the value up or down with increment when its type has steps, and consumes the wheel.

void charTyped(NodeCharEvent<?> event) hook

While the field has the focus, inserts the character at the cursor, in place of the selection, and consumes it. A character typed with Ctrl (Cmd on macOS) and without Alt is a shortcut and is not inserted.

void keyPressed(NodeKeyEvent<?> event) hook

While the field has the focus, handles the editing, the cursor and the clipboard keys and consumes every key; Escape blurs the field. It asks handleKey first.

void detach() hook

Blurs the field when it leaves the tree.

boolean holdsInput() hook protected

If true, the field has the focus or a selection by drag goes on: it keeps its keys and its drags while it is scrolled out of the area of its container.

BoundingBox getCursorArea() hook abstract

Returns the area of the text cursor, in design pixels of the UI, where drawField draws it while the field has the focus.

void drawField() hook abstract protected

Hook that draws the text, the cursor and the selection, on every frame.

boolean isMultiline() hook abstract protected

Hook that returns true when the text may hold line breaks; a one-line field drops them from a paste.

boolean handleKey(Key key) hook abstract protected

Hook that JOID calls first with each key pressed while the field has the focus. Return true when the key is handled: the field does nothing else with it, and repeats it while it is held.

int getPositionAt(double mouseX, double mouseY) hook abstract protected

Hook that returns the index in the text under a point of the UI, in design pixels.

void followCursorForward() hook abstract protected

Hook that scrolls the visible text after the cursor moved forward, so that the cursor stays in view with cursorMargin.

void followCursorBackward() hook abstract protected

Hook that scrolls the visible text after the cursor moved backward, so that the cursor stays in view with cursorMargin.

V parse(String text) hook abstract protected

Hook that turns a text into a value; return null when the text is not a value.

String format(V value) hook abstract protected

Hook that turns a value into the text that the field shows.

V correct(V value) hook protected

Hook that brings a value into its bounds, such as a minimum and a maximum; the default returns the value. A text whose value changes here is not valid while typed, and shows the corrected value when the field loses the focus.

boolean accepts(String text) hook protected

Hook that refuses an edit whose text can never become a value, such as a letter in a number field; the default accepts every text. An edit passes only when both accepts and accept let it through.

V increment(V value, int count) hook protected

Hook that returns the value count steps away, for Up, Down and the wheel; count is negative to go down. The default returns null: the type has no steps.

void fallback(V fallback) protected

Gives the value that the field holds while no text was valid yet, such as 0 for a number.

this startValue(V value) fluent protected

Gives the field a start value of its type, shown through format: the body of a public value(...) setter.

this bindValue(Signal<V> value) fluent protected

Binds the value to a signal of its type both ways: the field shows the signal through format, and writes the value of each valid edit into it. Throws an IllegalArgumentException for a signal that cannot be written.

void write(V value, boolean refusable) protected

Shows a value, brought into its bounds and formatted. If refusable is true, the write acts like the user and goes through beforeChange: the body of a public change(...).

void revalidate() protected

Shows again the value asked for last, after a bound of the field changed, such as its min or its max.

boolean blurNow() protected

Blurs the field at once. Returns true when the field lost the focus, false when a beforeBlur listener kept it.

boolean insert(String text) protected

Inserts a text at the cursor, in place of the selection, as typing would: cleaned of control characters, cut to maxTextLength, and tested by accept and accepts. Returns true when the text changed.

void placeCursor(int position, boolean forward) protected

Moves the cursor to an index and scrolls to keep it in view; with Shift held, extends the selection. forward is true for a move toward the end.

void increaseCursor(int value) protected

Moves the cursor forward by a number of characters and scrolls to keep it in view.

void decreaseCursor(int value) protected

Moves the cursor backward by a number of characters and scrolls to keep it in view.

TextInfo getShownInfo() protected

Returns the TextInfo that draws the text: info with its markups, or without them when markup is false.

TextInfo getPlaceholderInfo() protected

Returns the TextInfo that draws the placeholder, in the color of placeholderColor.

Color getShownCursorColor() protected

Returns the color of the cursor on this frame, with the opacity of its blink.

double getLineX(String text, int[] tags, int start, int end, String prefix, int position) protected

Returns the horizontal offset, in design pixels, of a position within a line of the text from start to end, with the markup tags given by tags and a prefix of opened tags.

int getLinePosition(String text, int[] tags, int start, int end, String prefix, double x) protected

Returns the index of the line from start to end that is nearest to a horizontal offset, the inverse of getLineX.

<T extends FieldNode<V>> T onChange(EventListener<NodeFieldChangeEvent.Post<T,V>> listener)

Adds a listener that runs after each real change of the text, whatever its source.

<T extends FieldNode<V>> T onFocus(EventListener<NodeChangeEvent.Post<T,Boolean>> listener)

Adds a listener that runs each time the field gains the focus, whatever its source.

<T extends FieldNode<V>> T onBlur(EventListener<NodeChangeEvent.Post<T,Boolean>> listener)

Adds a listener that runs each time the field loses the focus, after it rewrote its text from its value.

<T extends FieldNode<V>> T onCursorMove(EventListener<NodeChangeEvent.Post<T,Integer>> listener)

Adds a listener that runs after each move of the cursor, whatever its source.

<T extends FieldNode<V>> T onSelect(EventListener<NodeChangeEvent.Post<T,FieldSelection>> listener)

Adds a listener that runs after each change of the selection, whatever its source.


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