Interface SelectionApi
- All Superinterfaces:
com.vaadin.flow.component.HasElement
,Serializable
- All Known Subinterfaces:
FluentVaadinTextField<S,
F, T>
- All Known Implementing Classes:
VBigDecimalField
,VEmailField
,VIntegerField
,VNumberField
,VPasswordField
,VTextArea
,VTextField
public interface SelectionApi
extends com.vaadin.flow.component.HasElement
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
getCursorPosition
(com.vaadin.flow.function.SerializableConsumer<Integer> callback) Asynchronously gets the current cursor position for this field.default void
Asynchronously gets the current selection for this field.default void
Selects all text in the field and moves the focus to the field.default void
setCursorPosition
(int cursorPosition) Sets the cursor position to given index.default void
setSelectionRange
(int selectionStart, int selectionEnd) Sets the start and end positions of the current text selection.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Method Details
-
selectAll
default void selectAll()Selects all text in the field and moves the focus to the field. -
setSelectionRange
default void setSelectionRange(int selectionStart, int selectionEnd) Sets the start and end positions of the current text selection.Note, that the method simply proxies the parameters to the similarly named method in the browser, without sanity checks or any synchronization.
- Parameters:
selectionStart
- The 0-based index of the first selected character. An index greater than the length of the element's value is treated as pointing to the end of the value.selectionEnd
- The 0-based index for the end of the selection (exclusive). An index greater than the length of the element's value is treated as pointing to the end of the value.
-
setCursorPosition
default void setCursorPosition(int cursorPosition) Sets the cursor position to given index.- Parameters:
cursorPosition
- the cursor position
-
getSelectionRange
Asynchronously gets the current selection for this field.- Parameters:
callback
- the callback to notify the selection
-
getCursorPosition
Asynchronously gets the current cursor position for this field.- Parameters:
callback
- the callback to notify the position
-